AtCoder Beginner Contest 112 - Time Limit Exceeded

When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.
You, the smartwatch, has found N routes to his home.
If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.
Find the smallest cost of a route that takes not longer than time T.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 100
 - 1 \leq T \leq 1000
 - 1 \leq c_i \leq 1000
 - 1 \leq t_i \leq 1000
 - The pairs (c_i, t_i) are distinct.

-----Input-----
Input is given from Standard Input in the following format:
N T
c_1 t_1
c_2 t_2
:
c_N t_N

-----Output-----
Print the smallest cost of a route that takes not longer than time T.
If there is no route that takes not longer than time T, print TLE instead.

-----Sample Input-----
3 70
7 60
1 80
4 50

-----Sample Output-----
4

 - The first route gets him home at cost 7.
 - The second route takes longer than time T = 70.
 - The third route gets him home at cost 4.
Thus, the cost 4 of the third route is the minimum.

Source: atcoder | Difficulty: EASY


Solutions:
(n, T) = map(int, input().split())
m = 1001
for i in range(n):
	(c, t) = map(int, input().split())
	if T >= t:
		m = min(m, c)
print('TLE' if m == 1001 else m)


import sys
input = sys.stdin.readline

def main():
	(N, T) = [int(x) for x in input().split()]
	CT = [[int(x) for x in input().split()] for _ in range(N)]
	ans = float('inf')
	for (c, t) in CT:
		if t <= T:
			ans = min(ans, c)
	if ans == float('inf'):
		print('TLE')
	else:
		print(ans)

def __starting_point():
	main()
__starting_point()


(n, T) = map(int, input().split())
r = 100000
for _ in range(n):
	(c, t) = map(int, input().split())
	if t <= T:
		r = min(r, c)
print(r if r != 100000 else 'TLE')


(N, T) = map(int, input().split())
cmin = 10000
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T and c < cmin:
		cmin = c
if cmin == 10000:
	print('TLE')
else:
	print(cmin)


(n, t) = map(int, input().split())
ans = 10 ** 5
for i in range(n):
	(a, b) = map(int, input().split())
	if t >= b:
		ans = min(a, ans)
print(ans if ans < 10000 else 'TLE')


(N, T) = map(int, input().split())
L = []
for i in range(N):
	(x, y) = map(int, input().split())
	if y <= T:
		L.append(x)
if len(L) == 0:
	print('TLE')
else:
	print(min(L))


(N, T) = list(map(int, input().split()))
ct = [9999]
for _ in range(N):
	ctt = list(map(int, input().split()))
	if ctt[1] <= T:
		ct.append(ctt[0])
if ct == [9999]:
	print('TLE')
	return
print(min(ct))


(N, T) = map(int, input().split())
R = [999999999]
for i in range(N):
	(c, t) = map(int, input().split())
	if T >= t:
		R.append(c)
print('TLE' if len(R) == 1 else min(R))


(N, T) = map(int, input().split())
new = []
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		new.append(c)
if len(new) != 0:
	print(min(new))
else:
	print('TLE')


(N, T) = map(int, input().split())
mn = 1001
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		mn = min(c, mn)
print(mn if mn < 1001 else 'TLE')


(n, t) = map(int, input().split())
m = 10000
for i in range(n):
	(a, b) = map(int, input().split())
	if b > t:
		continue
	m = min(m, a)
print(m if m != 10000 else 'TLE')


(N, T) = map(int, input().split())
ans = 1001
for i in range(N):
	(a, b) = map(int, input().split())
	if b <= T:
		ans = min(ans, a)
print('TLE' if ans == 1001 else ans)


(N, T) = map(int, input().split())
ans = 1001
for i in range(N):
	(C, T2) = map(int, input().split())
	if T2 <= T:
		ans = min(ans, C)
print('TLE' if ans == 1001 else ans)


(n, t) = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
y = [i[0] for i in x if i[1] <= t]
print(min(y) if y != [] else 'TLE')


(N, T) = map(int, input().split())
D = [list(map(int, input().split())) for _ in range(N)]
D.sort()
for (c, t) in D:
	if t <= T:
		print(c)
		exit()
print('TLE')


(a, b) = map(int, input().split())
e = []
for i in range(a):
	(c, d) = map(int, input().split())
	if b >= d:
		e.append(c)
if e == []:
	print('TLE')
else:
	print(min(e))


a = []
(m, n) = map(int, input().split())
for i in range(m):
	(c, d) = map(int, input().split())
	if d <= n:
		a.append(c)
if not a:
	print('TLE')
else:
	print(min(a))


(n, T) = map(int, input().split())
ans = 'TLE'
for _ in range(n):
	(c, t) = map(int, input().split())
	if t <= T:
		if ans == 'TLE' or c < ans:
			ans = c
print(ans)


(n, T) = map(int, input().split())
c = []
for i in range(n):
	(C, t) = map(int, input().split())
	if t <= T:
		c.append(C)
print(min(c) if c != [] else 'TLE')


