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

n, T = [int(i) for i in input().split()]
ct = [int(i) for _ in range(n) for i in input().split()]

cs = np.array(ct[0::2])
ts = np.array(ct[1::2])

cs_fil = cs[ts <= T]

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

Submission status: Accepted

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

c=[]
t=[]

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

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

while 0 in c: c.remove(0)
while 0 in t: t.remove(0)

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

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

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

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
routes = []
for _ in range(n):
  routes.append(tuple(map(int, input().split())))
try:
  print(min(route[0] for route in routes if route[1]<=t))
except:
  print("TLE")

Submission status: Accepted

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

mincost = 10001
minnum = 10000
for i in range(N):
    if a[i][1]>M:
        continue
    else:
        if mincost > a[i][0]:
            mincost = a[i][0]
            minnum = i
if mincost == 10001:
  print ("TLE")
else:
  print(a[minnum][0])

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

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

Submission status: Accepted

Solution code:
#python Time_Limit_Exceeded.py
"""
入力フォーマット
N T
c_1 t_1
.
.
.
c_N t_N
N:帰宅経路数, T:帰宅制限時間
c_i:i番目の経路のコスト, t_i:i番目の経路の時間
出力：時間T以内に帰宅可能な最小コストの経路(不可能なら"TLE")
"""

line1 = list(map(int, input().split(" ")))
N = line1[0]
T = line1[1]
line2 = []
for i in range(N):
	line2.append(list(map(int, input().split(" "))))

min=1001 #1<=T<=1000
for i in range(N):
	if line2[i][1]<=T and min>line2[i][0]:
		min=line2[i][0]

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

Submission status: Accepted

Solution code:
def main():

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
tmp=raw_input().split(" ")
N=int(tmp[0])
T=int(tmp[1])
Cost=[]
for i in range(N):
  tmp=raw_input().split(" ")
  if int(tmp[1])<=T:
     Cost.append(int(tmp[0]))
if len(Cost)==0:
  print("TLE")
else:
  print(min(Cost))

Submission status: Accepted

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

for i in range(n):
    data.append(list(map(int,input().split())))
    
data.sort(key=lambda x:x[1])

pos = len(data)
for i in range(len(data)):
    if data[i][1] >t:
        pos = i
        break
        
if pos==0:
    print('TLE')
else:
    new = data[:pos]
    new.sort(key=lambda x:x[0])
    print(new[0][0])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, t = list(map(int, input().split()))
box = []
cost = 9999
for i in range(n):
    box.append(list(map(int, input().split())))
    if box[i][1] <= t:
        if cost > box[i][0]:
            cost = box[i][0]

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

Submission status: Accepted

Solution code:
n, T = [int(i) for i in input().split()]
INF = 10000

mc = INF
for i in range(n):
    c, t = [int(k) for k in input().split()]
    if c < mc and t <= T:
        mc = c

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

Submission status: Accepted

Solution code:
N,T=list(map(int,input().split()))
c=[]
t=[]
for i in range(N):
    a,b=list(map(int,input().split()))
    c.append(a)
    t.append(b)
tmp=1001
for i in range(N):
    if(t[i]<=T):
        if(tmp>c[i]):
            tmp=c[i]
if(tmp==1001):    print("TLE")
else:    print(tmp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = list(map(int, input().split()))
N = A[0]
T = A[1]

L = []
for i in range(N):
    x = list(map(int, input().split()))
    c = x[0]
    t = x[1]
    a = {'cost': c, 'time': t}
    L.append(a)

min = 'TLE'
for i in L:
    if i['time'] <= T:
        if min == 'TLE':
            min = i['cost']
        elif i['cost'] < min:
            min = i['cost']

print(min)

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())))
kouho =[]
for i in range(N):
    if ct[i][1]<=T:
        kouho.append(ct[i][0])
if len(kouho)==0:
    print("TLE")
else:
    print(min(kouho))

Submission status: Accepted

Solution code:
cost = 1000
out = 0
n, t = map(int, input().split())
list1 = [input() for i in range(n)]
for i in list1:
    a, b = map(int, i.split())
    if b<=t:
        if a<=cost:
            cost = a
    else:
        out +=1
    
