Read problem statements in [Russian], [Bengali], and [Mandarin Chinese] as well.

Ann is going to take part in a race. At the start, she has $X$ units of energy. For each subsequent second, she can decide to run or to rest (she must perform the chosen action during the whole second). If she runs, she loses one unit of energy during that second and if she rests, she gains one unit of energy during that second. However, if Ann decides to rest when she has $X$ units of energy, she does not gain any extra energy. Naturally, she cannot decide to run if she has $0$ units of energy.

Ann needs to run for $R$ minutes to reach the goal and she needs to reach it within $M$ minutes. Is Ann able to finish the race on time?

------  Input ------
The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
The first and only line of each test case contains three space-separated integers $X$, $R$ and $M$.

------  Output ------
For each test case, print a single line containing the string "YES" if Ann is able to finish the race or "NO" otherwise (without quotes).
 
------  Constraints ------
$1 ≤ T ≤ 10^{5}$
$1 ≤ X,R,M ≤ 10^{9}$
 
------  Subtasks ------
Subtask #1 (100 points): original constraints

----- Sample Input 1 ------ 
2

60 3 5

60 3 4
----- Sample Output 1 ------ 
YES

NO
----- explanation 1 ------ 
Example case 1: Ann can run during the first, third and fifth minute. There are other possible solutions.

Example case 2: It is not possible for Ann to finish the race within four minutes.

Source: codechef | Difficulty: MEDIUM_HARD
Tags: Constructive algorithms

Ad-hoc


Solutions:
T = int(input())
for i in range(T):
	(X, R, M) = map(int, input().split())
	if M < R:
		print('NO')
	else:
		required = R * 60
		gain = (M - R) * 60 + X
		if required <= gain:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	(x, r, m) = map(int, input().split())
	(r, m) = (r * 60, m * 60)
	req = min(x, r)
	r -= req
	req += 2 * r
	if req <= m:
		print('YES')
	else:
		print('NO')


from sys import stdin, stdout
input = stdin.readline
t = int(input().strip())
for _ in range(t):
	(x, r, m) = list(map(int, input().strip().split()))
	if r > m:
		print('NO')
		continue
	r_seconds = r * 60
	m_seconds = m * 60
	div = r_seconds // x
	rem = r_seconds % x
	total = (div * 2 - 1) * x + rem * 2
	if total <= m_seconds:
		print('YES')
	else:
		print('NO')


try:
	for _ in range(int(input())):
		(x, r, m) = list(map(int, input().split()))
		r = 60 * r
		m = 60 * m
		req = 0
		req += min(x, r)
		r -= min(x, r)
		req += 2 * r
		if req <= m:
			print('YES')
		else:
			print('NO')
except:
	pass


import math
t = int(input())
for j in range(t):
	(x, r, m) = map(int, input().split())
	r = r * 60
	m = m * 60
	time = 0
	if x >= r:
		time += r
	else:
		time = (r - x) * 2 + x
	if time <= m:
		print('YES')
	else:
		print('NO')


try:
	for t in range(int(input())):
		(X, R, M) = tuple(map(int, input().split()))
		R = 60 * R
		M = 60 * M
		flag = 0
		R -= X
		M -= X
		X = 0
		if M < R:
			print('NO')
			continue
		if R < 0:
			print('YES')
			continue
		if M // 2 >= R:
			print('YES')
		else:
			print('NO')
except:
	pass


for i in range(int(input())):
	(x, r, m) = map(int, input().split())
	r *= 60
	m *= 60
	if min(x, r) + max(r - x, 0) * 2 <= m:
		print('YES')
	else:
		print('NO')


T = int(input())
for i in range(T):
	(X, R, M) = map(int, input().split())
	r = R * 60
	m = M * 60
	if M > R and m >= X + 2 * (r - X):
		print('YES')
	else:
		print('NO')


for i in range(int(input())):
	(x, m, n) = map(float, input().split())
	if m * 60 <= x + (n * 60 - x) / 2 and n >= m:
		print('YES')
	else:
		print('NO')


queries = int(input())
while queries > 0:
	queries -= 1
	(x, r, m) = map(int, input().split())
	if m >= r:
		if x + (m - r) * 60 >= r * 60:
			print('YES')
		else:
			print('NO')
	else:
		print('NO')


T = int(input())
for i in range(T):
	(x, r, m) = map(int, input().split())
	k = r * 2 - 1 - (x / 60 - 1)
	if k <= m and r <= m:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(x, r, m) = map(int, input().split())
	r *= 60
	m *= 60
	k = 0
	k += min(x, r)
	r -= min(x, r)
	k += 2 * r
	if k <= m:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(x, r, m) = map(int, input().split())
	r = r * 60
	m = m * 60
	k = x + 2 * (r - x)
	if m < r:
		print('NO')
	elif x >= r:
		print('YES')
	elif k <= m:
		print('YES')
	else:
		print('NO')