(N, T) = map(int, input().split())
l = []
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		l.append(c)
print(min(l) if l != [] else 'TLE')


(n, T) = map(int, input().split())
root = []
for i in range(n):
	(c, t) = map(int, input().split())
	if t <= T:
		root.append(c)
print(min(root) if len(root) > 0 else 'TLE')


I = lambda : map(int, input().split())
(n, t) = I()
k = [c for (c, s) in [I() for _ in [0] * n] if s <= t]
print(min(k) if k != [] else 'TLE')


(n, t) = list(map(int, input().split()))
li = [list(map(int, input().split())) for i in range(n)]
lis = []
for i in li:
	if i[1] <= t:
		lis.append(i[0])
if len(lis) == 0:
	print('TLE')
else:
	print(min(lis))


(n, t) = map(int, input().split())
c_lists = []
t_lists = []
for i in range(n):
	(c_i, t_i) = map(int, input().split())
	c_lists.append(c_i)
	t_lists.append(t_i)
costs = []
for j in range(n):
	if t_lists[j] <= t:
		costs.append(c_lists[j])
if not costs:
	ans = 'TLE'
else:
	costs.sort()
	ans = costs[0]
print(ans)


(n, T) = map(int, input().split())
b = []
for i in range(n):
	(p, q) = map(int, input().split())
	if q <= T:
		b.append(p)
if b == []:
	print('TLE')
else:
	print(min(b))


(N, T) = map(int, input().split())
m = 1001
for _ in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		m = min(c, m)
print('TLE' if m == 1001 else m)


(N, T) = map(int, input().split())
C = []
for _ in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		C.append(c)
if C == []:
	print('TLE')
else:
	print(min(C))


(N, T) = map(int, input().split())
ans = 10000
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		ans = min(c, ans)
if 1000 < ans:
	ans = 'TLE'
print(ans)


(N, T) = map(int, input().split())
L = list((tuple(map(int, input().split())) for _ in range(N)))
print(min((c for (c, t) in L if t <= T), default='TLE'))


from typing import List

def answer(n: int, t: int, cts: List[List[int]]) -> int:
	costs = [route[0] for route in cts if route[1] <= t]
	if not costs:
		return -1
	return min(costs)

def main():
	(n, t) = list(map(int, input().split()))
	cts = [list(map(int, input().split())) for _ in range(n)]
	ans = answer(n, t, cts)
	print(ans if ans != -1 else 'TLE')

def __starting_point():
	main()
__starting_point()


(N, T) = map(int, input().split())
ans = 2000
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		ans = min(c, ans)
print(ans if ans != 2000 else 'TLE')


(n, T) = list(map(int, input().split()))
CT = [list(map(int, input().split())) for _ in range(n)]
ans = 1001
for (c, t) in CT:
	if t > T:
		continue
	ans = min(ans, c)
if ans == 1001:
	ans = 'TLE'
print(ans)


(N, T) = [int(i) for i in input().split()]
time = [int(c) for (c, t) in [input().split() for _ in range(N)] if int(t) <= T]
print(min(time) if time else 'TLE')


def main():
	(n, time) = list(map(int, input().split()))
	ans = 1001
	for i in range(n):
		(c, t) = list(map(int, input().split()))
		if t <= time:
			ans = min(ans, c)
	print(ans if ans != 1001 else 'TLE')

def __starting_point():
	main()
__starting_point()


(n, t) = list(map(int, input().split()))
ans = 9999
for i in range(n):
	(ci, ti) = list(map(int, input().split()))
	if ti <= t:
		ans = min(ans, ci)
if ans == 9999:
	print('TLE')
else:
	print(ans)


(N, T) = map(int, input().split())
ctl = [list(map(int, input().split())) for _ in range(N)]
cl = [ct[0] for ct in ctl if ct[1] <= T]
print(min(cl) if len(cl) > 0 else 'TLE')


(n, t) = map(int, input().split())
ans = 1001
for _ in range(n):
	(a, b) = map(int, input().split())
	if b <= t:
		ans = min(ans, a)
print(ans if ans <= 1000 else 'TLE')


(N, T) = map(int, input().split())
ans = 2000
for i in range(N):
	a = list(map(int, input().split()))
	if a[1] <= T:
		ans = min(ans, a[0])
print(ans if ans < 2000 else 'TLE')


i = lambda : map(int, input().split())
(N, T) = i()
print(min([c for (c, t) in [i() for _ in [0] * N] if t <= T], default='TLE'))


(N, T, *L) = map(int, open(0).read().split())
print(min([1111] + [c for (c, t) in zip(*[iter(L)] * 2) if t <= T]) % 1111 or 'TLE')


ans = 1001
(N, T) = list(map(int, input().split()))
for i in range(1, N + 1):
	(c, t) = list(map(int, input().split()))
	if c <= ans and t <= T:
		ans = c
if ans == 1001:
	print('TLE')
	return
print(ans)


(n, T) = map(int, input().split())
ans = 10000
for i in range(n):
	(c, t) = map(int, input().split())
	if t <= T:
		ans = min(ans, c)
