Problem:
 Score : 200 points    Problem Statement 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 1 3 70
7 60
1 80
4 50      Sample Output 1 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.       Sample Input 2 4 3
1 1000
2 4
3 1000
4 500      Sample Output 2 TLE  There is no route that takes not longer than time T = 3 .       Sample Input 3 5 9
25 8
5 9
4 10
1000 1000
6 1      Sample Output 3 5

Solution (Python):

n, t = [ int(v) for v in input().split() ]
min_cost = 1001

for i in range(n):
	a, b = [ int(v) for v in input().split() ]
	if b <= t:
		min_cost = min(min_cost,a)
if min_cost == 1001:
	print("TLE")
else:
	print(min_cost)

Solution (Python):
N,T = map(int, input().split())

c_list = []

for i in range(N):
    c,t = map(int, input().split())
    if t <= T: c_list.append(c)

print(min(c_list)) if len(c_list) > 0 else print('TLE')

Solution (Python):
N, T = map(int, input().split())
l = []
ans = 1000
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T and c <= ans:
        l.append(t)
        ans = c
 
if l:
    print(ans)
else:
    print('TLE')

Solution (Python):
from __future__ import print_function


import sys
import math
import string
import fractions
import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop



import random




def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)


def main():
    n,t = map(int, input().split())
    minx=sys.maxsize
    for i in range(n):
        cc,tt = map(int, input().split())
        if tt<=t:
            minx = cc if cc<minx else minx
    if minx<sys.maxsize:
        print(minx)
    else:
        print("TLE")



if __name__ == '__main__':
    main()

Solution (Python):
N, T = map(int, input().split())
c_min = 1001

for i in range(N):
  c, t = map(int, input().split())
  if t <= T and c < c_min:
    c_min = c

if c_min == 1001:
  print('TLE')
else:
  print(c_min)

Solution (Python):
n, T = map(int, input().split())

clist =[]
for i in range(n):
    c, t = map(int, input().split())
    if T >= t :
        clist.append(c)

if clist == []:
    print("TLE")
else:  
    print(min(clist))

Solution (Python):
N, T = map(int, input().split())
CT = [tuple(map(int, input().split())) for _ in range(N)]
CT = [ct for ct in CT if ct[1] <= T]
if len(CT) == 0:
    print("TLE")
else:
    print(min([ct[0] for ct in CT]))

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

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

Solution (Python):
n,t = map(int, input().split())
minc = 10**8
for i in range(n):
    c, ti = map(int, input().split())
    if ti > t: continue
    if c < minc: minc = c
print(minc if minc <= 10**3 else "TLE")

Solution (Python):
N, T = map(int, input().split())
r = [tuple(map(int, input().split())) for _ in range(N)]
f = [(c, t) for c, t in r if t <= T]
if len(f)==0:
  print('TLE')
else:
  print(min(f, key=lambda x: x[0])[0])

Solution (Python):
N, T = map(int, input().split())
cList = []; tList = []
for i in range(N):
    c, t = map(int, input().split())
    cList.append(c); tList.append(t)
ans = 10**4
for i in range(N):
    if tList[i] <= T:
        ans = min(ans, cList[i])
print(ans if not ans == 10**4 else "TLE")

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

Solution (Python):
N, T = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(N)]
minC = 1001
for i, v in enumerate(ct):
  if v[1] <= T:
    if minC > v[0]:
      minC = v[0]
if minC > 1000:
    print("TLE")
else:
    print(minC)

Solution (Python):
N, T = [int(nt) for nt in input().split()]
mn_c = 1001
for n in range(N):
  c, t = [int(ct) for ct in input().split()]
  if t <= T:
    if c < mn_c:
      mn_c = c
if mn_c < 1001:
  print(mn_c)
else:
  print("TLE")

Solution (Python):

import sys


