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 = (int(i) for i in input().split())
ct_matrix = [list(map(int,input().split())) for _ in range(N)]

c_min = 1001
for k in range(N):
    if ct_matrix[k][0] < c_min:
        if ct_matrix[k][1] > T:
            continue
        else:
            c_min = ct_matrix[k][0]

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

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:
        continue
    if ans > c:
        ans = c

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

Submission status: Accepted

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

for i in range(N):
    ct = list(map(int, input().split()))
    alist.append(ct)

blist = list(filter(lambda x: x[1] <= T, alist))

if blist == []:
    print("TLE")

else:
    blist.sort(reverse=False)
    print(blist[0][0])

Submission status: Accepted

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

X = [[int(a) for a in input().split()] for i in range(N)]

min = 1001

for i in range(N):
    hako = X[i]
    if hako[1] <= T and hako[0] <= min:
        min = hako[0]

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

Submission status: Accepted

Solution code:
import itertools
N, T = map(int, input().split())
CT = list(map(lambda _ :list(map(int, input().split())), range(N)))
if min(CT ,key = (lambda ct:ct[1]))[1] > T:
    print('TLE')
else:
    print(min(filter(lambda ct: ct[1]<=T, CT), key=(lambda ct: ct[0]))[0])

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
fl = list(filter(lambda x: x[1] <= T, [[int(i) for i in input().split()] for _ in range(N)]))
print(min(fl, key=lambda x: x[0])[0] if len(fl) != 0 else "TLE")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/mnt/c/Users/moiki/bash/env/bin/python
N,T = list(map(int, (input()).split()))

clist = []
for i in range(N):
    tc, tt = list(map(int, input().split()))
    if T >= tt:
        clist.append(tc)
clist.sort()
try:
    print(clist[0])
except:
    print("TLE")

Submission status: Accepted

Solution code:
listA = list(map(int,input().split()))
listB = []
listC = []
for i in range(listA[0]):
    listB.append(list(map(int,input().split())))
[listC.append(i) for i in listB if i[1] <= listA[1]]
f = lambda a, b: a if a[0] < b[0] else b
c = [1001, 1001]

for i in listC:
    c = f(i, c)
d = c[0] if c[1] < 1001 else 'TLE'
print(d)

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
mc=float('inf')
tle=True
for i in range(n):
    ci,ti=map(int,input().split())
    if ti<=t and ci<mc:
        mc=ci
        tle=False
if tle:
    print('TLE')
else:
    print(mc)

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
ans = 10000
for i in range(n):
    c_i, t_i = map(int, input().split())
    if t_i <= t and c_i < ans:
        ans = c_i
if ans == 10000:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

Solution code:
N,T = list(map(int,input().split(" ")))
ct = [list(map(int,input().split(" "))) for i in range(N)]
r = []
ct = sorted(ct,key=lambda x:x[1])
for i in ct:
    if T >= i[1]:
        r.append(i)
if r != []:
    r = sorted(r,key=lambda x:x[0])
    print(r[0][0])
else:
    print("TLE")

Submission status: Accepted

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

C,t = [], []

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

C_min = 10000
for i,t_i in enumerate(t):
    if t_i <= T and C_min >= C[i]:
        C_min = C[i]
        
if C_min == 10000:
    print('TLE')
else:
    print(C_min)

Submission status: Accepted

Solution code:
n, tx = input().strip().split(' ')
n, tx = [int(n),int(tx)]

c_ans = 1001
for i in range (n):
    c, t = input().strip().split(' ')
    c, t = [int(c),int(t)]
    if c < c_ans and t <= tx:
        c_ans = c
if c_ans == 1001:
    print('TLE')
else:
    print(c_ans)

Submission status: Accepted

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

Submission status: Accepted

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

answer = 1001
c_list = [] 

for i in range(N):
	c_i, t_i = map(int, input().split())
	if T >= t_i:
		if answer > c_i:
			answer = c_i

if answer >= 1001:
	print('TLE')
else:
	print(answer)

Submission status: Accepted

Solution code:
# coding: utf-8

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

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

    if t <= T and c < ans:
        ans = c

if ans==9999:
    print("TLE")
else:
    print(ans)

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 i==N-1 and cost==float('inf'):
    cost='TLE'
print(cost)

Submission status: Accepted

