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



Sample input:
3 70
7 60
1 80
4 50


Sample output:
4

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
i = 1001

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

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

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
c = 10000
for i in range(n):
    ce, te = map(int, input().split())
    if te <= t:
        if ce < c:
            c = ce
if c == 10000:
    print('TLE')
else:
    print(c)

Submission status: Accepted

Solution code:
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
print("TLE" if m == 1001 else m)

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(n)]
ans = 2000
flag = False
for i in ct:
    if i[1] <= t and ans >= i[0]:
        ans = i[0]
        flag = True

if flag:
    print(ans)
else:
    print("TLE")

Submission status: Accepted

Solution code:
N,T = list(map(int,input().split()))
x = []
y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)

ans = 10000000000

for j in range(N):
    if y[j] <= T:
        if ans > x[j]:
            ans = x[j]

if ans == 10000000000:
    print("TLE")

else:
    print(ans)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
cost_list=[]
for i in range(n):
  cost,time=map(int,input().split())
  if time<=t:
    cost_list+=[cost]
if cost_list!=[]:
  print(min(cost_list))
else:
  print("TLE")

Submission status: Accepted

Solution code:
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:
    print(min(ans))
else:
    print("TLE")

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
c_ok=[]

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

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

Submission status: Accepted

Solution code:
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 >1000:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

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

minc = 100000000
for ct in CT:
    if ct[1] > T: continue
    newc = ct[0]
    if newc < minc: minc = newc

if minc == 100000000: print('TLE')
else: print(minc)

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
keiro = [[0, 0] for i in range(N)]

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

keiro_sorted = sorted(keiro, key=lambda x: x[1])

if keiro_sorted[0][1] > T:
    print("TLE")
    exit()
ans = 1000
for i in range(N):
    if keiro_sorted[i][1] > T:
        break
    ans = min(keiro_sorted[i][0], ans)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
c = [i[0] for i in a]
tc = [i[1] for i in a]
ans = []
for i in tc:
  if i <= t:
    ans.append(tc.index(i))
if ans == []:
  print('TLE')
  exit()
b = []
for i in ans:
  b.append(c[i])
print(min(b))

Submission status: Accepted

Solution code:
n,t = map(int, input().split())
ct = [list(map(int, input().split())) for i in range(n)]
ct = sorted([[i,j] for i,j in ct if j <= t])
if ct:
  print(ct[0][0])
else:
  print("TLE")

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
minidx = 1001
for i in range(n):
    n_, t_ = map(int, input().split())
    if t_<=t:
        minidx = min(minidx, n_)
print("TLE" if minidx>1000 else minidx)

Submission status: Accepted

Solution code:
N = list(map(int, input().split()))

ac = []
for i in range(N[0]):
    tmp = list(map(int, input().split()))
    if tmp[1] <= N[1]:
        ac.append(tmp[0])

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

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
m=10000
for i in range(N):
    c,t=map(int,input().split())
    if t<=T:m=min(m,c)
print("TLE" if m>1000 else m)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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)
print(min_cost if min_cost < 1001 else "TLE")

Submission status: Accepted

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

ans = 1001
for _ in range(N):
    c, t = [int(x) for x in input().split()]
    if t <= T and c < ans:
        ans = c
if ans == 1001:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n1, n2 = [int(i) for i in input().split()]

t1 = []
r1 = 1001

for i1 in range(n1):
    t1 = [int(j) for j in input().split()]
    if t1[1] <= n2:
        if t1[0] < r1:
            r1 = t1[0]

if r1 == 1001:
    r1 = "TLE"
print(r1)

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

routes = []
cost = 1000

for i in range(n):
    array = list(map(int, input().split()))
    if array[1] <= t:
        routes.append(array)
        cost = min(array[0], cost)

if not routes:
    print('TLE')
    exit()

print(cost)

Submission status: Accepted

Solution code:
N,T = map(int, input().split())
C = [list(map(int,input().split())) for i in range(N)]
X = sorted(C, key = lambda x:x[1])

