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

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

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

Submission status: Accepted

Solution code:
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	x,y = map(int,input().split())	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# 3
# hoge
# foo
# bar
# n=int(input())
# string_list=[input() for i in range(n)]
# N, M = map(int,input().split())

# P, Y = [], []
# for _ in range(M):
#     P_i, Y_i = = map(int,input().split())
#     P.append(P_i)
#     Y.append(Y_i)

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

cs, ts = [], []
for _ in range(N):
    c, t = map(int,input().split())
    cs.append(c)
    ts.append(t)

ans_c = 9999
ans = None
for ind, (c, t) in enumerate(zip(cs, ts)):
    if c<ans_c and t<=Time:
        ans_c = c
        ans = ind

if ans is None:
    print("TLE")
else:
    print(ans_c)

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
A=[]
for _ in range(n):
    cost,time=map(int,input().split())
    A.append([cost,time])
mincost=float('inf')
for i in range(n):
    if A[i][1]<=t:
        mincost=min(mincost,A[i][0])
if mincost==float('inf'):
    print('TLE')
else:
    print(mincost)

Submission status: Accepted

Solution code:
def inpl(): return list(map(int, input().split()))
N, T = inpl()
ans = 10000
for i in range(N):
    c,t = inpl()
    if t > T:
        continue
    ans = min(ans, c)
if ans == 10000:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# Luis Yoichi Morales January 2019

from sys import stdin

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

h=[]
for i in range (N):
    h.append( map(int, stdin.readline().split()) )

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

for i in range( N ):
    if h[i][1] <= T:
        print h[i][0]
        exit()
        
print 'TLE'

Submission status: Accepted

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

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:
import numpy as np

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

c_min = np.inf
for p in pl:
    if p[1] <= T:
        if p[0] <= c_min:
            c_min = p[0]

if c_min == np.inf:
    print("TLE")
else:
    print(c_min)

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
ct_list = [tuple(map(int, input().split())) for i in range(n)]
ans = 1001

for i in ct_list:
    if i[1] > t:
        continue
    if ans > i[0]:
        ans = i[0]

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

Submission status: Accepted

Solution code:
nt=[int(x) for x in input().split()]
mini=1001
try:
    for y in range(nt[0]):
        temp=([int(z) for z in input().split()])
        if(temp[1]<=nt[1] and temp[0]<mini):
            mini=temp[0]
            ans=mini
    print(ans)
except:
    print("TLE")

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)
  
min_cost = 10**4
for i in range(N):
  if t[i]<=T and min_cost>c[i]:
    min_cost=c[i]

if min_cost==10**4:
  print("TLE")
else:
  print(int(min_cost))

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 not C:
    print('TLE')
else:
    print(min(C))

Submission status: Accepted

Solution code:
ntlist = list(map(int, input().split()))
n,t = ntlist[0], ntlist[1]

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,T =[int(i)for i in input().split()]
ans = 10000
for _ 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())
ans=9999
for i in range(N):
  A,B=map(int, input().split())
  if (T>=B):
    if(ans>=A):
      ans=A
if(ans==9999):
  print("TLE")
else:
  print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
li = [list(map(int,input().split())) for i in range(N)]
#print(li)
t_cost=[T - li[i][1] for i in range(N)]
#print(t_cost)
if(all(x < 0 for x in t_cost)):#時間内Tに帰宅不可能な場合
  print('TLE')
else:#時間内に帰宅できる場合に最小コストのものを出力
  t_cost_1=[]
  for i in range(N):
    if(t_cost[i]>=0):
      t_cost_1.append(i)
    else:continue
  #print(t_cost_1)
  print(min([li[t_cost_1[i]][0] for i in range(len(t_cost_1))]))

Submission status: Accepted

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

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

if result == 1001:
    print('TLE')

else:
    print(result)

Submission status: Accepted

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

Submission status: Accepted

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

min=2000