Solution code:
n,t=list(map(int,input().split()))
lis = []
for i in range(n):
  s,k = list(map(int,input().split()))
  if k <= t:
    lis.append(s)
if lis == []:
  print("TLE")
  quit()
print(min(lis))

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

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

Submission status: Accepted

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

info_list = []
min = 10000
for i in range(n):
    ci, ti = map(int, input().split())
    if ti <= t and ci < min:
        min = ci

if min == 10000:
    print("TLE")
else:
    print(min)

Submission status: Accepted

Solution code:
N, T = map(int, input().split(" "))
ans = (10000,-1)
for i in range(0,N):
    c, t = map(int, input().split(" "))
    if t <= T and ans[0] > c:
        ans = (c,t)

print(ans[0] if not ans[1] == -1 else "TLE")

Submission status: Accepted

Solution code:
import numpy as np

N, T = map(int, input().split())
cmin = 1000
index = -1
c = np.arange(N)
t = np.arange(N)

for i in range(N):
    c[i], t[i] = input().split()
    if t[i] <= T:
        if c[i] <= cmin:
            cmin = c[i]
            index = i
if index == -1:
    print("TLE")
else:
    print(c[index])

Submission status: Accepted

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

cost = []
time = 0
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        cost.append(c)
        time += 1

if time != 0:
    print(min(cost))
else:
    print('TLE')

Submission status: Accepted

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

message = "TLE"

for i in range(n):
    cost, time = map(int, input().split())
    if time <= t and (message == "TLE" or cost < int(message)):
        message = str(cost)

print(message)

Submission status: Accepted

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

min_cost = 1001

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

if min_cost < 1001:
    print(min_cost)
else:
    print("TLE")

Submission status: Accepted

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

s_path=float('inf')

for i in paths:
  if i[1]<=T:
    s_path=min(s_path,i[0])

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

Submission status: Accepted

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

smallest_cost = 2000
for i in range(N):
    if t[i] > T:
        continue
    if c[i] > smallest_cost:
        continue
    smallest_cost = c[i]

if smallest_cost == 2000:
    smallest_cost = 'TLE'

print(smallest_cost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def takeFirst(elem):
    return elem[0]

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

cts.sort(key=takeFirst)

# print(ct)
for ct in cts:
	if ct[1] <= T: 
		print(ct[0])
		exit()

print('TLE')

Submission status: Accepted

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

a = []
for i in range(n):
    c,tt = map(int,input().split())
    if tt <= t :
        a.append([c,tt])

if len(a) > 0 :
    a.sort(key=lambda x : x[0])
    print(a[0][0])
else :
    print("TLE")

Submission status: Accepted

Solution code:
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_min = 10000

for c_i, t_i in zip(c,t):
   if t_i <= T and c_i <= c_min:
       c_min = c_i

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

else:
    print(c_min)

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
l.sort(key=lambda x:x[0])
a='TLE'
for i in l:
    if i[1]<=t:
        a=str(i[0])
        break
print(a)

Submission status: Accepted

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


def main():
    n, t = map(int, input().split())
    tmp_t = float('inf')
    ans = float('inf')

    for i in range(n):
        ci, ti = map(int, input().split())

        if ti <= t and ci < ans:
            tmp_t = ti
            ans = ci

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
L = [list(map(int, input().split())) for k in range(N)]
ans = 10000
for l in L:
    if l[1] <= T:
        ans = min(ans,l[0])
print(ans if ans != 10000 else "TLE")

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10**5)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n,t = li()
ct = []
for _ in range(n):
    ct.append(list(li()))
    
ans = 10**18
for ci, ti in ct:
    if ti <= t:
        ans = min(ans, ci)
        
if ans == 10**18:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

ans = 9999
for c,t in src:
    if t > T: continue
    ans = min(ans, c)
print(ans if ans < 9999 else 'TLE')

Submission status: Accepted

Solution code:
n,t=input().split()
n=int(n)
x=[[int(i) for i in input().split()] for j in range(n)] 
#print(n,t)
#print(x)
cost=1000000000
for i in range(n):
  if x[i][1]<=int(t):
    if x[i][0]<cost:
      cost=x[i][0]
if cost==1000000000:
  print('TLE')
else:
  print(cost)

Submission status: Accepted