i = 0
ans = 1001
while X[i][1] <= T:
  ans = min(ans, X[i][0])
  if i + 1 == N:
    break
  i += 1

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

for i in range(N):
    if c[i][1] <= T:
        ans.append(c[i])

ans.sort(key=lambda x: x[0])

try:
    print(ans[0][0])
except:
    print('TLE')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,T = map(int,input().split())
ct = [list(map(int,input().split())) for _ in range(n)]
cost = 9999
for i in range(n):
    c,t = ct[i][0],ct[i][1]
    if t<=T:
        cost = min(cost,c)
print(cost if cost != 9999 else 'TLE')

Submission status: Accepted

Solution code:
n,T = map(int,input().split())
a = []
b = []

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n ,t = list(map(int, input().split()))
min_c = 10000
for i in range(n):
  c, t_i = list(map(int, input().split()))
  if t_i > t:
    continue
  else:
    min_c = min(min_c, c)
if min_c == 10000:
  print("TLE")
else:
  print(min_c)

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
cl=[0 for i in range(n)]
tl=[0 for i in range(n)]

for i in range(n):
    cl[i],tl[i]=map(int,input().split())
    
min_cost = 100000
for i in range(n):
    if cl[i] < min_cost and tl[i] <= t:
        min_cost = cl[i]
if min_cost < 100000:
    print(min_cost)
else:
    print("TLE")

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
mc = 10 ** 9
for i in range(n):
    c1, t1 = map(int, input().split())
    if t1 <= t:
        mc = min(mc, c1)
if mc == 10 ** 9:
    print("TLE")
else:
    print(mc)

Submission status: Accepted

Solution code:
n, t = list(map(int, input().split()))
routes = [list(map(int, input().split())) for _ in range(n)]

min_c = 1001
for (c, time) in routes:
    if time <= t:
        min_c = min(min_c, c)
if min_c == 1001:
    min_c = "TLE"
print(min_c)

Submission status: Accepted

Solution code:
N, T = (int(i) for i in input().split())
c_min = 114514

for i in range(N):
	c, t = (int(i) for i in input().split())
	if t <= T:
		c_min = min(c_min, c)
if c_min == 114514:
	print("TLE")
else:
	print(c_min)

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
l = []
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        l.append(c)

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

Submission status: Accepted

Solution code:
N,T = map(int,input().split())
minC = 1001

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

if minC == 1001:
    print("TLE")
else:
    print(minC)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,T =map(int,input().split())
k = [list(map(int,input().split())) for i in range(N)]
for i in range(len(k)):
    k[i].append(i)
k.sort(key=lambda k:k[1])
tt = [k[i] for i in range(N) if k[i][1]<=T]
if tt == []:
    print("TLE")
else:
    tt.sort(key=lambda k:k[0])
    print(tt[0][0])

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
k = [list(map(int, input().split())) for _ in range(n)]
a = [item[0] for item in k if item[1] <= t]
if a:
  print(min(a))
else:
  print("TLE")

Submission status: Accepted

Solution code:
# ABC112B - Time Limit Exceeded
import sys
input = sys.stdin.readline

def main():
    n, t = tuple(map(int, input().rstrip().split()))
    data = tuple(tuple(map(int, input().rstrip().split())) for _ in range(n))
    match = {i[0] for i in data if i[1] <= t}
    if match == set():
        print("TLE")
    else:
        print(min(match))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
ans = []
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans.append(c)
    else:
        ans.append(999999)
ans = sorted(ans)
if ans[0] == 999999:
    print("TLE")
else:
    print(ans[0])

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
ct= [list(map(int,input().split())) for _ in range(n)]

cost= 1111
for cti in ct:
  if cti[1]<=t:
    if cti[0] < cost:
      cost=cti[0]

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

Submission status: Accepted

Solution code:
Tmp = []
Tmp = input().rstrip().split(' ')
 
nN = int(Tmp[0])
nT = int(Tmp[1])
 
nCost = 1001
nAns = 0
 