def solve(N: int, T: int, C: "List[int]", TI: "List[int]"):

    L = []
    for c,t in zip(C,TI):
        L.append((c,t))
    L.sort()
    L = list(filter(lambda x: x[1] <= T,L))

    if len(L) == 0:
        print("TLE")
    else:
        print(L[0][0])


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    T = int(next(tokens))  
    c = [int()] * (N)  
    t = [int()] * (N)  
    for i in range(N):
        c[i] = int(next(tokens))
        t[i] = int(next(tokens))
    solve(N, T, c, t)

if __name__ == '__main__':
    main()

Solution (Python):
n,t = map(int, input().split())
m = 1001
index = -1
for i in range(n):
    c1, t1 = map(int, input().split())
    if t1 <= t:
        if m >= c1:
            m = c1
            index = i + 1
if m != 1001:
    print(m)
else:
    print("TLE")

Solution (Python):
n, t = map(int, input().split())

ans = float('inf')

for _ in range(n):
    cost, time = map(int, input().split())
    if time <= t:
        ans = min(cost, ans)

if ans == float('inf'):
    print('TLE')
else:
    print(ans)

Solution (Python):
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for i in range(n)]
ans=1001
for i in range(n):
  if ct[i][0]<=ans and ct[i][1]<=t:
    ans=ct[i][0]
if ans<1001:
  print(ans)
else:
  print("TLE")

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

Solution (Python):
n, T = map(int, input().split())
c = []
min_c = 1001
for _ in range(n):
    c, t = map(int, input().split())
    if t <= T and min_c > c:
        min_c = c

if min_c == 1001:
    print('TLE')
else:
    print(min_c)

Solution (Python):
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)

Solution (Python):
def main():
    NT = list(map(int, input().split()))
    N, T = NT[0], NT[1]
    arr = []
    cost = []
    for i in range(N):
        ct = list(map(int, input().split()))
        arr.append(ct)
    for j in range(N):
        if arr[j][1] <= T:
            cost.append(arr[j][0])
    if len(cost) != 0:
        print(min(cost))
    else:
        print("TLE")
main()

Solution (Python):
ans = 10000
N, T = map(int, input().split())
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)

Solution (Python):
N,T = map(int, input().split())
minNum = 1001
for i in range(N):
    c,t = map(int, input().split())
    if t <= T and minNum > c:
        minNum = c
if minNum == 1001:
    print("TLE")
else:
    print(minNum)

Solution (Python):
N, T = map(int,input().split())
r = [list(map(int,input().split())) for i in range(N)]
ans = 10**10
for c,t in r:
    if t <= T:
        ans = min(ans, c)
if 10**10 == ans:
    print("TLE")
else:
    print(ans)

Solution (Python):
a = list(map(int, input().split()))
cots = float('inf')

for i in range(a[0]):
    b = list(map(int, input().split()))
    if b[1] <= a[1]:
        if b[0] <= cots:
            cots = b[0]

if cots == float('inf'):
    print('TLE')
else:
    print(cots)

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

Solution (Python):
n, t = map(int, input().split())

ans = 2000

for i in range(n):
    x, y = map(int, input().split())
    if y  <= t:
        if x < ans:
            ans = x

if ans != 2000:
    print(ans)
else:
    print("TLE")

Solution (Python):
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)

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

Solution (Python):
N,T = map(int,input().split())
C = [list(map(int,input().split())) for _ in range(N)]

c_min = 10000
for i,j in C:
    if j > T:
        continue
    
    c_min = min(c_min,i)

if c_min == 10000:
    print('TLE')
else:
    print(c_min)

Solution (Python):
N, T = map(int, input().split())

c = []

for i in range(N):
    _c, _t = map(int, input().split())
    if _t <= T:
        c.append(_c)

c.sort()
if len(c) > 0:
    print(c[0])
else:
    print("TLE")

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

Solution (Python):

"""
B - Time Limit Exceeded
https://atcoder.jp/contests/abc112/tasks/abc112_b

"""
import sys


def solve(N, T, path):
    ans = []
    for c, t in path:
        if t <= T:
            ans.append(c)
    return sorted(ans)[0] if ans else 'TLE'


def main(args):
    N, T = map(int, input().split())
    path = [[int(i) for i in input().split()] for _ in range(N)]
    ans = solve(N, T, path)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
