fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin >> t;
  7. while (t--) {
  8. int a, b;
  9. cin >> a >> b;
  10. if ((a + b) % 3 == 0 && a <= 2 * b && b <= 2 * a) {
  11. cout << "YES" << endl;
  12. } else {
  13. cout << "NO" << endl;
  14. }
  15. }
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0.01s 5296KB
stdin
5
2 2 
1 1
4 10
3 5
1 2
stdout
NO
NO
NO
NO
YES