for i in range(nN):
  Tmp = input().rstrip().split(' ')
 
  nTmpCost = int(Tmp[0])
  nTmpT = int(Tmp[1])
  
  if nTmpT <= nT and nTmpCost < nCost:
    nCost = nTmpCost
    nAns = i+1

if nAns == 0:
  print('TLE')
else:
  print(nCost)

Submission status: Accepted

Solution code:
n, T = map(int, input().split())
tm = 1001
for i in range(n):
    c, t = map(int, input().split())
    if t <= T:
        tm = min(tm, c) 
if tm == 1001:
    print("TLE")
else:
    print(tm)

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
minc = 10000
for i in range(n):
    ci,ti = map(int,input().split())
    if ti<=t:
        minc = min(minc,ci)
if minc == 10000:
    print("TLE")
else:
    print(minc)

Submission status: Accepted

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

ct_list = [tuple(map(int, input().split())) for i in range(N)]

# print(ct_list)

min_cost = 10000
flag = False

for ct in ct_list:
  c = ct[0]
  t = ct[1]
  # print(c, t)
  
  if t <= T:
    if c <= min_cost:
      min_cost = c
      flag = True
    
      
if flag:     
  print(min_cost)
else:
  print("TLE")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
_list = [input() for i in range(n)]
costs, times = [], []
for elem in _list:
    # print(elem)  # debug
    cost, time = map(int, elem.split())
    costs.append(cost)
    times.append(time)

min_cost = 1001  # 最小コストを入れる変数。初期値は制約上のMAX + 1 にしておく
for cost, time in zip(costs, times):
    if time <= t and cost < min_cost:
        min_cost = cost  # 時間内 and costがこれまでの最小コストより小さければ更新

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

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
an=1001

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

if an==1001:
    print("TLE")
else:
    print(an)

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
n, t = list(map(int, input().split()))
data = []
for i in range(n):
    data.append(list(map(int, input().split())))
minCost = 1001
for i in range(n):
    if data[i][1] <= t and minCost > data[i][0]:
        minCost = data[i][0]

if minCost == 1001:
    print("TLE")
else:
    print(minCost)

Submission status: Accepted

Solution code:
N,T = map(int,input().split())
min_cost = 10**3 + 1
for i in range(N):
    c, t = map(int,input().split())
    if t <= T and c < min_cost:
        min_cost = c
if min_cost != 10**3 + 1:
    print(min_cost)
else:
    print("TLE")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
l=[]
cc=99999
for i in range(n):
   c,tt = map(int,input().split())
   if tt<=t:
       if c<cc:
           cc=c
if cc==99999:
    print("TLE")
else:
    print(cc)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,T = map(int, input().split())
tli = []
cli = []
for i in range(n):
    c,t = map(int, input().split())
    if t <= T:
        tli.append(t)
        cli.append(c)
print("TLE" if tli == [] else min(cli))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(N, T, inputs):
    routes = list(map(string_to_int, inputs))
    min_cost = -1
    for r in routes:
        if r[1] <= T and (min_cost == -1 or r[0] < min_cost):
            min_cost = r[0]
    if min_cost == -1:
        return "TLE"
    return str(min_cost)


def string_to_int(string):
    return list(map(int, string.split()))


if __name__ == "__main__":
    [N, T] = string_to_int(input())
    ret = solve(N, T, inputs(N))
    print(ret)

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
INF = 10000
ans = INF
for _ in range(n):
    ci, ti = map(int, input().split())
    if ti <= t:
        ans = min(ans, ci)

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
from operator import itemgetter

def main():
	n, T = map(int, input().strip().split())
	s = [0] * n
	ans = 10**9
	for i in range(n):
		c, t = map(int, input().strip().split())
		if t <= T and c < ans:
			ans = c
	if ans == 10**9:
		print('TLE')
	else:
		print(ans)

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
NT = list(map(int, input().split(' ')))
N = NT[0]
T = NT[1]
res = []
for _ in range(N):
    nt = list(map(int, input().split(' ')))
    n = nt[0]
    t = nt[1]
    if t <= T:
        res.append(n)
if not res:
    res = 'TLE'
else:
    res = min(res)
print(res)

