#CCBCMCHIN0000054. Hai đống xu (Coin Piles)
Hai đống xu (Coin Piles)
Coin Piles
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
Two piles contain and coins. Each operation removes one coin from one pile and two from the other, in either orientation. Determine if both piles can be emptied.
Input
One line contains integers , the initial pile sizes.
Output
Print YES if both piles can be emptied, otherwise NO.
Subtasks
-
Subtask 1 (20 points): 0 <= a,b <= 10.
-
Subtask 2 (30 points): 0 <= a,b <= 100000.
-
Subtask 3 (50 points): 0 <= a,b <= 1e9.
Examples
Example 1
Input
2 1
Output
YES
Explanation
For this input, the case-specific computation and the required exact output are shown above. One operation of type (2,1) empties the piles.
Example 2
Input
2 2
Output
NO
Explanation
For this input, the case-specific computation and the required exact output are shown above. Four coins cannot be removed in steps of exactly three coins.