try:
	for _ in range(int(input())):
		A = [int(x) for x in input().split()]
		(r, m) = (A[1] * 60, A[2] * 60)
		res = 0
		res += min(r, A[0])
		r -= min(r, A[0])
		res += 2 * r
		if res <= m:
			print('YES')
		else:
			print('NO')
except:
	pass


for _ in range(int(input())):
	(x, r, m) = map(int, input().split())
	r = r * 60
	m = m * 60
	if r > m:
		print('NO')
	else:
		ex = m - r
		if x + ex >= r:
			print('YES')
		else:
			print('NO')


t = int(input())
while t != 0:
	(x, r, m) = list(map(int, input().split()))
	k = r / m
	r = r * 60
	m = m * 60
	if m - r - r + x >= 0 and m > r:
		print('YES')
	else:
		print('NO')
	t = t - 1


T = int(input())
for i in range(T):
	(X, R, M) = map(int, input().split())
	R = 60 * R
	M = 60 * M
	if R > M:
		print('NO')
	elif R <= X:
		print('YES')
	elif X + 2 * (R - X) <= M:
		print('YES')
	else:
		print('NO')


q = int(input())
for i in range(q):
	(x, r, m) = map(int, input().split())
	if m < r:
		print('NO')
	else:
		req = r * 60
		got = (m - r) * 60 + x
		if req <= got:
			print('YES')
		else:
			print('NO')


for _ in range(int(input())):
	(x, r, m) = map(int, input().split())
	r = r * 60
	m = m * 60
	if x >= r:
		if r > m:
			print('NO')
			continue
		print('YES')
		continue
	sub = r - x
	t = x + 2 * sub
	if t > m:
		print('NO')
		continue
	print('YES')


t = int(input())
for _ in range(t):
	(X, r, m) = map(int, input().split())
	if r > m:
		print('NO')
		continue
	rem = X - r * 60
	if rem > 0:
		print('YES')
		continue
	need = abs(rem)
	if (m - r) * 60 < need:
		print('NO')
		continue
	print('YES')


i = int(input())
while i > 0:
	(x, r, m) = map(int, input().split())
	if r * 60 < x:
		if r * 60 <= m * 60:
			print('YES')
		else:
			print('NO')
	elif 2 * r * 60 - x <= m * 60:
		print('YES')
	else:
		print('NO')
	i = i - 1


for i in range(int(input())):
	count = 0
	(x, r, m) = map(int, input().split())
	if x >= 60 * r:
		if r <= m:
			print('YES')
		else:
			print('NO')
	elif x + 2 * (60 * r - x) <= 60 * m:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(x, r, m) = map(int, input().split())
	rsec = r * 60
	msec = m * 60
	if m < r:
		print('NO')
	elif x >= rsec:
		print('YES')
	else:
		extra = msec - rsec
		if extra + x >= rsec:
			print('YES')
		else:
			print('NO')


import sys, math, itertools, random, bisect
from collections import defaultdict
INF = 10 ** 18

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 10 ** 9 + 7
for _ in range(int(input())):
	(x, r, m) = get_ints()
	if r > m:
		print('NO')
		continue
	r *= 60
	m *= 60
	run = x
	time = x
	if run >= r:
		print('YES')
	else:
		time += 2 * (r - run)
		if time <= m:
			print('YES')
		else:
			print('NO')


t = int(input())
while t:
	(x, r, m) = map(int, input().split())
	r = r * 60
	m = m * 60
	if x < r:
		if m > r and m - r + x >= r:
			print('YES')
		else:
			print('NO')
	elif r < m:
		print('YES')
	else:
		print('NO')
	t -= 1


t = int(input())
for _ in range(t):
	totRun = 0
	(x, r, m) = map(int, input().split())
	rmin = r * 60
	mmin = m * 60
	if rmin >= x:
		run = rmin - x
		rem = run * 2 + x
		if rem <= mmin:
			print('YES')
		else:
			print('NO')
	elif rmin <= mmin:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	o = list(map(int, input().split()))
	x = o[0]
	r = o[1]
	m = o[2]
	if m < r:
		print('NO')
	elif (m - r) * 60 >= r * 60 - x:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(x, r, m) = map(int, input().split())
	a = 60 * r
	b = 60 * m
	c = 0
	c += min(x, a)
	a -= min(x, a)
	c += 2 * a
	if c <= b:
		print('YES')
	else:
		print('NO')


t = int(input())
for i in range(t):
	(x, r, m) = map(int, input().split())
	if m < r:
		print('NO')
	elif x + (m - r) * 60 >= r * 60:
		print('YES')
	else:
		print('NO')


try:
	t = int(input())
	for i in range(0, t):
		(x, r, m) = map(int, input().split(' '))
		r *= 60
		m *= 60
		c = r - x
		if r > m:
			print('NO')
		elif c <= 0:
			print('YES')
		elif x + c + c <= m:
			print('YES')
		else:
			print('NO')
except:
	pass