import sys
import bisect
input = sys.stdin.readline

N, T = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(N)]

c = 10 ** 18
for v in L:
    if c > v[0] and v[1] <= T:
        c = v[0]
        
if c == 10 ** 18:
    print("TLE")
else:
    print(c)

Solution (Python):
def main():
    N, T = map(int, input().split())
    min_c = 1001
    min_t = 1001

    for _ in range(N):
        c, t = map(int, input().split())
        if c < min_c and t <= T:
            min_c = c
            min_t = t
    if min_c > 1000:
        print("TLE")
    else:
        print(min_c)

if __name__=='__main__':
    main()

Solution (Python):
a, b = map(int,input().split())
list = []
for i in range(a):
  c, d = map(int, input().split())
  if d <= b:
    list.append(c)
if list:
  print(min(list))
elif list == []:
  print("TLE")

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

Solution (Python):
N,T=map(int,input().split())
c=[]
t=[]
result=[]
for i in range(N):
    S=input()
    c.append(int(S[0:S.find(' ')]))
    t.append(int(S[S.find(' ')+1:]))
for i in range(N):
    if t[i]<=T:
        result.append(c[i])
print(min(result) if len(result) != 0 else 'TLE')

Solution (Python):
n,t=map(int, input().split())
keiro_list=[]
for i in range(n):
  keiro=list(map(int, input().split()))
  if keiro[1] <= t:
    keiro_list.append(keiro)

if len(keiro_list)==0:
  print('TLE')
else:
  keiro_list = sorted(keiro_list)
  print(keiro_list[0][0])

Solution (Python):
N, T = map(int, input().split())
C = [list(map(int, input().split())) for _ in range(N)]
l = list(sorted(C, key=lambda x: x[1]))
n = 0
for i in l:
  if i[1] > T:
    break
  else:
    n += 1
if n == 0:
  print('TLE')
else:
  print(min(l[0:n])[0])

Solution (Python):
import sys

if __name__ == '__main__':
    N, T = map(int, input().split())
    ct = [list(map(int, input().split())) for i in range(N)]

    answer = sys.maxsize
    for i in range(N):
        ct_i = ct[i]
        c_i = ct_i[0]
        t_i = ct_i[1]
        if t_i <= T:
            if c_i < answer:
                answer = c_i

    if answer == sys.maxsize:
        answer = 'TLE'
    else:
        answer = str(answer)

    print(answer)

Solution (Python):
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 C == []:
    print("TLE")
else:
    print(min(C))

Solution (Python):
n,T=map(int,input().split())
c=[]
t=[]
for i in range(n):
    c_,t_ = map(int,input().split())
    c.append(c_)
    t.append(t_)
mi=max(c)
f=False
for i in range(n):
    if t[i]<=T:
        if mi>=c[i]:
            f=True
            mi=c[i]
print(mi if f else 'TLE')

Solution (Python):

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

Solution (Python):
n,t=map(int,input().split())
clis=[]
tlis=[]
for i in range(n):
  a,b=map(int,input().split())
  clis.append(a)
  tlis.append(b)
lis2=[]
for i in range(n):
  if tlis[i] > t:
    pass
  else:
    lis2.append(clis[i])
if len(lis2)==0:
  print("TLE")
else:
  print(min(lis2))

Solution (Python):
n, t_limit= map(int, input().split())
cost = []
time = []
for i in range(n):
    c, t = map(int, input().split())
    if t <= t_limit:
        cost.append(c)
        time.append(t)

if len(time)==0:
    print("TLE")
else:
    print(min(cost))

Solution (Python):
N,T=(int(x) for x in input().split())
cost_list=[]
for i in range(0,N):
    c,t=(int(x) for x in input().split())
    if(t<=T):
        cost_list.append(c)
if(len(cost_list)>0):
    print(min(cost_list))
else:
    print("TLE")

Solution (Python):
N, T = map(int,input().split())
C = [list(map(int,input().split())) for i in range(N)]
cost = 1001
for c, t in C:
    if t <= T:
        cost = min(cost, c)