if ans == 10000:
	print('TLE')
else:
	print(ans)


(n, T) = map(int, input().split())
c = 500000
for i in range(n):
	(a, b) = map(int, input().split())
	if T >= b:
		c = min(c, a)
print(c if c < 500000 else 'TLE')


import sys
import math
sys.setrecursionlimit(10 ** 8)
ini = lambda : int(sys.stdin.readline())
inm = lambda : map(int, sys.stdin.readline().split())
inl = lambda : list(inm())
ins = lambda : sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print('\x1b[33m', *a, '\x1b[0m', **dict(file=sys.stderr, **kw))
(N, T) = inm()
min_cost = 2000
for i in range(N):
	(c, t) = inm()
	if t <= T:
		min_cost = min(min_cost, c)
if min_cost == 2000:
	print('TLE')
else:
	print(min_cost)


(N, T) = map(int, input().split())
m = 1001
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T and c < m:
		m = c
if m == 1001:
	print('TLE')
else:
	print(m)


(N, T) = map(int, input().split())
ans = 1001
ls = []
for i in range(N):
	ls.append(list(map(int, input().split())))
for i in ls:
	if i[1] <= T:
		ans = min(ans, i[0])
	else:
		continue
if ans == 1001:
	print('TLE')
else:
	print(ans)


(n, t) = map(int, input().split())
r = 2000
for _ in range(n):
	(a, b) = map(int, input().split())
	if b <= t and a < r:
		r = a
if r == 2000:
	print('TLE')
else:
	print(r)


(N, T) = map(int, input().split())
CT = [list(map(int, input().split())) for _ in range(N)]
ans = 1001
for ct in CT:
	if ct[1] <= T:
		ans = min(ans, ct[0])
if ans == 1001:
	print('TLE')
else:
	print(ans)


(n, t) = map(int, input().split())
ans = 1001
for i in range(n):
	(c, time) = map(int, input().split())
	if time <= t:
		ans = min(ans, c)
if ans == 1001:
	print('TLE')
else:
	print(ans)


(n, t) = map(int, input().split())
ans = 1001001001
for _ in range(n):
	(ci, ti) = map(int, input().split())
	if ti <= t:
		ans = min(ans, ci)
if ans == 1001001001:
	print('TLE')
else:
	print(ans)


(a, b) = map(int, input().split())
ans = []
for i in range(a):
	(c, d) = map(int, input().split())
	if d <= b:
		ans.append(c)
print('TLE' if len(ans) == 0 else min(ans))


(n, t, *l) = map(int, open(0).read().split())
c = 3000000000.0
for (i, j) in zip(l[::2], l[1::2]):
	if j <= t:
		c = min(c, i)
print(c * (c < 3000000000.0) or 'TLE')


import math
(N, T) = map(int, input().split())
ans = math.inf
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		ans = min(ans, c)
print(ans if ans != math.inf else 'TLE')


(n, t) = map(int, input().split())
m = 10 ** 9
ans = m
for _ in range(n):
	(ci, ti) = map(int, input().split())
	if ti <= t:
		ans = min(ans, ci)
print(ans if ans < m else 'TLE')


(N, T) = map(int, input().split())
CT = [tuple(map(int, input().split())) for _ in range(N)]
res = 1001
for (c, t) in CT:
	if t <= T:
		res = min(res, c)
print(res if res <= 1000 else 'TLE')


(N, T) = list(map(int, input().split()))
INF = 10 ** 9
res = INF
for _ in range(N):
	(c, t) = list(map(int, input().split()))
	if t <= T and c < res:
		res = c
print(res if res != INF else 'TLE')


(n, t) = map(int, input().split())
s = set([1001])
for i in range(n):
	(ci, ti) = map(int, input().split())
	if ti <= t:
		s.add(ci)
print(min(s) if min(s) <= 1000 else 'TLE')


(N, T) = map(int, input().split())
nm = 1000000
for i in range(N):
	(c, t) = map(int, input().split())
	if nm > c and T >= t:
		nm = c
if nm == 1000000:
	print('TLE')
else:
	print(nm)


I = lambda : map(int, input().split())
(N, T) = I()
print((sorted((c for (c, t) in [I() for i in 'N' * N] if t <= T)) + ['TLE'])[0])


(N, T) = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(N)]
e = 10000
for i in C:
	if T >= i[1] and e > i[0]:
		e = i[0]
print('TLE' if e == 10000 else e)


(N, T) = map(int, input().split())
ans = 'TLE'
for i in range(N):
	(a, b) = map(int, input().split())
	if b <= T:
		if ans == 'TLE' or ans > a:
			ans = a
print(ans)


(N, T) = list(map(int, input().split()))
ans = float('inf')
for i in range(N):
	(a, b) = map(int, input().split())
	if T >= b:
		ans = min(ans, a)
print('TLE' if ans == float('inf') else ans)


(n, t) = map(int, input().split())
a = float('inf')
for _ in range(n):
	(c, u) = map(int, input().split())
	if u <= t:
		a = min(a, c)