if out==n:
    print('TLE')
else:
    print(cost)

Submission status: Accepted

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

ans = 1000
flg = True

for s in ss:
    if int(s[1]) <= t:
        if s[0] < ans:
            ans = s[0]
        flg = False

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

Submission status: Accepted

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

N, T = map(int, Input().split())
c_t = [list(map(int, Input().split())) for _ in range(N)]
mi = float("inf")

for c, t in c_t:
    if t <= T and c < mi:
        mi = c

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

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
l=[]
for i in range(1,n+1):
  p,q=map(int,input().split())
  if q<=t:
    l.append(p)
  else:
    pass
if len(l)==0:
  print("TLE")
else:
  print(min(l))

Submission status: Accepted

Solution code:
Base = input().split(" ")
N = int(Base[0])
TL = int(Base[1])
TX = 10000

for i in range(N):
    Roi = input().split(" ")
    Coi = int(Roi[0])
    TLi = int(Roi[1])
    if TL >= TLi:
        if TX >= int(Coi) or i ==0:
            TX = Coi
if TX == 10000:
    print("TLE")
else:
    print(TX)

Submission status: Accepted

Solution code:
# encoding: utf-8
n, t = map(int, input().split())
min_num = -1
min_c = -1
for i in range(n):
	ctmp, ttmp = map(int, input().split())
	if ttmp <= t:
		if min_c == -1 or min_c > ctmp:
			min_c = ctmp
			min_num = i + 1
if min_num != -1:
  	print(min_c)
else:
	print('TLE')

Submission status: Accepted

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

if(c):
    print(min(c))
else:
    print('TLE')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, T = map(int, raw_input().split())
n = []
t = []
for _ in range(N):
    x, y = map(int, raw_input().split())
    n.append(x)
    t.append(y)

if min(t) >= T:
    print 'TLE'
else:
    min_index = 1001
    for i in range(N):
        if n[i] < min_index and T >= t[i]:
            min_index = n[i]

    print min_index

Submission status: Accepted

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

Submission status: Accepted

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

while N > 0:
    c, t = map(int, input().split(' '))
    if t <= T and c < result:
        result = c
    else:
        pass
    N = N - 1

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

Submission status: Accepted

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

if min(t) > T:
    print("TLE")
else:
    l = [i for i in range(N) if t[i]<=T]
    ca = 10000
    for i in l:
        if ca >= c[i]:
            ca = c[i]
    print(ca)

Submission status: Accepted

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

cost = 0
time = 0

for i in range(N):
    if array[i][1] <= T and (cost > array[i][0] or cost == 0):
        cost = array[i][0]

if cost == 0:
    print('TLE')
    exit()

