AtCoder Beginner Contest 094 - Cats and Dogs

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.

-----Sample Input-----
3 5 4

-----Sample Output-----
YES

If there are one cat and four dogs among the B = 5 animals, there are X = 4 cats in total.

Source: atcoder | Difficulty: EASY


Solutions:
(a, b, x) = map(int, input().split())
if a <= x and a + b >= x:
	print('YES')
else:
	print('NO')


import math
(cat, meta, x) = map(int, input().split())
if cat > x or cat + meta < x:
	print('NO')
else:
	print('YES')


(A, B, X) = map(int, input().split())
print('YES' if B >= X - A and X >= A else 'NO')


(A, B, X) = list(map(int, input().split()))
print('YES' if 0 <= X - A <= B else 'NO')


(a, b, c) = map(int, input().split())
if 0 <= c - a <= b:
	print('YES')
else:
	print('NO')


(a, b, x) = map(int, input().split())
print('YNEOS'[a > x or a + b < x::2])


(a, b, x) = map(int, input().split())
print(['NO', 'YES'][a <= x and x <= a + b])


(A, B, C) = [int(x) for x in input().split()]
print('YES' if A <= C <= A + B else 'NO')


(a, b, x) = map(int, input().split())
x -= a
print(['NO', 'YES'][int(0 <= x <= b)])


(a, b, x) = map(int, input().split())
print('NYOE S'[a + b > x and a <= x::2])


(a, b, w) = map(int, input().split())
print('YES' if a <= w <= a + b else 'NO')


(a, b, c) = map(int, input().split())
print('YNEOS'[a > c or c > a + b::2])


(A, B, X) = map(int, input().split())
print('YNEOS'[not A <= X <= A + B::2])


(A, B, X) = map(int, input().split())
s = 'YES'
if A > X or A + B < X:
	s = 'NO'
print(s)


(a, b, x) = [int(i) for i in input().split()]
print('YES' if a <= x <= a + b else 'NO')


(a, b, x) = map(int, input().split())
print(['YES', 'NO'][a + b < x or x < a])


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
if a + b >= c:
	if a <= c:
		print('YES')
	else:
		print('NO')
else:
	print('NO')


(A, B, X) = map(int, input().split())
print(('NO', 'YES')[A <= X <= A + B])


(A, B, X) = map(int, input().split())
print('NYOE S'[(A + B >= X) * (A <= X)::2])


(a, b, x) = map(int, input().split())
print('YES' if x in range(a, a + b + 1) else 'NO')


def main():
	(a, b, x) = list(map(int, input().split()))
	print('YES' if a <= x and a + b >= x else 'NO')

def __starting_point():
	main()
__starting_point()


(A, B, X) = [int(x) for x in input().split()]
print('YNEOS'[1 - (A <= X <= A + B - 1)::2])


(a, b, x) = list(map(int, input().split()))
c = a + b
if x <= c:
	if a > x:
		print('NO')
	else:
		print('YES')
else:
	print('NO')


(a, b, c) = map(int, input().split())
print(['YES', 'NO'][c - a < 0 or c - a > b])


(a, b, c) = [int(x) for x in input().split()]
res = 'YES'
if a > c:
	res = 'NO'
if a + b < c:
	res = 'NO'
print(res)


def resolve():
	(a, b, x) = map(int, input().split())
	ans = ''
	if a <= x and x <= a + b:
		ans = 'YES'
	else:
		ans = 'NO'
	print(ans)
resolve()


(A, B, X) = map(int, input().split())
ans = 'NO'
if A <= X <= A + B:
	ans = 'YES'
print(ans)


import math
(a, b, c) = map(int, input().split())
print('YES' if a <= c <= a + b else 'NO')


(a, b, c) = map(int, input().split())
print(['NO', 'YES'][(a + b >= c) * (a <= c)])


(a, b, x) = map(int, input().split())
print(['NO', 'YES'][~b < a - x < 1])


(A, B, X) = [int(i) for i in input().split()]
if A <= X <= A + B:
	print('YES')
else:
	print('NO')


(a, b, x) = map(int, input().split())
print('NYOE S'[a + b >= x::2] if a <= x else 'NO')


(a, b, c) = map(int, input().split())
print('YNEOS'[not a + b >= c >= a::2])


(a, b, x) = map(int, input().split())
print('NYOE S'[x in range(a, a + b + 1)::2])


(A, B, X) = map(int, input().split())
for i in range(0, B + 1):
	if A + i == X:
		print('YES')
		return
print('NO')


(a, b, x) = map(int, input().split())
print('YNEOS'[x - a not in range(b + 1)::2])


a = input().split(' ')
A = int(a[0])
B = int(a[1])
X = int(a[2])
if A <= X and A + B >= X:
	print('YES')
else:
	print('NO')


lst = input().split()
a = int(lst[0])
b = int(lst[1])
x = int(lst[2])
if x <= a + b and a <= x:
	print('YES')
else:
	print('NO')


(cat_num, unknown_animals, question_num_cat) = map(int, input().split())
if cat_num <= question_num_cat <= cat_num + unknown_animals:
	print('YES')
else:
	print('NO')


def mapt(fn, *args):
	return tuple(map(fn, *args))

def Input():
	return mapt(int, input().split(' '))

def main():
	(a, b, x) = Input()
	print('YES' if a <= x <= a + b else 'NO')
main()


(a, b, x) = map(int, input().split())
print('YNEOS'[not (a + b >= x and x >= a)::2])


(q, w, e) = map(int, input().split())
print('YES' if q <= e <= q + w else 'NO')


(a, b, c) = map(int, input().split())
outp = 'NO'
if a + b >= c and a <= c:
	outp = 'YES'
print(outp)


(n, m, k) = map(int, input().split())
print('YES' if n <= k <= n + m else 'NO')


(A, B, X) = map(int, input().split())
print('YNEOS'[A > X or A + B < X::2])