print('TLE' if a == float('inf') else a)


(n, T) = list(map(int, input().split()))
ct = [list(map(int, input().split())) for i in range(n)]
cost = []
for (c, t) in ct:
	if t <= T:
		cost.append(c)
if len(cost) == 0:
	print('TLE')
else:
	print(min(cost))


def main():
	(N, T) = map(int, input().split())
	l = []
	for _ in range(N):
		(c, t) = map(int, input().split())
		l.append((c, t))
	l.sort()
	for e in l:
		if e[1] <= T:
			print(e[0])
			return
	print('TLE')

def __starting_point():
	main()
__starting_point()


(N, T) = map(int, input().split())
cost = 1000000
num = -1
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T and cost > c:
		cost = c
		num = i + 1
print(cost if num > 0 else 'TLE')


(N, T) = map(int, input().split())
m = 10001
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		m = min(m, c)
print(m if m != 10001 else 'TLE')


(n, t) = map(int, input().split())
c = []
for i in range(0, n):
	(c_i, t_i) = map(int, input().split())
	if t_i <= t:
		c.append(c_i)
if len(c) > 0:
	print(min(c))
else:
	print('TLE')


(n, T) = map(int, input().split())
try:
	c = min((c for (c, t) in [map(int, input().split()) for _ in range(n)] if t <= T))
	print(c)
except:
	print('TLE')


(N, T) = map(int, input().split())
k = 1001
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T and c < k:
		k = c
if k == 1001:
	print('TLE')
	return
print(k)


(n, T) = map(int, input().split())
a = 9999
for i in range(n):
	(c, t) = map(int, input().split())
	if t <= T:
		a = min(a, c)
print(a if a < 9999 else 'TLE')


(n, t) = map(int, input().split())
(c_list, t_list) = ([], [])
for i in range(n):
	(x, y) = map(int, input().split())
	c_list.append(x)
	t_list.append(y)
cost = 1001
for i in range(n):
	if t_list[i] <= t and c_list[i] < cost:
		cost = c_list[i]
print(cost if cost < 1001 else 'TLE')


(n, T) = list(map(int, input().split()))
l = []
count = 0
for i in range(0, n):
	(c, t) = list(map(int, input().split()))
	if t < T or t == T:
		l.append(c)
	else:
		count += 1
if len(l) == 0:
	print('TLE')
else:
	print(int(min(l)))


(N, T) = list(map(int, input().split()))
cost = 'TLE'
for i in range(N):
	(c, t) = list(map(int, input().split()))
	if t <= T:
		if cost == 'TLE':
			cost = c
		elif cost > c:
			cost = c
print(cost)


i = lambda : map(int, input().split())
(N, T) = i()
a = 1001
for _ in [0] * N:
	(c, t) = i()
	if t <= T and a >= c:
		a = c
print('TLE' * (a > 1000) or a)


(N, T) = list(map(int, input().split()))
C_T = [list(map(int, input().split())) for _ in range(N)]
temp_c = 10 ** 10
for (c, t) in C_T:
	if t <= T and c <= temp_c:
		temp_c = c
if temp_c == 10 ** 10:
	ans = 'TLE'
else:
	ans = temp_c
print(ans)


(n, t) = map(int, input().split())
l = []
for i in range(n):
	(c, r) = map(int, input().split())
	if r <= t:
		l.append(c)
print(min(l) if l else 'TLE')


(N, T) = map(int, input().split())
s = 2000
for i in range(N):
	(a, b) = map(int, input().split())
	if b <= T:
		s = min(s, a)
print(s if s < 2000 else 'TLE')


(n, t) = [int(i) for i in input().split()]
list_route = [list(map(int, input().split())) for list_route in range(n)]
ans = 1001
for i in range(0, n):
	if list_route[i][1] <= t and ans >= list_route[i][0]:
		ans = list_route[i][0]
if ans != 1001:
	print(ans)
else:
	print('TLE')


(n, T) = map(int, input().split())
minc = 1001
for _ in range(n):
	(c, t) = map(int, input().split())
	if t <= T:
		minc = min(minc, c)
print('TLE' if minc == 1001 else minc)


(N, T) = map(int, input().split())
l = [list(map(int, input().split())) for i in range(N)]
c = [i[0] for i in l if i[1] <= T]
print(min(c) if c else 'TLE')


(n, t) = map(int, input().split())
l = [list(map(int, input().split())) for i in range(n)]
l = list(sorted(l, key=lambda x: x[1]))
(c, m) = [list(i) for i in zip(*l)]
ans = 9999
for i in range(n):
	if m[i] > t:
		break
	else:
		ans = min(ans, c[i])
if ans == 9999:
	print('TLE')
else:
	print(ans)


(N, T) = map(int, input().split())
cp = float('inf')
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T and c < cp:
		cp = c
print('TLE' if cp == float('inf') else cp)


i = lambda : map(int, input().split())
(N, T) = i()
print(min([c for (c, t) in eval('i(),' * N) if t <= T] or ['TLE']))


