There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs.
Determine if it is possible that there are exactly X cats among these A + B animals.
Constraints
1 \leq A \leq 100
1 \leq B \leq 100
1 \leq X \leq 200
All values in
input are integers.
Input
Input is given from Standard Input in the following format:
A B X
Output
If it is possible that there are exactly X cats, print YES; if it is impossible, print NO.
Examples
Input
3 5 4
Output
YES
Input
2 2 6
Output
NO
Input
5 3 2
Output
NO
Assistant
We need to parse the problem carefully.
We have total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs.
So there is a set of animals. Some are definitely cats (A of them). The rest B animals are unknown: each could be a cat or a dog. So the total number of cats is at least A (since the known cats are cats) plus some number from the B unknowns that might be cats. The unknowns could be all cats, all dogs, or any mixture. So the total cats can range from A (if all unknowns are dogs) to A + B (if all unknowns are cats). So possible cat counts are integers from A to A+B inclusive.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Example3: A=5, B=3, X=2 -> A=5, so 2<5 -> NO. Output NO. OK.
So it's indeed that simple.
But the problem statement says "There are a total of A + B cats and dogs. Among them, A are known to be cats, but the remaining B are not known to be either cats or dogs." So it's exactly as described.
Thus solution: read A, B, X; if A <= X <= A+B print YES else NO.
Edge cases: A, B up to 100, X up to 200, so no overflow.
Thus trivial.
But we need to output exactly "YES" or "NO".
Write a Python code.
Now as ChatGPT we need to respond with solution.
We must provide a thorough explanation? Possibly just code? The instructions: "We need to output the answer". But as a language model, we need to produce the final solution. Typically we output the code.
I'll include explanation and code.
Check: The problem might have nuance: "cats and dogs" implies there are only these two types? It says "cats and dogs", so the unknown B are either cats or dogs. So yes.
Thus final answer.
I'll write Python solution.
Implement:
def solve():
import sys
A, B, X = map(int, sys.stdin.read().split())
if A <= X <= A+B:
print("YES")
else:
print("NO")
Edge case: Input could have newline etc. Works.
Now provide final. ```python
import sys
def main():
A, B, X = map(int, sys.stdin.read().split())
if A <= X <= A + B:
print("YES")
else:
print("NO")