print(cost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# abc112_b
init = input().split(" ")

# 初期情報
N = int(init[0])
T = int(init[1])

c = []
t = []


try:
	while True:
		temp = input().split(" ")
		c.append(int(temp[0]))
		t.append(int(temp[1]))
		
except:
	pass

mincost = max(c)
mincost_id = 0

if min(t) > T:
	print("TLE")
else:
	for j in range(N):
		if t[j] <= T:
			
			if c[j] < mincost:
				mincost = c[j]
				mincost_id = j
	print(mincost)

Submission status: Accepted

Solution code:
n, t = list(map(int, input().split()))
mincost = 100000
for _ in range(n):
    ci, ti = list(map(int, input().split()))
    if ti > t:
        continue
    if ci < mincost:
        mincost = ci
if mincost == 100000:
    print("TLE")
else:
    print(mincost)

Submission status: Accepted

Solution code:
n, t = list(map(int, input().split()))
mincost = 100000
for _ in range(n):
    ci, ti = list(map(int, input().split()))
    if ti > t:
        continue
    if ci < mincost:
        mincost = ci
if mincost == 100000:
    print("TLE")
else:
    print(mincost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,T = map(int, input().split())
cList=[]
tList=[]
ans=999999999999999999999999999999999999999
flag=0
for i in range(N):
  c,t=map(int, input().split())
  if t <= T:
    flag=1
    if c < ans:
        ans=c

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

Submission status: Accepted

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

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

if C > 0:
    print(C)
else:
    print('TLE')

Submission status: Accepted

Solution code:
hoge = input()
N,T = list(map(int,hoge.split(' ')))
c = []
t = []
for i in range(N):
    fuga = list(map(int,input().split(' ')))
    c.append(fuga[0])
    t.append(fuga[1])
min_c = 2000
for i in range(N):
    if t[i] <= T:
        if min_c > c[i]:
            min_c = c[i]
if min_c == 2000:
    print('TLE')
else:
    print(min_c)

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N,T = map(int, input().split())
ct = [list(map(int, input().split())) for i in range(N)]
c = np.array([ct[i][0] for i in range(N)])
t = np.array([ct[i][1] for i in range(N)])
c_ = list(c[t<T])
if len(c_)==0:
    print("TLE")
else:
    print(np.min(c[t<=T]))

Submission status: Accepted

Solution code:

def a():
    i = input().split(' ')
    N = int(i[0])
    T = int(i[1])
    c = []
    t = []
    for _ in range(N):
        i = input().split(' ')
        c.append(int(i[0]))
        t.append(int(i[1]))
    sat_c = []
    for cc, tt in zip(c, t):
        if tt <= T:
            sat_c.append(cc)
    if sat_c == []:
        print('TLE')
    else:
        print(min(sat_c))
        
a()

Submission status: Accepted

Solution code:
li = input().split()
n = int(li[0])
t = int(li[1])

maxt = 1001
cost = 1001
ans = 1001

for i in range(0, n):
    li = input().split()
    x = int(li[0])
    y = int(li[1])
    if y <= t:
        if x <= cost:
            cost = x

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

Submission status: Accepted

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

cc = 9999
for i in range(n):
    ci, ti = map(int, raw_input().split(' '))

    if ti <= t:
        if ci < cc:
            cc = ci

if cc == 9999:
    print 'TLE'
else:
    print cc

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

ok = [ct[i] for i in range(n) if ct[i][1] <= t]
ok.sort()
if len(ok) == 0:
    print('TLE')
else:
    print(ok[0][0])

Submission status: Accepted

Solution code:
"""
B - Time Limit Exceeded
"""

import numpy as np

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

temp = []
for i in range(n):
    value = []
    for part in input().split():
        value.append(int(part))
    temp.append(value)

keiros = np.array(temp)

# 0番目の 0:コスト 1:時間
#print(keiros[0, 1])

keiros_sort = np.argsort(keiros[:, 1])

#print(keiros)
#print(keiros[keiros_sort])

min_cost = 1001
for keiro in keiros[keiros_sort]:
    #print(keiro)
    if keiro[1] <= t:
        min_cost = min(min_cost, keiro[0])

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

Submission status: Accepted

Solution code:
N, T = [int(i) for i in input().split()]
cur_time = T+1
cur_cost = 1001
for n in range(N):
    c, t = [int(i) for i in input().split()]
    if t <= T:
        if c < cur_cost:
            cur_cost = c
if cur_cost == 1001:
    print('TLE')
else:
    print(cur_cost)

Submission status: Accepted

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


def main():
    n, large_t = map(int, input().split())
    cost = 10000
    count = 0

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

        if ti <= large_t:
            cost = min(cost, ci)
        else:
            count += 1

    if count != n:
        print(cost)
    else:
        print('TLE')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Oct  6 14:05:15 2018

@author: rgraptin
"""

params = input()

n = int(params.split(' ')[0])
t = int(params.split(' ')[1])

data = []

for i in range(0, n) :
    d = input()
    data.append([int(d.split(' ')[0]),int(d.split(' ')[1])])
    
minimum_cost = 1000000
    
for cost in data :
    if cost[1] <= t : 
        
        if cost[0] < minimum_cost :
            minimum_cost = cost[0]

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

Submission status: Accepted

Solution code:
n,T=map(int,input().split())
ct = [list(map(int,input().split())) for i in range(n)]
res="TLE"
ct.sort(key=lambda x:x[0])
for r in ct:
    if r[1] <= T:
        res=r[0]
        break
print(res)

Submission status: Accepted

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

N = inputs[0]
T = inputs[1]

best = 9999

for i in range(N):
    inputs = list(map(int, input().split()))
    if(best >= inputs[0]):
        if(T >= inputs[1]):
            best = inputs[0]

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

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
c0 = 10000
for i in range(n):
     cn,tn = map(int,input().split())
     if tn <= t and cn <= c0:
     	 c0 = cn
if c0 == 10000:
	print("TLE")
else:
	print(c0)

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

Submission status: Accepted

Solution code:
N,T = (int(i) for i in input().split())
c = list(0 for i in range(N))
t = list(0 for i in range(N))
for i in range(N):
    c[i], t[i] = (int(i) for i in input().split())
c_min=0
for i in range(N):
    if c_min > c[i] or c_min == 0:
        if t[i] <= T:
            c_min = c[i]
if c_min == 0:
    print("TLE")
else:
    print(c_min)

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
c_min = 1001
for _ in range(N):
  c, t = map(int, input().split())
  if t <= T:
    c_min = min(c_min, c)
print(c_min if c_min != 1001 else "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())

for i in range(n):
    if t[i] > T:
        c[i] = 1001

if min(c) <= 1000:
    print(min(c))
else:
    print('TLE')

Submission status: Accepted

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

min=1000
c = []
t = []
flag=1
for i in range(n):
    c1,t1=[int(i) for i in input().split()]
    c.append(c1)
    t.append(t1)

for i in range(n):
  if (t[i]<=time) and (c[i]<=min):
    min=c[i]
    flag=0

if flag==0:
  print(min)
else:
  print("TLE")

Submission status: Accepted

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

Submission status: Accepted

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

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

min_c = 1001

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

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

Submission status: Accepted

Solution code:
import sys
N,T = map(int,input().split())
c = []
t = []
for i in range(N):
  ch = 0
  th = 0
  ch,th = map(int,input().split())
  if th > T:
    continue
  c.append(ch)
  t.append(th)
if len(t) == 0:
  print('TLE')
  sys.exit()
c.sort()
print(c[0])

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

for i in range(n):
    if ct_list[i][1] <= t:
        print(ct_list[i][0])
        exit()
print("TLE")

Submission status: Accepted

Solution code:
n, m = map(int, input().split())
ans = 999999
for _ in range(n):
    c, t = map(int, input().split())
    if t > m:
        continue
    ans = min(ans, c)
if ans == 999999:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
strN, strT = input().split()
N = int(strN)
max_t = int(strT)

min_cost = 0
for i in range(1, N+1):
    str_cost, str_time = input().split()
    cost = int(str_cost)
    t = int(str_time)
    if max_t < t:
        continue
    if min_cost == 0:
        min_cost = cost
    elif min_cost > cost:
        min_cost = cost

if min_cost == 0:
    print('TLE')
else:
    print(min_cost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,T = map(int,input().split())
cc = 1001
tt = T + 1
for i in range(n):
    c,t = map(int,input().split())
    if t <= T and c <= cc:
        cc = c
        tt = t
if tt == T+1 or cc == 1001:
    print("TLE")
else:
    print(cc)

Submission status: Accepted

Solution code:
#coding:utf-8

c_list = []
t_list = []

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

minval = 'TLE'
for c, t in zip(c_list, t_list):
    if t <= T:
        if minval == 'TLE':
            minval = c
        if c < minval:
            minval = c
print(minval)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, T = [int(x) for x in input().split(" ")]
min_t = "TLE"
for _ in range(N):
    c, st = [int(x) for x in input().split(" ")]
    if st > T:
        continue
    if min_t == "TLE" or min_t > c:
        min_t = c
print(min_t)

Submission status: Accepted

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

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

valid_costs=[]
for path in range(N):
    if tlist[path] <= T:
        valid_costs.append(clist[path])
if valid_costs == []:
    print('TLE')
else:
    cheapest = valid_costs[0]
    for i in valid_costs:
        if i < cheapest:
            cheapest = i
    print(cheapest)

Submission status: Accepted

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

#print(N, T, ct)
ct2 = []
#
for p in ct:
    if p[1] <= T:
        ct2.append(p)

#print(ct2)
if len(ct2) == 0:
    print("TLE")
else:
    print(sorted(ct2)[0][0])

Submission status: Accepted

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

mi = 1001
now_mi = -1
for i in range(N):
  if t[i] <= T:
    if mi > c[i]:
      mi = c[i] 

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, T = map(int, input().split())

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

ct2 = []
for (c,t) in ct:
    if t <= T:
        ct2.append([c,t])

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,T = map(int,input().split(" "))
list1 = []
count = 0
for i in range(N):
    c,t = map(int,input().split(" "))
    if t <= T:
        list1.append(c)
        count += 1

if count == 0:
    print("TLE")
else:
    print(min(list1))

Submission status: Accepted

Solution code:
import itertools as it
import collections as col
import bisect

import sys
sys.setrecursionlimit(10000)

def main():
    N, T = [int(x) for x in input().split()]
    constraints = [tuple([int(x) for x in input().split()]) for _ in range(N)]
    legal = [x[0] for x in constraints if x[1] <= T]
    if (legal):
        return min(legal)

    return "TLE"
    
    
if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
def answer(in0):
    in0 = [int(n) for n in in0.split(" ")]
    N = in0[0]
    T = in0[1]
    minCost = 1001
    for _ in range(N):
        _in = [int(n) for n in input().split(" ")]
        if _in[1] <= T and _in[0] <= minCost:
            minCost = _in[0]

    if minCost == 1001:
        return 'TLE'

    return minCost


print(answer(input()))

Submission status: Accepted

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

m = 0

for l in ct:
    if l[1] > t:
        continue
    
    if m == 0 or l[0] < m:
        m = l[0]

if m == 0:
    print("TLE")
    exit(0)

print(m)

Submission status: Accepted

Solution code:
nt = input().split(" ")
n = int(nt[0])
t = int(nt[1])

min_cost = 0

for i in range(n):
    cost_time = input().split(" ")
    cost = int(cost_time[0])
    time = int(cost_time[1])
    if time <= t:
        if min_cost == 0:
            min_cost = cost
        else:
            if min_cost > cost:
                min_cost = cost

if min_cost == 0:
    print("TLE")
else:
    print(min_cost)

Submission status: Accepted

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

kei = []
for _ in range(0, N):
    c,t = (int(i) for i in input().split())
    kei.append((c,t))

res = 10000
for tmp in kei:
    if tmp[1] <= T:
        if res > tmp[0]:
            res = tmp[0]

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

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:
        pass
    else:
        C.append(c)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, t = map(int,input().split())
cc = []
tt = []
for i in range(n):
    a,b = map(int,input().split())
    cc.append(a)
    tt.append(b)

cnt = 0
d = []
for i in range(n):
    if tt[i] <= t:
        cnt += 1
        d.append(cc[i])

if cnt == 0:
    print('TLE')
else:
    print(min(d))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3

n, t = list(map(int, input().split()))
cmin = float('inf')
able = False
for i in range(n):
    ci, ti = list(map(int, input().split()))
    if ti <= t:
        cmin = min(cmin, ci)
        able = True

if able:
    print(cmin)
else:
    print('TLE')

Submission status: Accepted

Solution code:
n,t =map(int,input().split())
ans = 10 ** 10
for i in range(n):
  a,b = map(int,input().split())
  if b <= t:
    ans = min(ans,a)
if ans == 10 ** 10:
  print("TLE")
else:
  print(ans)

Submission status: Accepted

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

INITIAL_MIN_COST = 10000
min_cost = INITIAL_MIN_COST

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

if min_cost == INITIAL_MIN_COST:
    print('TLE')
else:
    print(min_cost)

Submission status: Accepted

Solution code:
N, T = [int(a) for a in input().split()]

minc = 9999

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if ans == -1:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

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