for i in range(int(input())):
	(x, r, m) = [int(x) for x in input().split()]
	if r > m:
		print('NO')
		continue
	relax = (m - r) * 60
	if x + relax >= r * 60:
		print('YES')
	else:
		print('NO')


import sys
intinp = lambda : int(input())

def listinp(func=int):
	return list(map(func, input().split()))

def nsepline(n, func=str):
	return [func(input()) for _ in range(n)]

def printlist(li, glue=' '):
	return glue.join(list(map(str, li)))

def fop(s, end='\n'):
	sys.stdout.write(str(s) + end)

def fip():
	return sys.stdin.readline().strip()
fintinp = lambda : int(fip())

def flistinp(func=int):
	return list(map(func, fip().split()))

def fnsepline(n, func=str):
	return [func(fip()) for _ in range(n)]
test_cases = fintinp()
for _ in range(test_cases):
	(x, r, m) = flistinp()
	r *= 60
	m *= 60
	ans = x
	if r - ans <= 0:
		ans = min(ans, r)
		print('YES' if ans <= m else 'NO')
		continue
	r -= x
	print('YES' if ans + r + r <= m else 'NO')


T = int(input())
for z in range(T):
	(X, R, M) = map(int, input().split())
	R = R * 60
	M = M * 60
	main = R // X
	rem = R % X
	if M < R:
		print('NO')
		continue
	if X > R:
		print('YES')
		continue
	main = main + (main - 1)
	main = main * X
	if rem > 0:
		main = main + 2 * rem
	if main <= M:
		print('YES')
	else:
		print('NO')


def solve():
	(x, r, m) = map(int, input().split())
	if r > m:
		print('NO')
	else:
		d = 2 * r - m
		if d * 60 <= x:
			print('YES')
		else:
			print('NO')
for _ in range(int(input())):
	solve()


import sys
input = lambda : sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 4)
from math import sqrt, ceil
t = int(input())
for _ in range(t):
	(X, R, M) = map(int, input().split())
	R *= 60
	M *= 60
	if X + max((M - X) // 2, 0) >= R and M >= R:
		print('YES')
	else:
		print('NO')


t = int(input())
for _ in range(t):
	(a, b, c) = [int(i) for i in input().split()]
	rtime = b * 60
	gtime = c * 60
	if a >= rtime:
		if c < b:
			print('NO')
		else:
			print('YES')
	else:
		rtime = rtime - a
		total = a + rtime * 2
		if total <= gtime:
			print('YES')
		else:
			print('NO')


for i in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	if c > b and a - b * 60 + (c - b) * 60 >= 0:
		print('YES')
	else:
		print('NO')


for _ in range(int(input())):
	(x, r, m) = map(int, input().split())
	(r, m) = (r * 60, m * 60)
	if x >= r:
		t = 0
		ans = r
	elif r % x != 0:
		t = r // x
		ans = t * x + (t - 1) * x + r % x * 2
	else:
		t = r // x
		ans = t * x + (t - 1) * x
	if ans <= m:
		print('YES')
	else:
		print('NO')


t = int(input())
while t:
	t = t - 1
	(a, y, x) = map(int, input().split())
	y = y * 60 - a
	x = x * 60 - a
	if y > x:
		print('NO')
	elif x >= 2 * y:
		print('YES')
	else:
		print('NO')


def solve(x, r, m):
	r = r * 60
	m = m * 60
	requiredTime = min(x, r)
	r -= requiredTime
	requiredTime += 2 * r
	return 'YES' if requiredTime <= m else 'NO'
for _ in range(int(input())):
	(x, r, m) = map(int, input().strip().split())
	print(solve(x, r, m))


try:
	for _ in range(int(input())):
		(x, r, m) = map(int, input().split())
		run = r * 60
		minu = m * 60
		if r > m:
			print('NO')
		elif r == m:
			if run <= x:
				print('YES')
			else:
				print('NO')
		else:
			run = run - x
			minu = minu - x
			if run <= minu // 2:
				print('YES')
			else:
				print('NO')
except:
	pass


t = int(input())
while t:
	(a, b, c) = map(int, input().split())
	if c > b and a - b * 60 + (c - b) * 60 >= 0:
		print('YES')
	else:
		print('NO')
	t -= 1


for i in range(int(input())):
	(x, r, m) = map(int, input().split())
	r = r * 60
	m = m * 60
	if r < x:
		if m < r:
			print('NO')
		else:
			print('YES')
	else:
		a = r // x
		b = 0
		if r % x != 0:
			b = r % x
		else:
			b = (a - 1) * x
		if 2 * (r - x) + x <= m:
			print('YES')
		else:
			print('NO')


for i in range(int(input())):
	l1 = list(map(int, input().split()))
	X = l1[0]
	R = l1[1]
	M = l1[2]
	req = 0
	t = R * 60
	m = M * 60
	req += min(X, t)
	t -= min(X, t)
	req += 2 * t
	if req <= m:
		print('YES')
	elif req > m:
		print('NO')