Emptying Two Piles
Two piles hold A and B coins. A move removes 1 coin from one pile and 2 from the other (your choice which). For each test case, can both piles be emptied exactly?
Input: the first line has T (number of cases); each of the next T lines has A and B.
Output: T lines of YES/NO.
Constraints:
- 1 ≤ T ≤ 104
- 0 ≤ A, B ≤ 109
Sample Tests
Input 1
3 2 1 2 2 3 3
Output 1
YES NO YES
Input 2
1 0 0
Output 2
YES
Discussion (opens after you solve — no spoilers before)
No comments yet.