Someday, Drazil wanted to go on date with Varda. Drazil and Varda live on Cartesian plane. Drazil's home is located in point (0, 0) and Varda's home is located in point (a, b). In each step, he can move in a unit distance in horizontal or vertical direction. In other words, from position (x, y) he can go to positions (x + 1, y), (x - 1, y), (x, y + 1) or (x, y - 1).
Unfortunately, Drazil doesn't have sense of direction. So he randomly chooses the direction he will go to in each step. He may accidentally return back to his house during his travel. Drazil may even not notice that he has arrived to (a, b) and continue travelling.
Luckily, Drazil arrived to the position (a, b) successfully. Drazil said to Varda: "It took me exactly s steps to travel from my house to yours". But Varda is confused about his words, she is not sure that it is possible to get from (0, 0) to (a, b) in exactly s steps. Can you find out if it is possible for Varda?
Input
You are given three integers a, b, and s ( - 109 ≤ a, b ≤ 109, 1 ≤ s ≤ 2·109) in a single line.
Output
If you think Drazil made a mistake and it is impossible to take exactly s steps and get from his home to Varda's home, print "No" (without quotes).
Otherwise, print "Yes".
Examples
Input
5 5 11
Output
No
Input
10 15 25
Output
Yes
Input
0 5 1
Output
No
Input
0 0 2
Output
Yes
Note
In fourth sample case one possible route is: .
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
We are asked to determine whether Drazil can travel from (0,0) to (a,b) in exactly s steps, moving one unit up/down/left/right each step, choosing directions randomly but that doesn't matter for possibility. The question is: given a target (a,b) and step count s, is there a path of exactly s steps that ends at (a,b)? Since steps are unit moves, the minimal number of steps needed is the Manhattan distance: d = |a| + |b|. Because each move changes x or y by ±1. So the minimum steps required to go from (0,0) to (a,b) is d.
Now, can we take more steps than d? Yes, by adding extra moves that cancel out, e.g., go one step in some direction then back. So any path length s must satisfy s >= d and (s - d) must be even? Let's think: The parity of s and d. After each move, the parity of x+y changes? Actually, consider the parity of (x+y) mod 2. Starting at 0 (0+0=0 even). Each move changes x or y by ±1, so x+y changes by ±1, flipping parity each step. So after s steps, parity of x+y is s mod 2 (since each step flips). At target, x+y = a+b. So parity condition: (a+b) mod 2 must equal s mod 2. But is that sufficient? Also, we have the Manhattan distance constraint: s >= d. Also, we can waste steps in pairs to stay in the same parity? Actually, any extra steps can be inserted as "back and forth" moves that net zero displacement. But these extra steps increase s by 2 each (one step away and one step back). So the difference s - d must be even. But wait: Is it necessary that s-d is even? Suppose we have minimal path of length d. That path yields parity condition: d mod 2 must equal (a+b) mod 2? Let's compute d = |a|+|b|. The parity of d and a+b can differ? For example, a=1, b=0: d=1, a+b=1, both odd. a=1,b=1: d=2, a+b=2, both even. a=2,b=0: d=2, a+b=2 even. a=2,b=1: d=3, a+b=3 odd. Actually, note that |a|+|b| and a+b have the same parity because |a| ≡ a (mod 2) if we consider sign? Actually, parity of |a| is same as parity of a (since sign doesn't affect parity). So |a| mod 2 = a mod 2, similarly b. So d = |a|+|b| ≡ a+b (mod 2). So indeed d and a+b have same parity. So parity condition s ≡ a+b (mod 2) is equivalent to s ≡ d (mod 2). Therefore s - d is even? If s ≡ d (mod 2), then s-d is even. Conversely, if s-d is even, then s ≡ d (mod 2) which implies s ≡ a+b (mod 2) because d ≡ a+b mod 2. So both conditions: s >= d and (s - d) even. So the answer is Yes if s >= |a|+|b| and (s - (|a|+|b|)) is even; else No.
But careful: Are there any other constraints? For example, if a and b are huge but s is large, yes. Could there be a case where the target is (0,0) and s is odd? Let's test example 4: 0 0 2 -> d=0, s=2, s>=0, (2-0)=2 even -> Yes. That matches. Example 3: 0 5 1 -> d=5, s=1 <5 -> No. Example 1: 5 5 11 -> d=10, s=11, s>=10, (11-10)=1 odd -> No. Example 2: 10 15 25 -> d=25, s=25, even diff=0 -> Yes. So it's consistent.
Thus answer: Print "Yes" if s >= |a|+|b| and (s - (|a|+|b|)) % 2 == 0, else "No".
But let's double-check: Could there be a scenario where you need to waste steps but cannot because you are stuck? Actually, if you have extra steps, you can always waste them by moving away and coming back, provided s-d is even. Could it be that you cannot waste an odd number of steps because parity constraint forces even difference? Yes. But what if s-d is even but you cannot waste because you're at the target? But you can waste steps before reaching the target: you can overshoot or loop. For any even number, you can insert back-and-forth moves anywhere, so it's possible.
Thus answer is straightforward.
Now, constraints: a,b up to ±1e9, s up to 2e9. So compute d = abs(a) + abs(b) as 64-bit integer (fits up to 2e9). Check condition.
Implementation: read a,b,s. Compute d = abs(a)+abs(b). If s >= d and (s-d)%2 == 0: print "Yes" else "No".
But wait: There might be nuance: Drazil might not notice arriving and continue traveling. But we need exactly s steps to end at (a,b). So we can pass through (a,b) earlier but then continue and come back? However, the condition of exact ending is what matters. So if we can end exactly at (a,b) after s steps, it's fine. The condition above is necessary and sufficient.
Thus answer.
But is there any case where s >= d and (s-d) even but impossible because you can't waste steps without going negative? No, you can waste steps anywhere on plane. You can always do extra moves that return to same point, e.g., step right then left. So it's always possible.
Thus solution.
Let's produce final answer in C++:
code
#include <iostream>
#include <cmath>
using namespace std;
int main() {
long long a, b, s;
cin >> a >> b >> s;
long long d = abs(a) + abs(b);
if (s >= d && (s - d) % 2 == 0) cout << "Yes";
else cout << "No";
return 0;
}
But note: s up to 2e9, int is fine in 32-bit (max 2e9 fits in signed 32-bit? 2e9 is 2,000,000,000 which is less than 2^31-1 = 2,147,483,647, so int is ok. But a and b up to 1e9, sum up to 2e9, also fits in int. But to be safe we can use long long. Not necessary but fine.
Now final answer. The solution checks whether it's possible to travel from (0,0) to (a,b) in exactly s steps using unit moves in the four cardinal directions. The minimal number of steps required is the Manhattan distance d = |a| + |b|. Additional steps can be added in pairs (e.g., moving one step away and then back), so any extra steps must be even. Therefore, the condition is:
s ≥ d,
(s - d) is even.
If both hold, output "Yes"; otherwise, "No".
cpp
#include <iostream>
#include <cmath>
using namespace std;
int main() {
long long a, b, s;
cin >> a >> b >> s;
long long d = abs(a) + abs(b);
if (s >= d && (s - d) % 2 == 0)
cout << "Yes";
else
cout << "No";
return 0;
}