for i in range(0,N):
  c,t=map(int,input().split(" "))
  if t>T:
    continue
  else:
    min=min-(min-c)*(c<min)

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

Submission status: Accepted

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

O = 1001
for i in range(Keiro):
    tmpC,tmpT = map(int,input().split())
    if(tmpT <= T and tmpC < O):
        O = tmpC


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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    [N, T] = list(map(int, input().split()))

    min_c = 9999
    for i in range(N):
        [c, t] = list(map(int, input().split()))
        if t <= T:
            min_c = min(min_c, c)

    print(str(min_c) if min_c != 9999 else 'TLE')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

tmp_min = 10**5

for i in range(N):
    if t[i]<=T and tmp_min>c[i]:
        tmp_min = c[i]

if tmp_min == 10**5:
    print('TLE')
else:
    print(int(tmp_min))

Submission status: Accepted

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

tmp_min = float('inf')

for i in range(N):
    if t[i]<=T and tmp_min>c[i]:
        tmp_min = c[i]

if tmp_min == float('inf'):
    print('TLE')
else:
    print(int(tmp_min))

Submission status: Accepted

Solution code:
N, T = input().split()
N, T = int(N), int(T)
R = [input().split() for i in range(N)]
 
for i, r in enumerate(R):
  R[i] = [int(r[0]), int(r[1])]
 
R_sorted = sorted(R, key = lambda x: x[0])
 
List = []
answer = 'TLE'
 
for r in R_sorted:
  if r[1] <= T:
    List.append(r[0])

if List:
  answer = min(List)

print(answer)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
""" AtCoder """

import sys
input = sys.stdin.readline

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

min_c = 1001

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

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

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
l = []
for _ in range(a):
  x, y = map(int, input().split())
  if y <= b:
    l.append(x)
if l == []:
  print('TLE')
else:
  print(min(l))

Submission status: Accepted

Solution code:
def main():
    n, t = map(int, input().split())
    ans = 100000000
    for i in range(n):
        c, tt = map(int, input().split())
        if tt <= t:
            ans = min(ans, c)
    if ans >= 1000000:
        print('TLE')
    else:
        print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

mincost = 10000
for i in range(n):
  if c[i][1] <= t:
    cost = c[i][0]
    mincost=min(cost,mincost)

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

Submission status: Accepted

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

mincost = 1001
for i in range(N):
    if c[i]<mincost and T>=t[i]:
        mincost = c[i]

if mincost == 1001:
    mincost = 'TLE'
print(mincost)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    n, t = map(int, input().split())
    cts = []
    for i in range(n):
        ci, ti = map(int, input().split())
        cts.append((ci, ti))
    cts = [ct for ct in cts if ct[1] <= t]
    if len(cts) == 0:
        print("TLE")
    else:
        cts.sort(key=lambda ct: ct[0])
        print(cts[0][0])

main()

Submission status: Accepted

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

cost = 1001

for i in li:
    if t >= i[1]:
        if cost > i[0]:
            cost = i[0]

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

Submission status: Accepted

Solution code:
n, t = [int(x) for x in input().split()]
costlist = []
for i in range(n):
    ci, ti = [int(x) for x in input().split()]
    if ti <= t:
        costlist.append(ci)
if costlist == []:
    print('TLE')
else:
    print(min(costlist))

Submission status: Accepted

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

for i in range(n):
    c,s = map(int,input().split())
    if s<=t:
        d.append(c)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,T = map(int,input().split())
ct = [list(map(int,input().split())) for _ in range(N)]
ok = False
cost = 10**10
for i in range(N):
    if ct[i][1] <= T and cost > ct[i][0]:
        cost = ct[i][0]
        ok = True
print(cost if ok else 'TLE')

Submission status: Accepted

Solution code:
def main():
    N, T = map(int, input().split())
    m = 1001
    for _ in range(N):
        c, t = map(int, input().split())
        if T >= t and m > c:
            m = c
    if m == 1001:
        print('TLE')
    else:
        print(m)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