Submission status: Accepted

Solution code:
n, T = map(int, input().split())
cost = float("inf")
for i in range(n):
    c, t = map(int, input().split())
    if t <= T:
        cost = min(cost, c)
if cost == float("inf"):
    print("TLE")
else:
    print(cost)

Submission status: Accepted

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

print(min(C) if C else 'TLE')

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
a = []
cnt = 0
for i in range(n):
  cost,time = map(int,input().split())
  if time<= t:
    cnt +=1
    a.append(cost)
  else:
    pass
if cnt > 0:
  print(min(a))
else:
  print("TLE")

Submission status: Accepted

Solution code:
import copy

def main():

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

    ans=min((i if j <= T else TLE for i,j in targetList))
    print(ans) if ans != TLE else print("TLE")

if __name__== "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
import numpy as np

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

ct = np.zeros([2,N])

for i in range(N):
    ct[0,i], ct[1,i] = list(map(int, input().split()))

ct = ct[:,np.argsort(ct[0,:])]

for i in range(N):
    if ct[1,i] <= T:
        print(int(ct[0,i]))
        sys.exit()

print('TLE')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l = [int(i) for i in input().split(" ")]
n = l[0]
t = l[1]
c_list = []
flag = False
for i in range(n):
    l = [int(i) for i in input().split(" ")]
    if l[1] <= t:
        c_list.append(l[0])
        flag = True
if flag:
    print(min(c_list))
else:
    print("TLE")

Submission status: Accepted

Solution code:
n, t = list(map(int,input().split()))
list1 = []
list2 = []
for i in range(0,n):
  list1.append(list(map(int, input().split())))

for i in list1:
  if int(i[1]) <= t:
    list2.append(i)

if(list2):
  list2.sort()
  print(list2[0][0])
else:
  print("TLE")

Submission status: Accepted

Solution code:

n,t=map(int,input().split())

res=None

for _ in range(n):
    c,u=map(int,input().split())
    if u <= t:
        res = min(res,c) if res else c

print(res if res else "TLE")

Submission status: Accepted

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

ans = 'TLE'

for i in lst:
  if (i[1] <= T):
    if (ans == 'TLE'):
      ans = i[0]
    else:
      if (i[0] < ans):
        ans = i[0]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
c = [0] * N
t = [0] * N
check = [0] * N 
ans_l = []
for i in range(N):
    c[i], t[i] = map(int, input().split())
    if t[i] <= T:
        check[i] = 1
    if check[i] == 1:
        ans_l.append(c[i])

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

Submission status: Accepted

Solution code:
def main():
    N, T = map(int, input().split())
    ans = float("Inf")
    for _ in range(N):
        c, t = map(int, input().split())
        if t <= T:
            ans = min(ans, c)
    if ans == float("Inf"):
        print("TLE")
    else:
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

way=[]
for i in range(n):
    way.append(list(map(int,input().split())))
#print(way)

ans=[]
for i in range(n):
    if way[i][1]<=t:
        ans.append(way[i][0])

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

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
l = []
for _ in range(n):
    c, ti = map(int, input().split())
    l.append((c, ti))
least_cost = None
for j in l:
    if j[1] <= t and (least_cost == None or j[0] < least_cost):
        least_cost = j[0]
if least_cost == None:
    print('TLE')
else:
    print(least_cost)

Submission status: Accepted

Solution code:
N,T = map(int, input().split())
List = []
for i in range(N):
    List.append([int(a) for a in input().split()])

ok_list = []
for j in range(N):
    if List[j][1] <= T:
        ok_list.append(List[j][0])
if ok_list == []:
    print("TLE")
else:
    ok_list.sort()
    print(ok_list[0])

Submission status: Accepted

Solution code:
n,T = map(int, input().split())
ans = float('inf')
flag = True
for i in range(n):
    c,t = map(int, input().split())
    if t <= T and c <= ans:
        ans = c
        flag = False
if flag:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
info=[0]
for i in range(n):
    info.append(list(map(int,input().split())))