Solution code:
def abc112_b():
    n, t_lim = map(int,input().split())
    c = []
    for _ in range(n):
        ci, t = map(int, input().split())
        if t <= t_lim:
            c.append(ci)
    if c == []:
        return "TLE"
    else:
        return min(c)


print(abc112_b())

Submission status: Accepted

Solution code:
n,t = map(int,raw_input().split())
arr = []
for i in range(n):
    a,b = map(int,raw_input().split())
    arr.append((a,b))
cs = 10**20
for i in range(n):
    if arr[i][1] <= t:
        cs = min(cs,arr[i][0])
ans = cs if cs != 10**20 else "TLE"
print ans

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
c = [[int(i) for i in input().split()] for i in range(a)]
#print(c)
hantei=False
d=[]
for i in range(a):
    if b>=c[i][1]:
        d.append(c[i])
        hantei=True
    else:
        continue
if hantei==False:
    print("TLE")
else:
    print(sorted(d)[0][0])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n,t = list(map(int, input().split(' ')))

cost = 1001
for i in range(n):
    c,ti = list(map(int, input().split(' ')))
    if ti <= t:
        cost = min(cost, c)

if cost > 1000:
    print('TLE')
else:
    print(cost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 帰宅経路数と時間を取得
N, T = map(int, input().split())
# 時間制限
ans = 1001
# N個の帰宅経路と時間を取得し、比較する
for i in range(N):
    cost, time = map(int, input().split())
    if time <= T:
        ans = min(ans, cost)
# 出力する
if ans == 1001:
    ans = "TLE"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
costs = []
for i 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:
NT = list(map(int, input().split()))
mini = -1
for i in range(NT[0]):
    route = list(map(int, input().split()))
    if route[1] <= NT[1]:
        if mini == -1:
            mini = route[0]
        elif mini > route[0]:
            mini = route[0]
if mini == -1:
    print('TLE')
else:
    print(mini)

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:
        ans = min(ans, c)
if ans == 10000:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
C = []
ts = []
for i in range(N):
    c, t = map(int, input().split())
    C.append(c)
    ts.append(t)

ans = 1e100
for i in range(N):
    if ts[i] <= T:
        ans = min(ans, C[i])
if ans == 1e100:
    print("TLE")
else:
    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:
        ans = min(ans, c)
if ans == 10000:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

Solution code:
def main():
    n, T = map(int, input().strip().split())

    min_c = 10000
    for i in range(n):
        c, t = map(int, input().strip().split())
        if t > T:
            continue;
        if c < min_c:
            min_c = c

    if min_c == 10000:
        print("TLE")
    else:
        print(min_c)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
minCost = 1001
for i in range(n):
    cc, tt = map(int, input().split())
    if tt <= t and cc < minCost:
        minCost = cc
if minCost == 1001:
    print('TLE')
else:
    print(minCost)

Submission status: Accepted

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

for i in range(n):
    a, b = map(int, input().split())
    c.append(a)
    t.append(b)
#%%
# n, T = 3, 70
# c = list([0,0,0])
# t = list([0,0,0])
# c[0], t[0] =  7, 60
# c[1], t[1] = 1, 80
# c[2], t[2] = 4, 50


#%%
costs = []
min_time  = T
for i in range(n):
    if t[i] <= T:
        costs.append(c[i])

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

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
C = {c: t for c, t in (map(int, input().split()) for _ in range(N))}
cl = [k for k, v in C.items() if v <= T]

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

Submission status: Accepted

Solution code:
N,T = map(int,input().split())
l = [[int(i) for i in input().split()] for _ in range(N)]
l.sort(key=lambda x:x[0])
OK,ans = False,0
for i in range(N):
    if l[i][1]<=T:
        ans = i
        OK = True
        break
print(l[ans][0] if OK else 'TLE')

Submission status: Accepted

Solution code:
def solve():
    cost = 1001
    N, time = map(int, input().split())
    for _ in range(N):
        c, t = map(int, input().split())
        if t <= time and c <= cost:
            cost = c
    print('TLE' if cost is 1001 else cost)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
# https://beta.atcoder.jp/contests/abc112/tasks/abc112_b

def solve():
    cost = 1001
    N, time = map(int, input().split())
    for _ in range(N):
        c, t = map(int, input().split())
        if t <= time:
            if c <= cost:
                cost = c

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
N, T = (int(x) for x in input().split())
cost_min = 1001
for i in range(N) :
    cost, time = (int(x) for x in input().split())
    if time <= T and cost < cost_min :
        cost_min = cost
if cost_min > 1000 :
    print("TLE")
else :
    print(cost_min)

Submission status: Accepted

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

c = []
t = []

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

l = list(zip(c, t))
l.sort()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def abc112_b():
    n, limit_time = map(int, input().split())
    ans = 10000

    for _ in range(n):
        cost, time = map(int, input().split())

        if time <= limit_time and ans > cost:
            ans = cost

    return ans if ans != 10000 else "TLE"


if __name__ == '__main__':
    print(abc112_b())

Submission status: Accepted

Solution code:
n,t= map(int, input().split())
rs = [list(map(int, input().split())) for i in range(n)]
rs.sort()
for i in rs:
    ci, ti = i
    if ti<= t:
        print(ci)
        exit()
print('TLE')

Submission status: Accepted

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

c = []
cmin = []

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

  else:
    c.append(1001)
    
cmin = sorted(c)

if( cmin[0] == 1001):
  print("TLE")
  
else:
  print(cmin[0])

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 and c < minC:
        minC = c

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

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())
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)