min_cost = float("INF")
for ct in cts:
    temp_c = ct[0]
    temp_t = ct[1]
    if temp_t > t:
        continue
    if temp_c < min_cost:
        min_cost = temp_c

if min_cost == float("INF"):
    print("TLE")
else:
    print(min_cost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# B
N, T = [int(x) for x in input().split()]
cost = 9999
time = 9999
for i in range(N):
    c, t = [int(x) for x in input().split()]
    if t<=T and c<cost:
        cost = c
if cost==9999: cost = 'TLE'
print(cost)

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(costs == []):
  print('TLE')
else:
  print(min(costs))

Submission status: Accepted

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

minimum_cost = 1001

for sub_list in ctlist:
    if sub_list[1] <= T:
        if sub_list[0] < minimum_cost:
            minimum_cost = sub_list[0]

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

Submission status: Accepted

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

for i in range(N):
    ent = input().split()
    NT.append((i, int(ent[0]), int(ent[1])))

cost = 9999

for x in NT:
    if x[2] <= T:
        if x[1] < cost:
            cost = x[1]

if cost != 9999:
    print(cost)
else:
    print('TLE')

Submission status: Accepted

Solution code:
N, T = map(int,input().split())
c=[]
ans = 'TLE'

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

if len(c)>0:
    ans = min(c)
    
print(ans)

Submission status: Accepted

Solution code:
n,w = map(int,input().split())
m = 1001
for i in range(n):
    a,b = map(int,input().split())
    if b <= w and a < m:
        m = a
if m == 1001:
    print("TLE")
else:
    print(m)

Submission status: Accepted

Solution code:
n,w = map(int,input().split())
m = 1001
for i in range(n):
    a,b = map(int,input().split())
    if b <= w and a < m:
        m = a
if m == 1001:
    print("TLE")
else:
    print(m)

Submission status: Accepted

Solution code:
N, T = map(int, input().split(' '))
CT = [list(map(int, input().split(' '))) for _ in range(N)]
C_lt_T = [ct[0] for ct in CT if ct[1] <= T]

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

Submission status: Accepted

Solution code:
N,T=(int(i) for i in input().split())
ctlist=[[int(i) for i in input().split()]for j in range(N)]
A=[ctlist[i] for i in range (N) if ctlist[i][1]<=T]
if A==[]:
  print('TLE')
else:
  B=[A[i][0] for i in range(len(A))]
  print(min(B))

Submission status: Accepted

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

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

    if t > T:
        continue

    ans = min(ans, c)

if ans == 10 ** 10:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

Solution code:
n, t = map(int, input().split(' '))
ans = inf = int(1e9)
for _ in range(n):
	c, t_ = map(int, input().split(' '))
	if t_ <= t:
		ans = min(ans, c)
if ans == inf:
	print("TLE")
else:
	print(ans)

Submission status: Accepted

Solution code:
def main(n:int, t:int, lst:list):
  lst = list(x for x in lst if x[1] <= t)
  if len(lst):
    return min(x[0] for x in lst)
  else:
    return "TLE"
n, t = map(int, input().split()) #t以内でcost最小に
lst = [list(map(int, input().split())) for i in range(n)] #n個cost,timeのpair
print(main(n, t, lst))

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

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

if ansList == []:
    ans = "TLE"
else:
    ans = min(ansList)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, limit = map(int, input().split())
c = [0] * n
t = [0] * n
for i in range(n):
    c[i], t[i] = map(int, input().split())
intime = []
for i in range(n):
    if t[i] <= limit:
        intime.append(i)
minn = 100000
for i in intime:
    if c[i] < minn:
        minn = c[i]
if intime == []:
    print('TLE')
else:
    print(minn)

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
ans = 1010
for _ in range(N):
	c, t = map(int, input().split())
	if t <= T: ans = min(ans, c)
if ans == 1010: 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)]
ct.sort()
for i in ct:
    if i[1] <= T:
        print(i[0])
        exit()
