Chef has X coins value one rupee every and Y coins value a pair of rupees every. He desires to distribute all of those X+Y coins to his 2 sons in order that the whole price of coins received by every of them is that the same. determine whether or not cook are ready to do thus.
Input Format
The first line of input contains one whole number T, denoting the amount of testcases. the outline of T take a look at cases follows.
Each action at law consists of one line of input containing 2 space-separated integers X and Y.
Output Format
For each action at law, print "YES" (without quotes) if cook will distribute all the coins equally and "NO" otherwise. you'll print every character of the string in majuscule or minuscule (for example, the strings "yEs", "yes", "Yes" and "YES" can all be treated as identical).
Constraints
1≤T≤103
0≤X,Y≤108
X+Y>0
Subtasks
Subtask one (100 points): Original constraints
Sample Input one
4
2 2
1 3
4 0
1 10
Sample Output one
YES
NO
YES
NO
Explanation
Test case one: cook offers every of his sons one coin value one rupee and 1 coin value 2 rupees.
Test case 3: cook offers every of his sons a pair of coins value one rupee.
Code:
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
long x,y;
cin>>x>>y;
long long int z=x+2*y;
if(z%2) cout<<"NO"<<endl;
else{
if(x==0 and y%2) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
}
}
return 0;
}
ConversionConversion EmoticonEmoticon