-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2202A.cpp
More file actions
39 lines (33 loc) · 1.01 KB
/
Copy path2202A.cpp
File metadata and controls
39 lines (33 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <bits/stdc++.h>
using namespace std;
template<typename T>
void _debug(const char* name, T&& value) {
cerr << name << " = " << value << endl;
}
template<typename T, typename... Args>
void _debug(const char* names, T&& value, Args&&... args) {
const char* comma = strchr(names, ',');
cerr.write(names, comma - names) << " = " << value << " | ";
_debug(comma + 1, args...);
}
#define debug(...) _debug(#__VA_ARGS__, __VA_ARGS__)
#define ll long long
#define REP(i,n) for(int i=0; i<n; i++)
#define RREP(i,n) for(int i=n-1; i>=0; i--)
#define mod 1000000007
void solve() {
int x, y; cin >> x >> y;
if(y>0) cout << (((x-2*y)%3 == 0 && (x-2*y)>=0) ? "YES" : "NO");
else if(y==0) cout << ((x%3 == 0) ? "YES" : "NO");
else if (y<0) cout << (((x-(4*y*-1))%3 == 0 && (x-(y*-1*4))>=0) ? "YES" : "NO");
cout << "\n";
}
int main() {
// ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
ll test = 1;
cin >> test;
while(test--) {
solve();
}
return 0;
}