else:
    print("TLE")

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
ret = float('inf')
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T and c < ret:
        ret = c

if ret == float('inf'):
    print("TLE")
else:
    print(ret)

Submission status: Accepted

Solution code:
N, T = [int(i) for i in input().split()]
S = [[int(i) for i in input().split()] for j in range(N)]
cost = 5000

for i in S:
    if i[1] > T:
        continue
    else:
        if i[0] < cost:
            cost = i[0]

if cost == 5000:
    print("TLE")
else:
    print(cost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def piyo():
    n , c = (int(i) for i in input().split())
    t = [[int(i) for i in input().split()] for i in range(n)]
    hogehoge = []
    for fizz in t:
        if fizz[1]<=c:
            hogehoge.append(fizz[0])
    if len(hogehoge)==0:
        print("TLE")
        return
    print(min(hogehoge))
    

if __name__ == '__main__':
    piyo()

Submission status: Accepted

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

Submission status: Accepted

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


def main():
    """Function."""
    n, t = map(int, input().split())

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

        if ti <= t:
            if ci < min_val:
                min_val = ci
            else:
                pass
        else:
            pass

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S = list(map(int,input().split()))
N = S[0]
T = S[1]
c = 0
for x in range(0,N):
    C = list(map(int,input().split()))
    if T < C[1]:
        continue
    else:
        if c == 0:
            c = C[0]
        if c > C[0]:
            c = C[0]
if c == 0:
    print('TLE')
else:
    print(c)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
c_t = [list(map(int, input().split())) for i in range(N)]
c_t = [[c, t] for c, t in c_t if t <= T]
C = sorted(c_t, key=lambda x:x[0])
print(C[0][0] if C else "TLE")

Submission status: Accepted

Solution code:
def main():
    n, t = map(int, input().split())
    pairs = sorted(tuple(map(int, input().split())) for _ in range(n))
    for p in pairs:
        if p[1] <= t:
            print(p[0])
            return
    print('TLE')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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 len(l) == 0:
    print('TLE')
else:
    print(min(l))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    n = input().split(' ')
    roads = int(n[0])
    good_time = int(n[1])
    answer = -1
    for road in range(0, roads):
        n = input().split(' ')
        cost = int(n[0])
        time = int(n[1])
        if time > good_time:
            continue
        if answer < 0 or answer > cost:
             answer = cost
    if answer < 0:
        print('TLE')
    else:
        print(str(answer))

Submission status: Accepted

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

cost_limit_list = []

for i in ct_sort:
    if i[1]<=T:
        cost_limit_list.append(i)
    else:
        break
if len(cost_limit_list) == 0:
    print('TLE')
else:
    cost_limit_list = sorted(cost_limit_list, key=lambda x: x[0])
    print(cost_limit_list[0][0])

Submission status: Accepted

Solution code:
def main(n:int,t:int,lst:list):
    lst=list(filter(lambda x:x[1]<=t,lst))
    if len(lst):
        return min(map(lambda x:x[0],lst))
    else:
        return "TLE"
n,t=map(int,input().split())
lst=[list(map(int,input().split()))for i in range(n)]
print(main(n,t,lst))

Submission status: Accepted

Solution code:
a,b = map(int,input().split(" "))
ar = []
for i in range(a):
    l = list(map(int,input().split(" ")))
    if l[1] <= b:
        ar.append(l[0])
if len(ar) == 0:
    print("TLE")
else:
    print(min(ar))

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
cost = 1000+1
T_ika_count = 0
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        T_ika_count = T_ika_count+1
        if c < cost:
            cost = c
if T_ika_count == 0:
    print('TLE')
else:
    print(cost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
c = []
t = []
for i in range(N):
    cn, tn = map(int, input().split())
    c.append(cn)
    t.append(tn)
count=0
for j in range(N):
    ans = min(c)
    if(t[c.index(ans)]>T):
        c[c.index(ans)] = 1001
        count+=1
    else:
        print(ans)
        break
if(count==len(c)):
    print('TLE')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ct.sort()

ans = 'TLE'
for i in range(N):
    if ct[i][1] <= T:
        ans = ct[i][0]
        break

print(ans)

Submission status: Accepted

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

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

c_t_filtered = list(filter(lambda x:x[1] <= T ,c_t_list))
if len(c_t_filtered) > 0:
    print(min(c_t_filtered,key=lambda x:x[0])[0])
else:
    print("TLE")

Submission status: Accepted

Solution code:
import sys
lines = []
for line in sys.stdin:
  col = line.strip().split(' ')
  lines.append((int(col[0]), int(col[1])))
min = 1001
for cand in lines[1:]:
  if cand[1] <= lines[0][1] and cand[0] < min:
    min = cand[0]
print(min if min < 1001 else 'TLE')

Submission status: Accepted

Solution code:
import sys

def main(data):
    N, T = data[0].split(' ')
    routes = [(int(line.split(' ')[0]), int(line.split(' ')[1])) for line in data[1:int(N) + 1]]
    routes = list(filter(lambda x: x[1] <= int(T), routes))
    if len(routes) < 1:
        print('TLE')
    else:
        routes.sort(key=lambda x: x[0])
        print(routes[0][0])
    
if __name__ == '__main__':
    data = [line.strip() for line in sys.stdin]
    main(data)

Submission status: Accepted

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

cn = []
for i in range(N):
    tup = tuple(map(int, input().strip().split()))
    if tup[1] <= T:
        cn.append(tup)
if len(cn) == 0:
    print("TLE")
    exit()

sorted_cn =sorted(cn,key =  lambda c: c[0])
print(sorted_cn[0][0])

Submission status: Accepted

Solution code:
n, t0=input().split()
ans=1000
flag=False

for i in range(int(n)):
    c, t=input().split()
    if int(t) <= int(t0):
        flag=True
        if int(c)<ans:
            ans=int(c)
            
print(ans if flag else 'TLE')

Submission status: Accepted

Solution code:
num, time_lim = list(map(int, input().split()))
ans = 'TLE'
for i in range(num):
  cost, time_data = list(map(int, input().split()))
  if time_data > time_lim:
    continue
  if ans == 'TLE':
    ans = cost
  if ans > cost:
    ans = cost
print(ans)

Submission status: Accepted

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

flag = False
min_c = 1000

for i in range(N):
    c, t = map(int, input().split())
    if min_c >= c and T >= t:
        min_c = c
        flag = True

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

Submission status: Accepted

Solution code:
n,t0=input().split()

ans=1000
flag=0

for i in range(int(n)):
  c,t=input().split()
  if int(t) <=int(t0):
    flag=1
    if int(c) < ans:
      ans=int(c)
      
print(ans if flag==1 else 'TLE')

Submission status: Accepted

Solution code:
N, T = list(map(int, input().split()))
minc = 1001;
for i in range(N):
  c, t = list(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())
costs=[]
time = []
for i in range(n):
    new_cost, new_time = map(int, input().split())
    if new_time<=t:
        costs.append(new_cost)
        time.append(new_time)
    else:
        continue
if costs ==[]:
    print('TLE')
else:
    print(min(costs))

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def input_N_T():
    N_T=input().split()
    int_N_T=list(map(int,N_T))
    N=int_N_T[0]
    T=int_N_T[1]
    return [N,T]

N,T=input_N_T()

min_c,min_t=1001,1001

for i in range(N):
    c,t=input_N_T()
    if(t<=T and min(min_c,c)==c):
        min_c=c

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

Submission status: Accepted

Solution code:
n, t1 = map(int,input().split())
a = []
for _ in range(n):
    c, t2 = map(int,input().split())
    if  t2 <= t1:
        a.append(int(c))
print("TLE") if (len(a) == 0) else print(min(a))