Submission status: Accepted

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

ct = []
for i in range(n):
    cti = list(map(int, input().split()))
    ct.append(cti)

ct0 = [ i[0] for i in ct if i[1]<=t ]

if len(ct0)>0:
    print(min(ct0))
else:
    print("TLE")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
b = 1001
for i in range(N):
    a = list(map(int, input().split()))
    if a[0] < b and a[1] <= T:
        b = a[0]
if b == 1001:
    print("TLE")
else:
    print(b)

Submission status: Accepted

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

l=sorted(l,key=lambda x:x[0])
for i in l:
    if i[1]<=t:
        print(i[0])
        exit()
print('TLE')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
mncst=1001
for i in range(n):
    a,b=map(int,input().split())
    if b<=t:
        if a<mncst:
            mncst=a
if mncst==1001:
    mncst='TLE'

print(mncst)

Submission status: Accepted

Solution code:
n, tm = map(int, input().split())
ctl = []
for i in range(n):
    c, t = map(int, input().split())
    ctl.append([c, t])

filctl = []
for elm in ctl:
    if elm[1] <= tm:
        filctl.append(elm)
if len(filctl) != 0:
    filctl = sorted(filctl)
    print((filctl[0])[0])
else:
    print("TLE")

Submission status: Accepted

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

minimize = 10000
index = 0
for i in range(N):
    c_i, t_i = map(int, input().split())
    if t_i <= T and c_i < minimize:
        minimize = c_i

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
cx=1000
f=True
for i in range(n):
	ci,ti=map(int,input().split())
	if ti<=t and cx>=ci:
		cx=ci
		f=False
if f:
	print('TLE')
	exit()
print(cx)

Submission status: Accepted

Solution code:
N,T = map(int,input().split(" "))
whole = []
for i in range(N):
  whole.append(list(map(int,input().split(" "))))
flag = 0
j = 0
while j < N:
  if whole[j][1] <= T:
    if flag == 0:
      flag = whole[j][0]
    else:
      if flag >= whole[j][0]:
        flag = whole[j][0]
  j = j + 1
if flag == 0:
    print("TLE")
else:
    print(flag)

Submission status: Accepted

Solution code:
n,t = map(int, input().split())
a = []
b = 0
for i in range(n):
  l = list(map(int, input().split()))
  a.append(l)
a.sort()
for i in range(n):
  if a[i][1] <= t:
    b = a[i][0]
    break
if b > 0:
  print(b)
else:
  print("TLE")

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
minc = 1001
for _ in range(N):
  c, t = map(int, input().split())
  if t <= T and c < minc:
    minc = c

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

Submission status: Accepted

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

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

if c_min > 1000:
    print("TLE")
else:
    print(c_min)

Submission status: Accepted

Solution code:
NT = list(map(int, input().split()))
Min = 1001
for i in range(NT[0]):
  Data = list(map(int, input().split()))
  if Data[1] <= NT[1]:
    if Data[0] < Min:
      Min = Data[0]
if Min == 1001:
  print("TLE")
else:
  print(Min)