(n, t) = map(int, input().split())
a = []
for i in range(n):
	(c, s) = map(int, input().split())
	if s <= t:
		a.append(c)
print('TLE' if len(a) == 0 else min(a))


(N, T) = map(int, input().split())
s = set()
for _ in range(N):
	(c, tt) = map(int, input().split())
	if tt <= T:
		s.add(c)
if len(s) == 0:
	print('TLE')
else:
	print(min(s))


(N, T) = map(int, input().split())
c = [0 for i in range(N)]
t = [0 for i in range(N)]
for i in range(N):
	(c[i], t[i]) = map(int, input().split())
flag = False
ok = []
for i in range(N):
	if t[i] <= T:
		ok.append(t.index(t[i]))
		flag = True
ans = 1001
for i in ok:
	if ans > c[i]:
		ans = c[i]
if flag:
	print(ans)
else:
	print('TLE')


i = lambda : map(int, input().split())
(N, T) = i()
a = 9999
for _ in [0] * N:
	(c, t) = i()
	a = [min(a, c), a][t > T]
print('TLE' * (a > 1000) or a)


(n, t) = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
c = []
for i in range(n):
	if a[i][1] <= t:
		c.append(a[i][0])
if not c:
	print('TLE')
else:
	print(min(c))


(N, T) = map(int, input().split())
ans = 1000000000.0
for _ in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		ans = min(ans, c)
if ans == 1000000000.0:
	ans = 'TLE'
print(ans)


(n, T) = list(map(int, input().split()))
c = [0] * n
t = [0] * n
ans = []
for i in range(n):
	(c[i], t[i]) = list(map(int, input().split()))
	if t[i] <= T:
		ans.append(c[i])
if len(ans) == 0:
	print('TLE')
	return
print(min(ans))


(n, T) = map(int, input().split())
d = list((c for (c, t) in (map(int, input().split()) for _ in range(n)) if t <= T))
if d:
	print(min(d))
else:
	print('TLE')


import math
from statistics import mean
(e1, e2) = list(map(int, input().split()))
h = []
for i in range(e1):
	h.append(list(map(int, input().split())))
r = []
count = 0
for i in range(e1):
	if h[i][1] <= e2:
		r.append(h[i][0])
if len(r) > 0:
	print(min(r))
else:
	print('TLE')


(N, T) = map(int, input().split())
ans = 'TLE'
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		if ans == 'TLE' or ans > c:
			ans = c
print(ans)


(N, T) = map(int, input().split())
s = 10 ** 9
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		s = min(s, c)
if s <= 10 ** 8:
	print(s)
else:
	print('TLE')


(N, T) = map(int, input().split())
ans = 10000
for _ in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		ans = min(ans, c)
if ans == 10000:
	print('TLE')
else:
	print(ans)


(N, T) = map(int, input().split())
A = []
for n in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		A.append(c)
if len(A) == 0:
	print('TLE')
else:
	print(min(A))


(N, T) = map(int, input().split())
ans = 10 ** 10
for i in range(N):
	(c, t) = map(int, input().split())
	if c < ans and t <= T:
		ans = c
print('TLE' if ans == 10 ** 10 else ans)


(n, t) = map(int, input().split())
l = []
for i in range(n):
	(ci, ti) = map(int, input().split())
	if ti <= t:
		l.append(ci)
print(min(l) if len(l) > 0 else 'TLE')


(n, t) = map(int, input().split())
ct = list(filter(lambda x: x[1] <= t, [list(map(int, input().split())) for i in range(n)]))
print('TLE' if len(ct) == 0 else min(ct)[0])


(n, t) = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
l = []
flag = False
for i in range(n):
	if a[i][1] <= t:
		l.append(a[i][0])
		flag = True
if flag:
	print(min(l))
else:
	print('TLE')


(n, t) = map(int, input().split())
ans = 10 ** 10
for _ in range(n):
	(c, tt) = map(int, input().split())
	if tt <= t:
		ans = min(ans, c)
if ans == 10 ** 10:
	print('TLE')
else:
	print(ans)


(N, T) = map(int, input().split())
CT = [list(map(int, input().split())) for _ in range(N)]
cost = 9999
for i in range(N):
	if CT[i][1] <= T:
		if CT[i][0] < cost:
			cost = CT[i][0]
if cost == 9999:
	print('TLE')
else:
	print(cost)
pass


(n, t) = map(int, input().split())
y = 10 ** 5
c = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
	if c[i][1] <= t:
		y = min(y, c[i][0])
if y != 10 ** 5:
	print(y)
else:
	print('TLE')


(n, k) = map(int, input().split())
a = 10000
for i in range(n):
	(c, t) = map(int, input().split())
	if t <= k:
		a = min(a, c)
if a == 10000:
	print('TLE')
else:
	print(a)


(n, t) = map(int, input().split())
c = []
for i in range(n):
	(a, b) = map(int, input().split())
	if b <= t:
		c.append(a)
if c == []:
	print('TLE')
else:
	c.sort()
	print(c[0])


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

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