if cost == 1001:
    print('TLE')
else:
    print(cost)

Solution (Python):
n, t = map(int, input().split())
min_c = 2000
for _ in range(n):
    ci, ti = map(int, input().split())
    if ti <= t:
        min_c = min(min_c, ci)

if min_c == 2000:
    print('TLE')
else:
    print(min_c)

Solution (Python):
N,T=map(int,input().split())
C=[]
time=[]
for i in range(N):
    c,t=map(int, input().split())
    C.append(c)
    time.append(t)
cost=[]
for k in range(N):
    if time[k]<=T:
        cost.append(C[k])

if cost==[]:
    print('TLE')
else:
    print(min(cost))

Solution (Python):
N, T = map(int, input().split())

min_cost = 1001
for _ in range(N):
    c, t = map(int, input().split())
    if T < t:
        continue

    min_cost = min(min_cost, c)

if min_cost <= 1000:
    print(min_cost)
else:
    print('TLE')

Solution (Python):
N, T = map(int, input().split())

c = []
t = []

for i in range(N) : 
    a, b = map(int, input().split())
    if b <= T : 
        c.append(a)
        t.append(b)

if len(c) == 0 :
    print("TLE")
else : 
    print(min(c))

Solution (Python):
a, b = map(int, input().split())
A = [list(input().split()) for i in range(a)]
cost = 1000
e='TLE'
for i in A:
    c = int(i[1])
    if b >= c:
        d = int(i[0])
        cost = min(cost, d)
        e=0
if e==0:
  print(cost)
else:
  print(e)

Solution (Python):
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':
            ans = c
        ans = min(ans, c)
print(ans)

Solution (Python):
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)

Solution (Python):
N,T=map(int,input().split())
c=[list(map(int,input().split())) for i in range(N)]

cost = 1001
for i in range(N):
  if c[i][0] < cost and c[i][1]<=T:
    cost=c[i][0]
if cost==1001:
  print("TLE")
else:
  print(cost)

Solution (Python):
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for i in range(n)]
m=ct[0][0]
idx=0
for i in range(n):
  if ct[i][1]<=t:
    m=[ct[i][0],m][ct[i][0]>m]
    idx=i
print(m if ct[idx][1]<=t else "TLE")

Solution (Python):
N,T = map(int,input().split())
c = []
t = []
hoge = []

for i in range(N):
  a,b = map(int,input().split())
  c.append(a)
  t.append(b)

for i in range(N):
  if t[i] <= T:
    hoge.append(c[i])
if hoge != []:
  print(min(hoge))
else:
  print("TLE")

Solution (Python):
N, T = map(int, input().split())

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

Solution (Python):
N, T = [int(i) for i in input().split()]
ct = []
for j in range(N):
  ct.append([int(i) for i in input().split()])
ct.sort()
flag = 0
for i in range(N):
  if ct[i][1] <= T:
    print(ct[i][0])
    flag = 1
    break
if flag == 0:
  print("TLE")

Solution (Python):
n,t = map(int, input().split())
ct = [[0,0] for j in range(n)]
lst = []
for j in range(n):
    ct[j][0], ct[j][1] = map(int, input().split())
for j in range(n):
    if ct[j][1] <= t:
        lst.append(ct[j][0])
if lst == []:
    print('TLE')
else:
    print(min(lst))

Solution (Python):
N, T = map(int, input().split())
min_c = 1001
for i in range(N):
    c, t = map(int, input().split())
    if t > T:
        continue
    min_c = min(c, min_c)
if min_c == 1001:
    print('TLE')
else:
    print(min_c)

Solution (Python):
N, T = map(int, input().split())

record = []
for n in range(N):
    c, t = map(int, input().split())
    if t <= T:
        record.append([c, t])

if len(record) > 0:
    record.sort(key = lambda x :x[0], reverse = False)
    print(record[0][0])
else:
    print("TLE")

Solution (Python):
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:
    print(min(C))

Solution (Python):
N,T = map(int,input().split())
cost = 1001
for i in range(N):
    c,t = map(int,input().split())
    if t <= T and c < cost:
        cost = c