Submission status: Accepted

Solution code:
# あ
read_line = input().split()
route_count = int(read_line[0])
permit_time = int(read_line[1])

route_info = {}
min_cost = 9999
for i in range(route_count) :
	read_line = input().split()
	cost = int(read_line[0])
	time = int(read_line[1])
	if (time > permit_time) :
		continue
		
	if (min_cost > cost) :
		min_cost = cost

if (min_cost != 9999) :
	print(min_cost)
else :
	print("TLE")

Submission status: Accepted

Solution code:
n,t = list(map(int,input().split()))
a = [input() for i in range(n)]
cost = 1001
x = 0

for i in range(n):
  b = list(map(int,a[i].split()))
  if t >= b[1] and cost >= b[0]: 
    cost = b[0]
    
if cost == 1001:
  print("TLE")
else:
  print(cost)

Submission status: Accepted

Solution code:
path,time = map(int,input().split())
lists = []
for i in range(path):
    lists.append(list(map(int,input().split())))

lists2 = []
for i in range(path):
    if lists[i][1] <= time:
        lists2.append(lists[i])

if not lists2:
    print("TLE")
else:
    lists2.sort(key=lambda x:x[0])
    print(lists2[0][0])

Submission status: Accepted

Solution code:
def main04():
    buf = input("");
    bufs = buf.split(" ");
    val1 = [];
    for i in range(len(bufs)):
        val1.append(int(bufs[i]));
    val2 = [];
    for i in range(val1[0]):
        buf = input("");
        bufs = buf.split(" ");
        kari = [];
        kari.append(int(bufs[0]));
        kari.append(int(bufs[1]));
        val2.append(kari);
    min1 = 10000;
    for i in range(val1[0]):
        if val2[i][1] < val1[1] + 1 and val2[i][0] < min1:
            min1 = val2[i][0];
    if min1 == 10000:
        print("TLE");
    else:
        print(min1);

if __name__ == '__main__':
    main04()

Submission status: Accepted

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

for i,j in enumerate(l):
    if j[1] <= t:
        print(j[0])
        break
else:
    print("TLE")

Submission status: Accepted

Solution code:
N , T = map(int, input().split())
l =[]
for index in range(N):
    n , t  =map(int ,input().split())
    l .append([n,t])
ans = []
for elt in l :
    if elt[1]<=T :
        ans.append(elt[0])
if ans == []:
    print("TLE")
else:
    print(min(ans))

Submission status: Accepted

Solution code:
InStr = input()
InList = InStr.split()
N = int(InList[0])
T = int(InList[1])
ccalist = []
for i in range(N):
    InStr = input()
    InList = InStr.split()
    cc = int(InList[0])
    ct = int(InList[1])
    if ct <= T:
        ccalist.append(cc)
if ccalist == []:
    print("TLE")
else:
    ccalist.sort()
    print(ccalist[0])

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num_time_list = (input()).split()
num = int(num_time_list[0])
time = int(num_time_list[1])

option_list = []
for i in range(num):
    option_list.append((input()).split())
    
answer = 0
for i in range(num):
    option_cost = int(option_list[i][0])
    option_time = int(option_list[i][1])
    if option_time <= time:
        if answer > option_cost or answer == 0:
            answer = option_cost
            
if answer == 0:
    print( "TLE" )
else:
    print( answer )

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b

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

    if best == INF:
        print("TLE")
    else:
        print(best)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

least = 10000

for _ in range(n):
	thisCost, thisTime = map(int, input().split())
	
	if thisTime <= t:
		if thisCost < least:
			least = thisCost
			
if least == 10000:
	print("TLE")
else:
	print(least)

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

Submission status: Accepted

Solution code:
nt = list(map(int, input().split()))
n = nt[0]
t = nt[1]
min_cost = 2000
for i in range(n):
    ct = list(map(int, input().split()))
    c = ct[0]
    t_i = ct[1]
    if t_i <= t and c < min_cost:
        min_cost = c
if min_cost == 2000:
    print("TLE")
else:
    print(min_cost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, T = list(map(int, input().rstrip().split()))
mt = 1001
for i in range(N):
    c, t = list(map(int, input().rstrip().split()))
    if t <= T:
        if c < mt:
            mt = c


print(str(mt) if mt < 1001 else 'TLE')