def main():
	(n, t) = Input()
	data = [Input() for _ in range(n)]
	ans = 1001
	for (cost, time) in data:
		if time <= t:
			ans = min(ans, cost)
	if ans == 1001:
		print('TLE')
	else:
		print(ans)
main()


(n, t) = map(int, input().split())
d = {i: j for (i, j) in [list(map(int, input().split())) for _ in range(n)] if j <= t}
print(sorted(d.items(), key=lambda x: x[0])[0][0] if d else 'TLE')


(n, T) = map(int, input().split())
C = 1001
for i in range(n):
	(c, t) = map(int, input().split())
	if t <= T:
		C = min(C, c)
if C == 1001:
	print('TLE')
	exit()
print(C)


(n, t) = map(int, input().split())
l = []
ans = 'TLE'
for i in range(n):
	(c, time) = map(int, input().split())
	if time <= t:
		l.append(c)
		ans = str(min(l))
print(ans)


(a, b) = map(int, input().split())
l = []
for s in range(a):
	(c, t) = map(int, input().split())
	if t <= b:
		l.append(c)
if len(l) > 0:
	print(min(l))
else:
	print('TLE')


f = lambda : map(int, input().split())
(n, T) = f()
m = min([1001] + [c for (c, t) in [f() for _ in range(n)] if t <= T])
print([m, 'TLE'][m > 1000])


(n, T) = list(map(int, input().split()))
ans = 10 ** 3 + 1
for i in range(n):
	(c, t) = list(map(int, input().split()))
	if t > T:
		continue
	else:
		ans = min(ans, c)
if ans == 10 ** 3 + 1:
	print('TLE')
else:
	print(ans)


(N, T) = map(int, input().split())
r = 1000
f = 0
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		r = min(r, c)
		f = 1
print(r if f == 1 else 'TLE')


(n, T) = map(int, input().split())
x = list()
cnt = 0
for i in range(n):
	(c, t) = map(int, input().split())
	if t <= T:
		x.append(c)
		cnt = 1
if cnt == 0:
	print('TLE')
else:
	print(min(x))


(n, t) = map(int, input().split())
ans = chk = 10000
for i in range(n):
	(x, y) = map(int, input().split())
	if y <= t:
		ans = min(ans, x)
print(ans if ans < 10000 else 'TLE')


(N, T) = map(int, input().split())
Ans = 10 ** 4
for _ in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		Ans = min(Ans, c)
print('TLE' if Ans == 10 ** 4 else Ans)


(N, T) = map(int, input().split())
ct = [c for (c, t) in [map(int, input().split()) for _ in range(N)] if t <= T]
print(min(ct) if len(ct) > 0 else 'TLE')


(n, T) = map(int, input().split())
s = []
for _ in range(n):
	(c, t) = map(int, input().split())
	if t <= T:
		s.append(c)
print(min(s) if len(s) != 0 else 'TLE')


(n, t) = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
costs = []
for i in range(n):
	if l[i][1] <= t:
		costs.append(l[i][0])
if len(costs) == 0:
	print('TLE')
else:
	print(min(costs))


(N, T) = input().split()
N = int(N)
T = int(T)
import numpy as np
c = np.zeros(N)
t = np.zeros(N)
for i in range(N):
	(c[i], t[i]) = input().split()
	c[i] = int(c[i])
	t[i] = int(t[i])
	if t[i] > T:
		c[i] = 1001
if min(c) == 1001:
	print('TLE')
else:
	print(int(min(c)))


(n, t) = map(int, input().split())
m = 9999
for i in range(n):
	(c, y) = map(int, input().split())
	if y <= t:
		m = min(m, c)
print('TLE' if m == 9999 else m)


(n, t) = map(int, input().split())
y = 10 ** 5
for i in range(n):
	(c, x) = map(int, input().split())
	if x <= t:
		y = min(y, c)
if y != 10 ** 5:
	print(y)
else:
	print('TLE')


(N, T) = map(int, input().split())
INF = 10 ** 4
C = [INF]
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		C.append(c)
print(min(C) if len(C) != 1 else 'TLE')


(N, T) = map(int, input().split())
c = [0 for i in range(N)]
t = [0 for i in range(N)]
for i in range(N):
	(c[i], t[i]) = map(int, input().split())
ans = float('inf')
flag = False
for i in range(N):
	if t[i] <= T:
		flag = True
		if ans > c[i]:
			ans = c[i]
if flag:
	print(ans)
else:
	print('TLE')


ma = lambda : map(int, input().split())
lma = lambda : list(map(int, input().split()))
tma = lambda : tuple(map(int, input().split()))
ni = lambda : int(input())
yn = lambda fl: print('Yes') if fl else print('No')
import collections
import math
import itertools
import heapq as hq
import sys
(n, T) = ma()
ans = 10 ** 15
for i in range(n):
	(c, t) = ma()
	if t <= T:
		ans = min(ans, c)
if ans == 10 ** 15:
	print('TLE')
else:
	print(ans)


(n, T) = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(n)]
li = []
for k in ct:
	if k[1] <= T:
		li += [k[0]]