if cost == 1001:
    print('TLE')
else:
    print(cost)

Solution (Python):
import sys
input = sys.stdin.readline

N, T = map(int, input().split())
c = [0] * N
t = [0] * N

for i in range(N):
    c[i], t[i] = map(int, input().split())

C = []
for j in range(N):
    if t[j] <= T:
        C.append(c[j])

if len(C) == 0:
    print('TLE')
else:
    print(min(C))

Solution (Python):
import sys
import numpy as np
input = sys.stdin.readline

N, T = map(int, input().split())

c = [0] * N
t = [0] * N

for i in range(N):
    c[i], t[i] = map(int, input().split())

C = []
for j in range(N):
    if t[j] <= T:
        C.append(c[j])

if len(C) == 0:
    print('TLE')
else:
    print(min(C))

Solution (Python):
n, t = map(int, input().split())
w_dic = {}
for i in range(n):
  w, w_t = map(int, input().split())
  if w_t <= t:
    w_dic[i+1] = w
if w_dic:
  print(min(w_dic.values()))
else:
  print("TLE")

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

Solution (Python):
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])

Solution (Python):
N,T=[int(a) for a in input().split(" ")]
CT = [[int(a) for a in input().split(" ")] for i in range(N)]
costs = [c for c, t in CT if t<=T]
print(min(costs) if len(costs)>0 else "TLE")

Solution (Python):
N, T = map(int, input().split())

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

Solution (Python):
N, T = map(int, input().split())
ans_c, ans = 1000, 0
for _ in range(N):
    c, t = map(int, input().split())
    
    if t <= T:
        ans += 1
        if ans_c >= c:
            ans_c = c
if ans != 0:
    ans = ans_c
else:
    ans = 'TLE'
print(ans)

Solution (Python):


from bisect import bisect_left as binl
from copy import copy, deepcopy

def intin():
    input_tuple = input().split()
    if len(input_tuple) <= 1:
        return int(input_tuple[0])
    return tuple(map(int, input_tuple))


def intina():
    return [int(i) for i in input().split()]


def intinl(count):
    return [intin() for _ in range(count)]


def modadd(x, y):
    global mod
    return (x + y) % mod


def modmlt(x, y):
    global mod
    return (x * sy) % mod


def lcm(x, y):
    while y != 0:
        z = x % y
        x = y
        y = z
    return x


def make_linklist(xylist):
    linklist = {}
    for a, b in xylist:
        linklist.setdefault(a, [])
        linklist.setdefault(b, [])
        linklist[a].append(b)
        linklist[b].append(a)
    return linklist


def calc_longest_distance(linklist, v=1):
    distance_list = {}
    distance_count = 0
    distance = 0
    vlist_previous = []
    vlist = [v]
    nodecount = len(linklist)

    while distance_count < nodecount:
        vlist_next = []
        for v in vlist:
            distance_list[v] = distance
            distance_count += 1
            vlist_next.extend(linklist[v])
        distance += 1
        vlist_to_del = vlist_previous
        vlist_previous = vlist
        vlist = list(set(vlist_next) - set(vlist_to_del))

    max_distance = -1
    max_v = None
    for v, distance in distance_list.items():
        if distance > max_distance:
            max_distance = distance
            max_v = v

    return (max_distance, max_v)


def calc_tree_diameter(linklist, v=1):
    _, u = calc_longest_distance(linklist, v)
    distance, _ = calc_longest_distance(linklist, u)
    return distance





def main():
    N, T = intin()
    ctlist = intinl(N)

    min_cost = 999999

    for c, t in ctlist:
        if t <= T:
            if c < min_cost:
                min_cost = c

    if min_cost > 9999:
        print('TLE')
    else:
        print(min_cost)


if __name__ == '__main__':
    main()

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

Solution (Python):
N, T = map(int, input().split())

ans = float('inf')
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)

if ans == float('inf'):
    ans = 'TLE'
print(ans)

Solution (Python):
N, T = map(int, input().split())

ans = 1001
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(c, ans)

