AtCoder Beginner Contest 065 - Expired?

Takahashi has a strong stomach. He never gets a stomachache from eating something whose "best-by" date is at most X days earlier.
He gets a stomachache if the "best-by" date of the food is X+1 or more days earlier, though.
Other than that, he finds the food delicious if he eats it not later than the "best-by" date. Otherwise, he does not find it delicious.
Takahashi bought some food A days before the "best-by" date, and ate it B days after he bought it.
Write a program that outputs delicious if he found it delicious, safe if he did not found it delicious but did not get a stomachache either, and dangerous if he got a stomachache.

-----Constraints-----
 - 1 ≤ X,A,B ≤ 10^9

-----Input-----
Input is given from Standard Input in the following format:
X A B

-----Output-----
Print delicious if Takahashi found the food delicious; print safe if he neither found it delicious nor got a stomachache; print dangerous if he got a stomachache.

-----Sample Input-----
4 3 6

-----Sample Output-----
safe

He ate the food three days after the "best-by" date. It was not delicious or harmful for him.

Difficulty: EASY

Starter code:

Solutions:
(x, a, b) = map(int, input().split())
if b <= a:
	print('delicious')
elif a + x >= b:
	print('safe')
else:
	print('dangerous')


(X, A, B) = map(int, input().split())
if A >= B:
	print('delicious')
elif X >= B - A:
	print('safe')
else:
	print('dangerous')


(a, b, c) = input().split()
a = int(a)
b = int(b)
c = int(c)
if b - c >= 0:
	print('delicious')
elif b - c >= -a:
	print('safe')
else:
	print('dangerous')


(x, a, b) = map(int, input().split())
print(['delicious', 'safe', 'dangerous'][(a < b) + (x + a < b)])


(x, a, b) = map(int, input().split())
if 0 < b - a <= x:
	print('safe')
else:
	print('ddealnigceiroouuss'[b - a > x::2])


(x, a, b) = list(map(int, input().split()))
d = b - a
if d <= 0:
	print('delicious ')
elif d <= x:
	print('safe')
else:
	print('dangerous')


(x, a, b) = (int(i) for i in input().split())
if b <= a:
	print('delicious')
elif b <= a + x:
	print('safe')
else:
	print('dangerous')


(x, a, b) = map(int, input().split())
ans = 'delicious'
if 0 < b - a <= x:
	ans = 'safe'
elif b - a > x:
	ans = 'dangerous'
print(ans)


(a, b, c) = map(int, input().split())
print('delicious' if c <= b else 'safe' if c <= a + b else 'dangerous')


(X, A, B) = [int(i) for i in input().split()]
print('delicious' if B - A <= 0 else 'safe' if B - A <= X else 'dangerous')


(X, A, B) = [int(_) for _ in input().split()]
print('delicious' if B <= A else 'safe' if B - A <= X else 'dangerous')


(X, A, B) = map(int, input().split())
print(['dangerous', 'safe', 'delicious'][bool(X >= B - A) + bool(B <= A)])


(a, b, c) = map(int, input().split())
print(['dangerous', 'safe', 'delicious'][(c <= b) + (c - b <= a)])


import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20

def I():
	return int(input())

def F():
	return float(input())

def S():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

def LS():
	return input().split()

def resolve():
	(X, A, B) = LI()
	if B <= A:
		print('delicious')
	elif A < B <= A + X:
		print('safe')
	else:
		print('dangerous')

def __starting_point():
	resolve()
__starting_point()


(X, A, B) = list(map(int, input().split()))
print('delicious' if -A + B <= 0 else 'safe' if B - A <= X else 'dangerous')


(X, A, B) = [int(v) for v in input().split(' ')]
result = A - B
if result >= 0:
	print('delicious')
elif abs(result) > X:
	print('dangerous')
else:
	print('safe')


(x, a, b) = map(int, input().split())
y = b - a
print('delicious' if y <= 0 else 'safe' if x >= y else 'dangerous')


(X, A, B) = (int(T) for T in input().split())
print(['delicious', 'safe', 'dangerous'][(B - A > 0) * (1 + (X - (B - A) < 0))])


def iroha():
	(x, a, b) = list(map(int, input().split()))
	if a - b >= 0:
		print('delicious')
	elif x + a - b >= 0:
		print('safe')
	else:
		print('dangerous')

def __starting_point():
	iroha()
__starting_point()