if li == []:
	print('TLE')
else:
	print(min(li))


(n, t) = map(int, input().split())
ma = 1001
for i in range(n):
	(c, ti) = map(int, input().split())
	if ti < t + 1:
		if c < ma:
			ma = c
print(ma if ma != 1001 else 'TLE')


(n, t) = list(map(int, input().split()))
cost = 1001
for i in range(n):
	(ci, ti) = list(map(int, input().split()))
	if ti <= t and ci < cost:
		cost = ci
if cost == 1001:
	print('TLE')
else:
	print(cost)


(n, t) = map(int, input().split())
c = []
for i in range(n):
	(c1, t1) = map(int, input().split())
	if t1 <= t:
		c.append(c1)
print('TLE' if len(c) == 0 else min(c))


(n, t) = map(int, input().split())
a = []
for _ in range(n):
	(i, j) = map(int, input().split())
	if j <= t:
		a.append(i)
print('TLE' if not len(a) else min(a))


(N, T) = map(int, input().split())
li = [list(map(int, input().split())) for i in range(N)]
li2 = []
for i in range(N):
	if li[i][1] <= T:
		li2.append(li[i])
li2.sort()
if len(li2) == 0:
	print('TLE')
	return
print(li2[0][0])


(N, T) = map(int, input().split())
c = []
for i in range(N):
	(C, t) = map(int, input().split())
	if t <= T:
		c.append(C)
if len(c) == 0:
	print('TLE')
else:
	c.sort()
	print(c[0])


(n, t) = list(map(int, input().split()))
mn = 1001
for i in range(n):
	(c, tn) = list(map(int, input().split()))
	if tn <= t and c < mn:
		mn = c
if mn == 1001:
	print('TLE')
else:
	print(mn)


(N, T) = map(int, input().split())
x = 10000
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		x = min(c, x)
if x == 10000:
	print('TLE')
else:
	print(x)


(n, t) = map(int, input().split())
data = [input().split() for i in range(n)]
ans = 1001
for i in range(n):
	if int(data[i][1]) <= t:
		ans = min(ans, int(data[i][0]))
if ans == 1001:
	print('TLE')
else:
	print(ans)


(n, t) = map(int, input().split())
ans = []
for i in range(n):
	(a, b) = map(int, input().split())
	if b <= t:
		ans.append(a)
if len(ans) == 0:
	print('TLE')
else:
	print(min(ans))


I = lambda : map(int, input().split())
(n, k) = I()
s = 1001
for i in range(n):
	(a, b) = I()
	if b <= k:
		s = min(s, a)
if s == 1001:
	print('TLE')
else:
	print(s)


(N, T) = map(int, input().split())
CT = [list(map(int, input().split())) for _ in range(N)]
l = sorted([i for i in CT if i[1] <= T])
print(l[0][0] if l else 'TLE')


(n, t) = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(n)]
ls = [a for (a, b) in s if b <= t]
print('TLE' if len(ls) == 0 else min(ls))


(n, t) = map(int, input().split())
c = 1001
for i in range(n):
	(a, b) = map(int, input().split())
	if b <= t:
		c = min(a, c)
print('TLE' if c == 1001 else c)


(n, t) = map(int, input().split())
ct = [list(map(int, input().split())) for i in range(n)]
flag = 0
ans = ct[0][0]
for i in range(n):
	if ct[i][1] <= t:
		flag = 1
		ans = min(ans, ct[i][0])
	else:
		pass
if flag == 0:
	print('TLE')
else:
	print(ans)


(N, T) = map(int, input().split())
cl = []
for _ in range(1, N + 1):
	(c, t) = map(int, input().split())
	if t <= T:
		cl.append(c)
print('TLE' if not cl else min(cl))


(n, T) = map(int, input().split())
c = 2000
for _ in range(n):
	(a, b) = map(int, input().split())
	if b <= T and a < c:
		c = a
print(c if c < 2000 else 'TLE')


(n, t) = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(n)]
for (c, ti) in sorted(ct):
	if int(ti) <= t:
		print(c)
		exit()
print('TLE')


(N, T) = list(map(int, input().split()))
c = [0] * N
t = [0] * N
for i in range(N):
	(c[i], t[i]) = list(map(int, input().split()))
z = list(zip(c, t))
z = sorted(z)
(c, t) = list(zip(*z))
for i in range(N):
	if t[i] <= T:
		print(c[i])
		return
print('TLE')


(N, T) = map(int, input().split())
k = 1000
l = 1
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T:
		l = 0
		if c < k:
			k = c
if l == 1:
	print('TLE')
else:
	print(k)


(n, t) = map(int, input().split())
cl = []
for i in range(n):
	(c, ti) = map(int, input().split())
	if ti <= t:
		cl.append(c)
print(min(cl) if cl != [] else 'TLE')


(n, t) = map(int, input().split())
c = 10000
for i in range(n):
	tmp = input().split()
	if t >= int(tmp[1]):
		if int(tmp[0]) < c:
			c = int(tmp[0])