if ans == 1001:
    print('TLE')
else:
    print(ans)

Solution (Python):
N, T = map(int, input().split())
ans = 1001

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

if ans == 1001:
    print('TLE')
else:
    print(ans)

Solution (Python):
n,t = map(int,input().split())
ans = 1000000
for i in range(n):
	ci,ti = map(int,input().split())
	if ti <= t:
		ans = min(ans,ci)

print(ans if ans != 1000000 else 'TLE')

Solution (Python):
n, t = map(int, input().split())
cost = []
time = []
for i in range(n):
    c, ti = map(int, input().split())
    if ti <= t:
        cost.append(c)
        time.append(ti)
cost = sorted(cost)
if time != []:
    print(cost[0])
else:
    print('TLE')

Solution (Python):
N,T = map(int,input().split())
c = [] 
t = []
min = 1001
for i in range(N):
    c,t = map(int,input().split())
    if t <= T :
        if c < min :
            min = c

if min != 1001:
    print(min)
else:
    print('TLE')

Solution (Python):

from sys import stdin

N,T = map(int,stdin.readline().rstrip().split())

c_list = []
for i in range(N):
    C = stdin.readline().rstrip().split()
    if int(C[1]) <= T:
        c_list.append(int(C[0]))

def main():
    print( "TLE" if len(c_list) == 0 else min(c_list) )

if __name__ == '__main__' :
    main()

Solution (Python):
n, T = map(int, input().split())
ans = 1001

for i in range(n):
    c, t = map(int, input().split())
    if t <= T:
        if c < ans:
            ans = c

if ans != 1001:
    print(ans)
else:
    print("TLE")

Solution (Python):
N, T  = map(int, (input().split()))
ans = 1001
for i in range(N):
    c, t = map(int, (input().split()))
    if t <= T:
        ans = min(ans, c)

print(ans if ans <= 1000 else "TLE")

Solution (Python):
N, T = map(int, input().split())
c = [None] * N
t = [None] * N

for i in range(N):
  c[i], t[i] = map(int, input().split())

a = [x for x, y in zip(c, t) if y <= T]
if len(a) > 0:
  print(min(a))
else:
  print('TLE')

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

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

Solution (Python):
N,T=list(map(int,input().split()))
Max=10000
Key='TLE'

for i in range(N):
    c,t=list(map(int,input().split()))
    if t<=T and c<Max:
        Max=c
        Key=Max
print(Key)

Solution (Python):
N, T = map(int, input().split())
ans = 1001
for i in range(N):
    tmp = list(map(int, input().split()))
    if tmp[1] <= T:
        ans = min(ans, tmp[0])

print(ans if ans != 1001 else "TLE")

Solution (Python):
nt=list(map(int,input().split()))
n=nt[0]
t=nt[1]
ct=[[] for i in range(n)]
for i in range(n):
    ct[i]=list(map(int,input().split()))
cmin=10000
for i in range(n):
    if ct[i][1]<=t:
        cmin=min(cmin,ct[i][0])
if cmin==10000:
    print("TLE")
else:
    print(cmin)

Solution (Python):
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')

Solution (Python):
N,T=map(int,input().split())
c=[0]*N
t=[0]*N
for i in range(N):
  c[i],t[i]=map(int,input().split())
ans=10000
for i in range(N):
  if t[i]<=T:
    ans=min(ans,c[i])
if ans==10000:
  print('TLE')
else:
  print(ans)

Solution (Python):
n,t = map(int, input().split())
m = 1001
for _ in range(n):
    c,time = map(int, input().split())
    if t >= time and m > c:
        m = c
print(m if m != 1001 else "TLE")

Solution (Python):
from sys import stdin
import numpy as np
from copy import deepcopy

N, T = list(map(int,input().split()))
lst = [list(map(int,input().split())) for i in range(N)]



arr = np.array(lst)
possible_root = arr[arr[:,1]<=T]
if possible_root.size == 0:
  ans = "TLE"
else:
  ans = min(possible_root[:,0])

print(ans)