ans="TLE"
cost=10000
for i in range(1,n+1):
    if info[i][1]<=t and info[i][0]<cost:
        cost=info[i][0]
        ans=str(cost)
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

N, T = map(int, input().split())
a1 = [list(map(int, input().split())) for i in range(N)]
a2 = list(filter(lambda i: i[1] <= T, a1))
if a2 == []:
    print("TLE")
else:
    print(a2[(a2.index(min(a2)))][0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

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

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
routes = [list(map(int,input().split())) for _ in range(n)]
routes2 = list(filter(lambda x: x[1]<=t,routes))
routes3 = sorted(routes2,key=lambda x: x[0])
if len(routes3) == 0:print("TLE")
else:print(routes3[0][0])

Submission status: Accepted

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

x=[list(map(int,input().split())) for _ in range(n)]

cst=[]

for i in range(n):
	if x[i][1]<=t:
		cst.append(x[i][0])

if len(cst)>0:
	print(min(cst))
else:
	print('TLE')

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n = II()
    if n == 1:
        print("Hello World")
    else:
        print(II()+II())
    return

#B
def B():
    n, t = LI()
    ans = inf
    for i in range(n):
        c, ti = LI()
        if ti <= t:
            ans = min(ans, c)
    if ans == inf:
        print("TLE")
        return
    print(ans)
    return

#C
def C():
    n = II()
    xyh = LIR(n)
    xyh.sort(key = lambda x:x[2], reverse = True)
    x1, y1, h1 = xyh[0]
    del xyh[0]
    for x in range(101):
        for y in range(101):
            h = abs(x - x1) + abs(y - y1) + h1
            flg = True
            for xn, yn, hn in xyh:
                if max(h - abs(x - xn) - abs(y - yn), 0) == hn:
                    continue
                flg = False
                break
            if flg:
                print(x, y, h)
                return 
    return

#D
def D():
    n, m = LI()
    ans = 1
    for i in range(1,int(math.sqrt(m)+1)):
        if m % i == 0:
            a = m // i
            #print(i,a)
            if a * n <= m:
                ans = max(ans, a)
            if i * n <= m:
                ans = max(ans, i)
    print(ans)
    return

#Solve
if __name__ == '__main__':
    B()

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
c_t = [tuple(map(int, input().split())) for _ in range(N)]

c_t = filter(lambda ct: ct[1] <= T, c_t)
c_t = sorted(c_t, key=lambda ct: ct[0])
if len(c_t) > 0:
    c, t = c_t[0]
    print(c)
else:
    print('TLE')

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
c, t = [], []
for i in range(N):
    tmp = list(map(int, input().split()))
    c.append(tmp[0])
    t.append(tmp[1])

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

Submission status: Accepted

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

ans = 1001
tmp = 1001

for i in range(N):
    ansT, tmpT = map(int, input().split())
    if T >= tmpT:
        ans = min(ans, ansT)

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

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(N)]
costs = list(filter(lambda x: x[1] <= T, ct))
if len(costs) == 0:
  print('TLE')
else:
  costs.sort(key=lambda x: x[0])
  print(costs[0][0])

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
l = [list(map(int,input().split())) for i in range(n)]

res = float("inf")
flag = 0
for i in range(n):
    if l[i][1] <= t:
        if l[i][0] < res:
            res = l[i][0]
            flag = 1
if flag == 1:
    print(res)
else:
    print("TLE")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
m = float("INF")
for i in range(n):
    cn, tn = map(int, input().split())
    if tn <= t:
        m = min(m, cn)
if m == float("INF"):
    print("TLE")
else:
    print(m)

Submission status: Accepted

Solution code:
n, t = map(int, input().split(" "))
c = [tuple(map(int, input().split(" "))) for i in range(n)]
c = [x for x in c if x[1] <= t]
if c:
    print(min(c)[0])
else:
    print("TLE")

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
n,T=[int(i) for i in input().split()]
ans=[]
for i in range(n):
  c,t=[int(i) for i in input().split()]
  if t<=T:
    ans.append(c)
print(min(ans) if len(ans)!=0 else "TLE")