if c == 10000:
	print('TLE')
	return
else:
	print(c)


(n, T) = map(int, input().split())
a = 1001
for _ in range(n):
	(c, t) = map(int, input().split())
	if t <= T and c < a:
		a = c
if a == 1001:
	print('TLE')
else:
	print(a)


(N, T) = map(int, input().split())
l = 1003
for i in range(N):
	(c, t) = map(int, input().split())
	if t <= T and c < l:
		l = c
if l == 1003:
	print('TLE')
else:
	print(l)


(n, T) = map(int, input().split())
c = [0 for _ in range(n)]
t = [0 for _ in range(n)]
for i in range(n):
	(c[i], t[i]) = map(int, input().split())
ans = 1001
for i in range(n):
	if t[i] <= T:
		ans = min(ans, c[i])
print(ans if ans != 1001 else 'TLE')


import operator
(N, T) = [int(i) for i in input().split()]
ct_list = [[int(i) for i in input().split()] for j in range(N)]
tmp = list([x for x in ct_list if operator.ge(T, x[1])])
ans = min(tmp, key=lambda x: x[0])[0] if len(tmp) != 0 else 'TLE'
print(ans)


(n, l) = map(int, input().split())
ct = []
for i in range(n):
	(c, t) = map(int, input().split())
	if t <= l:
		ct.append(c)
try:
	print(min(ct))
except:
	print('TLE')


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	(N, T) = list(map(int, readline().split()))
	ans = INF
	for _ in range(N):
		(c, t) = list(map(int, readline().split()))
		if t <= T and ans > c:
			ans = c
	if ans < INF:
		print(ans)
	else:
		print('TLE')
	return

def __starting_point():
	main()
__starting_point()


(N, T) = list(map(int, input().split()))
ct = []
for i in range(N):
	tmp = list(map(int, input().split()))
	ct.append(tmp)
ct.sort()
ans = 0
for i in range(len(ct)):
	if ct[i][1] <= T:
		ans = ct[i][0]
		break
if ans == 0:
	print('TLE')
else:
	print(ans)


(N, T) = map(int, list(input().split()))
c = 1001
for i in range(N):
	(ct, tc) = map(int, list(input().split()))
	if T >= tc and c >= ct:
		c = ct
if c == 1001:
	c = 'TLE'
print(c)


(a, b) = input().split()
a = int(a)
b = int(b)
c = [input().split() for i in range(a)]
d = 1001
for i in range(a):
	if int(c[i][1]) <= b:
		if d > int(c[i][0]):
			d = int(c[i][0])
if d == 1001:
	print('TLE')
else:
	print(d)


(n, t) = map(int, input().split())
ans = 10 ** 9
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
for i in range(n):
	if l[i][1] <= t:
		ans = min(l[i][0], ans)
if ans == 10 ** 9:
	print('TLE')
else:
	print(ans)


(N, T) = map(int, input().split())
routes = [tuple(map(int, input().split())) for _ in range(N)]
res = 1001
for i in range(N):
	if routes[i][1] <= T:
		res = min(res, routes[i][0])
print([res, 'TLE'][res > 1000])


(n, t) = map(int, input().split())
ct = [list(map(int, input().split())) for i in range(n)]
cc = [i[0] for i in ct if i[1] <= t]
print('TLE' if len(cc) == 0 else min(cc))


(n, T) = map(int, input().split())
ans = 10 ** 4
for i in range(n):
	(c, t) = map(int, input().split())
	if t <= T:
		ans = min(ans, c)
if ans == 10 ** 4:
	ans = 'TLE'
print(ans)


(n, t) = map(int, input().split())
ans = 1001
for _ in range(n):
	(cost, time) = map(int, input().split())
	if time <= t:
		ans = min(ans, cost)
print(ans if ans != 1001 else 'TLE')


import sys
(N, T) = list(map(int, input().split()))
ans = 100000
for i in range(N):
	(c, t) = list(map(int, input().split()))
	if t <= T:
		ans = min(ans, c)
if ans == 100000:
	print('TLE')
else:
	print(ans)


(n, m) = map(int, input().split())
k = 1001
for i in range(n):
	(p, j) = map(int, input().split())
	if j <= m:
		k = min(k, p)
print('TLE' if k == 1001 else k)


(n, t) = map(int, input().split())
x = 1234
for i in range(n):
	(c, d) = map(int, input().split())
	if d <= t:
		if c <= x:
			x = c
if x == 1234:
	print('TLE')
else:
	print(x)


(n, t) = map(int, input().split())
ans = 1000000
for i in range(n):
	(x, y) = map(int, input().split())
	if y <= t:
		ans = min(ans, x)
if ans <= 100000:
	print(ans)
else:
	print('TLE')


(num, time) = map(int, input().split())
count = 0
ans = 10000
for i in range(num):
	(cost, tm) = map(int, input().split())
	if tm <= time:
		if cost < ans:
			ans = cost
			max = ans
			count = 1
if count == 0:
	print('TLE')
else:
	print(ans)