Solution (Python):
N,Time=map(int,input().split())
C=[]
T=[]
for _ in range(N):
    c,t=map(int,input().split())
    C.append(c)
    T.append(t)

tmp=[]
for i in range(N):
    if T[i]<=Time:
        tmp.append(C[i])
if tmp==[]:
    print('TLE')
else:
    print(min(tmp))

Solution (Python):
N, T = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(N)]
ret = 10 ** 9
for c, t in ct:
	if t <= T:
		ret = min(ret, c)
if ret < 10 ** 9:
	print(ret)
else:
	print("TLE")

Solution (Python):
n,t = map(int, input().split())
best = 1001

for i in range(n):
    cost,time = map(int,input().split())
    if time <= t:
        best = min(best, cost)

if best == 1001:
    print('TLE')
else:
    print(best)

Solution (Python):
A, B = map(int, input().split())
costlist=[]
exist=0
for i in range(A):
  c, t = map(int, input().split())
  if t<=B:
    costlist.append(c)
    exist=exist+1
if exist==0:
  kotae="TLE"
else:
  kotae=min(costlist)
print(kotae)

Solution (Python):
inpl = lambda: list(map(int,input().split()))
N, T = inpl()
costs = []
for i in range(N):
    c, t = inpl()
    if t <= T:
        costs.append(c)
if len(costs) > 0:
    print(min(costs))
else:
    print('TLE')

Solution (Python):
a,b=map(int,input().split())
e=2000
for i in range(a):
    c,d=map(int, input().split())
    if d<=b:
        e=min(e,c)
print(e if e!=2000 else "TLE")

Solution (Python):

import sys
from math import *
from itertools import *
from collections import *
from functools import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(N: int, T: int, c: "List[int]", t: "List[int]"):
    ret = float('inf')
    for cc, tt in zip(c, t):
        if tt <= T:
            ret = min(ret, cc)
    return 'TLE' if ret == float('inf') else ret



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    T = int(next(tokens))  
    c = [int()] * (N)  
    t = [int()] * (N)  
    for i in range(N):
        c[i] = int(next(tokens))
        t[i] = int(next(tokens))
    result = solve(N, T, c, t)
    print(result)

if __name__ == '__main__':
    main()

Solution (Python):
N,T=map(int,input().split())
ans_list=[]
for i in range(N):
    c,t=map(int,input().split())
    if t>T:
        ans_list.append(1001)
    else:
        ans_list.append(c)
if min(ans_list)==1001:
    print("TLE")
else:
    print(min(ans_list))

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

Solution (Python):
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))

Solution (Python):
N,T = map(int,input().split())
c = [0] * N
t = [0] * 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:
        if c[i] < ans:
            ans = c[i]
            
if ans == 1001:
    print('TLE')
else:
    print(ans)

Solution (Python):
N,T = map(int,input().split())
CT = [[int(i) for i in input().split()] for j in range(N)]
TL = 0 
CT.sort(key = lambda x:x[1])

while CT[TL][1] <= T:
    TL += 1
    if TL == N:
        break
if TL == 0:
    print("TLE")
    exit()

CT_sort =sorted(CT[:TL])
print(CT_sort[0][0])

Solution (Python):
N,T = map(int,input().split())
a=[]
for _ in range(N):
  a.append(list(map(int, input().split())))

a.sort()
for i in a:
  if i[1] <= T:
    print(i[0])
    exit()

print('TLE')

Solution (Python):
[N,T] = list(map(int,input().split()))
ans = 1001
for i in range(N):
  [c,t] = list(map(int,input().split()))
  if t <= T:
    ans = min(ans,c)
if ans == 1001:
  print("TLE")
else:
  print(ans)

Solution (Python):
n, m = list(map(int,input().split()))
nums = [list(map(int,input().split())) for i in range(n)]
ans = 1e20
for c, t in nums:
  if t <= m:
    ans = min(c, ans)
if ans < 10000:
  print(ans)
else:
  print('TLE')

Solution (Python):
N, T = map(int, input().split())
ans = 1001
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)
print(ans if ans <= 1000 else "TLE")

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