Codechef•May 12, 2025
Candy Distribution
Hazrat Ali
Codechef
Chef has NN candies. He has to distribute them to exactly MM of his friends such that each friend gets equal number of candies and each friend gets even number of candies. Determine whether it is possible to do so.
NOTE: Chef will not take any candies himself and will distribute all the candies.
Input Format
- First line will contain TT, number of test cases. Then the test cases follow.
- Each test case contains of a single line of input, two integers NN and MM, the number of candies and the number of friends.
Output Format
For each test case, the output will consist of a single line containing Yes
if Chef can distribute the candies as per the conditions 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
- 1≤T≤1000
- 1≤N,M≤1000
Sample 1:
Input
4 9 3 4 1 4 2 8 3
Output
No Yes Yes No
Solution
for i in range(int(input())):
(x, y) = map(int, input().split(' '))
if (x/y)%2 == 0:
print("Yes")
else:
print("No")