(x, a, b) = map(int, input().split())
print('ddaenlgiecrioouuss'[b < x::2]) if b < x or x + a < b else print('safe')


(x, a, b) = [int(s) for s in input().split()]
print('delicious' if b <= a else 'safe' if b <= a + x else 'dangerous')


(x, a, b) = map(int, input().split())
ans = ['safe', 'delicious', 'dangerous']
print(ans[b <= a or -(b > a + x)])


(X, A, B) = [int(_) for _ in input().split()]
print(['delicious', 'safe', 'dangerous'][(B - A > 0) + (B - A > X)])


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '4 3 6'
		output = 'safe'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '6 5 1'
		output = 'delicious'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '3 7 12'
		output = 'dangerous'
		self.assertIO(input, output)

def resolve():
	(X, A, B) = list(map(int, input().split()))
	if A - B >= 0:
		print('delicious')
	elif B - A <= X:
		print('safe')
	else:
		print('dangerous')

def __starting_point():
	resolve()
__starting_point()


(X, A, B) = map(int, input().split())
print(['ddealnigceiroouuss'[A - B < 0::2], 'safe'][X + A >= B > A])


(x, a, b) = map(int, input().split())
e = b - a
r = 'safe'
if e > x:
	r = 'dangerous'
elif e < 1:
	r = 'delicious'
print(r)


lst = input().split()
X = int(lst[0])
A = int(lst[1])
B = int(lst[2])
d = B - A
if d <= 0:
	print('delicious')
elif d <= X:
	print('safe')
else:
	print('dangerous')


(X, A, B) = map(int, input().split())
print(['delicious', 'safe', 'dangerous'][(B - A >= X + 1) + (B - A > 0)])


(x, a, b) = map(int, input().split())
print(['delicious', 'safe', 'dangerous'][sorted([a, a + x, b]).index(b)])


(X, A, B) = map(int, input().split())
print('dsdaaenflgeie cr io ou us s'[(B <= A) + (B <= A + X)::3])


(days_of_fine, day_befoe_exparitation, eating_day) = map(int, input().split())
if eating_day <= days_of_fine:
	print('delicious')
elif day_befoe_exparitation < eating_day <= days_of_fine + day_befoe_exparitation:
	print('safe')
else:
	print('dangerous')


(a, s, d) = map(int, input().split())
if s - d >= 0:
	print('delicious')
elif a + s - d >= 0:
	print('safe')
else:
	print('dangerous')


LI = lambda : list(map(int, input().split()))
(X, A, B) = LI()

def main():
	x = B - A
	if x <= 0:
		ans = 'delicious'
	elif x <= X:
		ans = 'safe'
	else:
		ans = 'dangerous'
	print(ans)

def __starting_point():
	main()
__starting_point()


(x, a, b) = list(map(int, input().split()))
if b <= a:
	print('delicious')
elif a < b and abs(a - b) <= x:
	print('safe')
else:
	print('dangerous')


(X, A, B) = map(int, input().split())
date = A - B
if date >= 0:
	ans = 'delicious'
elif abs(date) > X:
	ans = 'dangerous'
else:
	ans = 'safe'
print(ans)


(x, a, b) = map(int, input().split())
d = -1 * a + b
if d <= 0:
	print('delicious')
elif abs(d) <= x:
	print('safe')
else:
	print('dangerous')


import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda : int(sys.stdin.readline())
inl = lambda : [int(x) for x in sys.stdin.readline().split()]
ins = lambda : sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print('\x1b[33m', *a, '\x1b[0m', **dict(file=sys.stderr, **kw))

def solve():
	(x, a, b) = inl()
	if b - a > x:
		return 'dangerous'
	elif b > a:
		return 'safe'
	return 'delicious'
print(solve())


with open(0) as f:
	(X, A, B) = map(int, f.read().split())
if B - A <= 0:
	ans = 'delicious'
if 0 < B - A <= X:
	ans = 'safe'
if B - A > X:
	ans = 'dangerous'
print(ans)


def solve():
	(x, a, b) = map(int, input().split())
	if b <= a:
		print('delicious')
	elif a < b <= a + x:
		print('safe')
	else:
		print('dangerous')

def __starting_point():
	solve()
__starting_point()


(X, A, B) = map(int, input().split())
print('dsdeaalfniegc ei ro ou us s'[(A < B) + (A + X < B)::3])