Equal Coins codechef solution – Chef has XX coins worth 11 rupee each and YY coins worth 22 rupees each. He wants to distribute all of these X+YX+Y coins to his two sons so that the total value of coins received by each of them is the same. Find out whether Chef will be able to do so.

Equal Coins solution codechef

Chef has XX coins worth 11 rupee each and YY coins worth 22 rupees each. He wants to distribute all of these X+YX+Y coins to his two sons so that the total value of coins received by each of them is the same. Find out whether Chef will be able to do so.

Equal Coins solution codechef

  • The first line of input contains a single integer TT, denoting the number of testcases. The description of TT test cases follows.
  • Each test case consists of a single line of input containing two space-separated integers XX and YY.

Equal Coins solution codechef

For each test case, print “YES” (without quotes) if Chef can distribute all the coins equally and “NO” otherwise. You may print each character of the string in uppercase or lowercase (for example, the strings “yEs”, “yes”, “Yes” and “YES” will all be treated as identical).

Constraints

  • 1T1031≤T≤103
  • 0X,Y1080≤X,Y≤108
  • X+Y>0X+Y>0

Subtasks

  • Subtask 1 (100 points): Original constraints

Sample Input 1 

4
2 2
1 3
4 0
1 10 

Equal Coins solution codechef

YES
NO
YES
NO

Explanation

Test case 11: Chef gives each of his sons 11 coin worth one rupee and 11 coin worth two rupees.

Test case 33: Chef gives each of his sons 22 coins worth one rupee.

Leave a Comment