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 = list(map(int, input().split()))
max = 10000
for i in range(N):
    c,t = list(map(int, input().split()))
    if t <= T and c <= max:
        max = c
if max == 10000:
    print("TLE")
else:
    print(max)

Submission status: Accepted

Solution code:
import numpy as np
N,T = map(int, input().split())

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

c_list = np.array(c_list)
t_list = np.array(t_list)	

if not np.any(t_list[t_list<=T]):
	print('TLE')
else:
	print(min(c_list[t_list<=T]))

Submission status: Accepted

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


def solve(t, paths):
    return min((p for p in paths if p[1] <= t), default=(None, None))[0]


def main():
    n, t = (int(z) for z in input().split())
    paths = (tuple(int(ct) for ct in input().split()) for _ in range(n))
    res = solve(t, paths)
    print("TLE" if res is None else res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
lis = [list(map(int, input().split())) for _ in range(n)]
minCost = float("inf")
cnt = 0
for i in lis:
    if i[1] <= t:
        if i[0] < minCost:
            minCost = i[0]
            cnt += 1
if cnt != 0:  
    print(minCost)
else:
    print('TLE')

Submission status: Accepted

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

best=-1
best_c=-1
for _ in range(N):
    c,t = map(int,input().split())
    if t <= T:
        if best_c == -1:
            best_c = c
        elif best_c > c:
            best_c = c
if best_c == -1:
    print("TLE")
else: 
    print(best_c)

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
flag=1001
for _ in range(N):
    c,t=map(int,input().split())
    if t>T:
        continue
    else:
        count=c
        if count<=flag:
            flag=count

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

Submission status: Accepted

Solution code:
#

array = list(map(int, input().strip().split(' ')))


N =  array[0]

T =  array[1]


#print(N)
#print(T)

if N < 1:
    sys.exit()

if N > 100:
    sys.exit()


if T < 1:
    sys.exit()

if T > 1000:
    sys.exit()



c_min = 9999


for i in range(N):
    array1 = list(map(int, input().strip().split(' ')))
    cN =  array1[0]

    tN =  array1[1]

    if cN < 1:
        sys.exit()

    if cN > 1000:
        sys.exit()

    if tN < 1:
        sys.exit()

    if tN > 1000:
        sys.exit()
    
    if tN <= T:
        if c_min > cN:

            c_min = cN

if c_min == 9999:
    print("TLE")

else:
    print(c_min)

Submission status: Accepted

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

    for i in range(N):
        ai,bi= (int(j) for j in input().split())  
        if bi<= T:
            if ai <= a_min:
                a_min = ai

    if a_min==1001:
        print("TLE")
    else:
        print(a_min)
          
     
main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,s=map(int,input().split())
listc=[]
listt=[]
for i in range(n):
    c,t=map(int,input().split())
    listc.append(c)
    listt.append(t)
import copy
listct=copy.copy(listt)
for t in listct:
    if t>s:
        listc.pop(listt.index(t))
        listt.pop(listt.index(t))
if len(listt)==0:
    print('TLE')
else:
    print(min(listc))

Submission status: Accepted

Solution code:
N,T=input().split()
min=1001
for i in range(int(N)):
  cost,time=input().split()
  if int(time)<=int(T) and int(cost)<min:
    min=int(cost)
if min==1001:
  print('TLE')
else:
  print(min)

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
ans = float("inf")
for i in range(n):
  x,y = map(int,input().split())
  if t >= y:
    ans = min(ans,x)
if ans == float("inf"):
  print("TLE")
else:
  print(ans)

Submission status: Accepted

Solution code:
n, T = map(int, input().split())
a = set()
min_ = 1001
for i in range(n):
    c, t = map(int, input().split())
    a.add(c)
    if t <= T and c < min_:
        min_ = c
    a.remove(c)
if min_ == 1001:
    print('TLE')
else:
    print(min_)

Submission status: Accepted

Solution code:
# B - Time Limit Exceeded
N, T = map(int, input().split())
CMINMAX = 10000 #>1000
cmin = CMINMAX
for n in range(N):
    c, t = map(int, input().split())
    if(t <= T):
        if(c < cmin):
            cmin = c

if(cmin == CMINMAX):
    print("TLE")
else:
    print(cmin)

Submission status: Accepted

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

ct = []
for i in range(N):
    ct_input = input()
    ct.append(ct_input)
    

flag = True
cost = 1000
for i in range(N):
    cti = ct[i]
    cti = cti.split()
    ci = int(cti[0])
    ti = int(cti[1])
    if T < ti:
        continue
    if cost >= ci:
        cost = ci
        flag = False



if flag == True:
    print("TLE")
else:
    print(cost)

Submission status: Accepted

Solution code:

N,T=input().split(' ')
N=int(N)
T=int(T)
a=list()
for i in range(N):
    c,t=input().split(' ')
    c=int(c)
    t=int(t)
    a.append((c,t))

minValue=0x3FF

for it in a:
    if it[1]>T:
        continue
    if it[0]<minValue:
        minValue=it[0]
if(minValue==0x3FF):
    print("TLE")
else:
    print(minValue)

Submission status: Accepted

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

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

cNtN = [[0] * 2 for i in range(N)]
for i in range(N):
    cNtN[i][0], cNtN[i][1] = map(int, input().split())

for i in range(N):
    if cNtN[i][1] > T:
        cNtN[i][0] = float('inf')

min_c = float('inf')
for i in range(len(cNtN)):
    min_c = min(min_c, cNtN[i][0])

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

Submission status: Accepted

Solution code:

import sys
from collections import deque
import copy

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline


def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, T] = [int(input_raw[0]), int(input_raw[1])]
    min_cost = sys.maxint
    for i in range(N):
        input_raw = read_func().strip().split()
        [c, t] = [int(input_raw[0]), int(input_raw[1])]
        if t <= T:
            min_cost = min(min_cost, c)
    if min_cost < sys.maxint:
        print min_cost
    else:
        print "TLE"

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
NT_in = input()
NT = NT_in.split()
N = int(NT[0])
T = int(NT[1])
d = {}
for i in range(N):
	str_num = input()
	num = str_num.split()
	d[int(num[0])] = int(num[1])
for c, t in sorted(d.items(), key=lambda x: x[0]):
	if t <= T:
		print(c)
		break
else:
	print("TLE")

Submission status: Accepted

Solution code:
nt = input().split()
ct = [0]
for i in range(int(nt[0])):
    inp = input().split()
    if int(inp[1]) <= int(nt[1]):
        ct.append(int(inp[0]))
ct.sort()
if len(ct) == 1:
    print("TLE")
else:
    print(ct[1])

Submission status: Accepted

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

x = 0
num = 1
costs = []

while num <= n:
    cost, time = list(map(int, input().split()))
    num += 1
    if TIME - time >= 0:
        costs.append(cost)

if len(costs) != 0:
    output = min(costs)
else:
    output = "TLE"
print(output)

Submission status: Accepted

Solution code:
import sys
a=input()
c=a.split(" ")
c[0]=int(c[0])
c[1]=int(c[1])
b=[input().split(" ") for x in range(c[0])]

for i in range(len(b)):
    for x in range(2):
        b[i][x]=int(b[i][x])



b.sort(key=lambda x:x[1])


if c[1] < b[0][1]:
    print("TLE")
    sys.exit()

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

mini=10000000000
for i in range(len(b)):
    if b[i][1] <= c[1]:
        if b[i][0] <= mini:
            mini=i
print(b[mini][0])

Submission status: Accepted

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

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

m = x[0][0]

for i in range(N):
	if x[i][1]<T+1:
		m = min(m,x[i][0])
t=x[0][1]

for i in range(N):
	t=min(t,x[i][1])

if t<T+1:
	print(m)
else:
	print("TLE")

Submission status: Accepted

Solution code:
N,T = map(int,input().split())
L = list(tuple(map(int,input().split())) for _ in range(N))
print(min((c for c,t in L if t <= T), default='TLE'))

Submission status: Accepted

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

clist = []
tlist = []

for _ in range(N):
  L = list(map(int,input().split(' ')))
  clist.append(L[0])
  tlist.append(L[1])
  
List = [c for c,t in zip(clist,tlist) if t<=T]

if len(List):
  print(min(List))
else:
  print('TLE')

Submission status: Accepted

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

hit = False
cur_cheapest = 1000

for n in range(N):
    c, t = map(lambda x: int(x), input().split(' '))
    if t > T:
        continue
    hit = True
    if c < cur_cheapest:
        cur_cheapest = c

if hit is False:
    print('TLE')
else:
    print(cur_cheapest)

Submission status: Accepted

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


n = n_list[0]
TIME = n_list[1]

x = 0
num = 1
costs = []

while num <= n:
    cost, time = list(map(int, input().split()))
    num += 1
    if TIME - time >= 0:
        costs.append(cost)

if len(costs) != 0:
    output = min(costs)
else:
    output = "TLE"
print(output)

Submission status: Accepted

Solution code:
a = input().split()
n = 1001
for i in range(int(a[0])):
    b = input().split()
    if int(b[0]) < n and int(b[1]) <= int(a[1]):
        n = int(b[0])

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
ans = 1000
ans_f = 0
a,b = map(int,input().split())
for i in range(a):
    c,d = map(int,input().split())
    if d <= b:
        ans_f = 1
        if c < ans:
            ans = c
if ans_f == 1:
    print(ans)
else:
    print('TLE')

Submission status: Accepted

Solution code:
import sys
N, M = map(int, raw_input().split())
a = []
b=[]
res=1000
flag=0
for i in sys.stdin:
    b=i.split()
    b[0]=int(b[0])
    b[1]=int(b[1])
    if M >=b[1] and res >=b[0]:
        res=b[0]
        flag=1

if flag==1:
    print res
else:
    print "TLE"

Submission status: Accepted

Solution code:
import sys

N, T = sys.stdin.readline().strip().split()
N = int(N)
T = int(T)

min_cost = 99999999999
for line in sys.stdin.readlines():
    c, t = line.strip().split()
    c = int(c)
    t = int(t)
    if t <= T:
        if c < min_cost:
            min_cost = c

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

Submission status: Accepted

Solution code:
# coding:utf-8

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input = raw_input().split(" ")
N = int(input[0])
T = int(input[1])

c = []
t = []


for i in range(0, N):
    ct = raw_input().split(" ")
    c.append(int(ct[0]))
    t.append(int(ct[1]))

for i in range(0, len(c)):
    mincost = min(c)
    minindex = c.index(mincost)

    if t[minindex] <= T:
        print mincost
        sys.exit()
    else:
        c.pop(minindex)
        t.pop(minindex)
        if len(c) == 0:
            print 'TLE'
        continue

Submission status: Accepted

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

c_min = 1001
for w in way:
    if w[1] <= t_limit:
        if c_min > w[0]:
            c_min = w[0]

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

Submission status: Accepted

Solution code:
num,limit=input().strip().split(' ')


costs=[]
for i in range(int(num)):
    cost, time = input().strip().split(' ')
    if (int(time) > int(limit)):
        continue
    else:
        costs.append(int(cost))
if costs:
    print(min(costs))
else:
    print('TLE')

Submission status: Accepted

Solution code:
import numpy as np

dat0 = input().split()
N = int(dat0[0])
T = int(dat0[1])

dat1 = [input().split() for i in range(N)]

dat = np.array(dat1)
dat = dat.astype(np.int64)



lt_T = dat.T[1] <= T

ans = dat.T[0][lt_T]

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

Submission status: Accepted

Solution code:
N,T = map(int, input().split())
grid = []
ans = 100000
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    if array[1] <= T:
      ans = min(ans,array[0])
if ans == 100000:
  print('TLE')
else:
  print(ans)

Submission status: Accepted

Solution code:
pair = []

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

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

ans = (1001,1001)
for tup in pair:
    if tup[1] <= T:
        if ans[0] > tup[0]:
            ans = tup

if ans[0] == 1001:
    print('TLE')
else:
    print(ans[0])

Submission status: Accepted

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

cost = 1001
for i in range(N):
    c,t = [int(i_r) for i_r in input().split()]
    if t <= T and c < cost:
        cost = c

print(cost if cost != 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())
min_cost = 1001
for i in range(N):
    if t[i]<=T:
        min_cost = min(c[i],min_cost)
if min_cost == 1001:
    print("TLE")
else:
    print(min_cost)

Submission status: Accepted

Solution code:
n, T = [int(x) for x in input().split()]
cost = 2000

for _ in range(n):
  c, t = [int(x) for x in input().split()]
  if t <= T:
  	cost = min(cost, c)

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

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)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
result=1001
for i in range(n):
    ci,ti=map(int,input().split())
    if ti > t:
        pass
    else:
        result=min(result,ci)
if result==1001:
    print('TLE')
else:
    print(result)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, T = map(int, raw_input().split())
a = []
ans=10000
for i in range(N):
    a.append(map(int, raw_input().split()))
# print a
for i in range(N):
    # print i
    if ans>a[i][0] and T>=a[i][1]:
        ans=a[i][0]
if ans<10000:
    print ans
else:
    print "TLE"

Submission status: Accepted

Solution code:
N,T=list(map(int,input().split()))
cost_list=[]
time_list=[]
for i in range(N):
    c,t=list(map(int,input().split()))
    cost_list.append(c)
    time_list.append(t)
while 1:
    min_cost=min(cost_list)
    min_index=cost_list.index(min_cost)
    if time_list[min_index]<=T:
        print(min_cost)
        break
    else:
        del time_list[min_index]
        del cost_list[min_index]
        if cost_list==[]:
            print("TLE")
            break

Submission status: Accepted

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

c_list = []
t_list = []
min_c = 1000
n_append = 0
argmin_c = None
for _ in range(n):
    c_i, t_i = map(int, input().split())
    
    if t_i <= t:
        c_list.append(c_i)
        t_list.append(t_i)
        n_append += 1
        if min_c >= c_i:
            min_c = c_i
            argmin_c = len(c_list) - 1 

if n_append > 0:
    print(c_list[argmin_c])
else:
    print("TLE")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,t = (int(_) for _ in input().split())

pc = 1001
for i in range(n):
    cc,ct = (int(_) for _ in input().split())
    if (ct <= t and cc < pc):
        pc = cc

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

Submission status: Accepted

Solution code:
N, T = list(map(int, input().split()))
ans = -1
for i in range(N):
    c, t = list(map(int, input().split()))
    if t<=T:
        if ans==-1:
            ans = c
        elif c<ans:
            ans = c 

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

Submission status: Accepted

Solution code:
n,t = map(int, input().split())
cc = 10000
for i in range(n):
    ci, ti = map(int, input().split())
    if ti <= t:
        if ci <= cc:
            cc = ci
if cc > 1000:
    print('TLE')
else:
    print(cc)

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
ans = [-1,100000000000000]
for i in range(a[0]):
	ct = list(map(int,input().split()))
	if ct[1] <= a[1]:
		if ct[0] < ans[1]:
			ans = [i,ct[0]]
		
	
if ans[0]<0:
	print('TLE')
else:
	print(ans[1])

Submission status: Accepted

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

Submission status: Accepted

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

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

if T < min(t):
  print('TLE')

else:
  Answer = 1000
  for i in range(N):
    if t[i] <= T and c[i] <= Answer:
      Answer = c[i]
  print(Answer)

Submission status: Accepted

Solution code:
# coding : utf-8

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

c = [i for i in range(N)]
t = [i for i in range(N)]

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

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

if a == 9999:
    print('TLE')
else:
    print(a)

Submission status: Accepted

Solution code:
N, T = [int(i) for i in input().split()]
ans = 1500
for i in range(N):
    c1, c2 = [int(j) for j in input().split()]

    if c2 <= T:
        ans = min(c1,ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect


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

pairs = []
for i in range(N):
	_c, _t = map(int, raw_input().split())
	pair = [_c, _t]
	pairs.append(pair)

pairs = sorted(pairs, key=lambda x:x[1])
idx = bisect.bisect_right([i[1] for i in pairs], T)
res = sorted(pairs[:idx], key=lambda x:x[0])
if res == []:
	print "TLE"
else:
	print res[0][0]

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
m=10000
for i in range(n):
  a,b=map(int,input().split())
  if b>t: continue
  m = min(m, a)
print(m if m!=10000 else 'TLE')

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
ct = []
ctls = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
	if ctls[i][1] > t:
		ans = "TLE"
	else:
		ct.append(ctls[i][0])
if ct == []:
	print(ans)
else:
	print(min(ct))

Submission status: Accepted

Solution code:
#encoding utf-8
from operator import itemgetter


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

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

time_flag = 0
for i in range(len(ct)):
    if ct[i][1] <= t:
        time_flag += 1
    else:
        ct[i][0] = 1001

ct0=list(ct)
ct.sort(key=itemgetter(0))
# print(ct)

if time_flag == 0:
    print("TLE")
else:
    print(ct[0][0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections
import sys
import numpy as np
from operator import itemgetter

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

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

ct.sort(key=itemgetter(0), reverse=False)
for i in range(N):
    if ct[i][1] <= T:
        print(ct[i][0])
        sys.exit()
print("TLE")

Submission status: Accepted

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

tmp = [input().split() for i in range(n)]
c = 1001
for i in range(n):
  #print(tmp[i])
  ctmp, ttmp = tmp[i]
  if int(ttmp) <= t and int(ctmp) < c:
    c = int(ctmp)
    
if c == 1001:
  print("TLE")
else:
  print(c)

Submission status: Accepted

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

cost = 1000
if T < min(t):
    print("TLE")
else:
    for i in range(N):
        if t[i] <= T:
            if c[i] <= cost:
                cost = c[i]
    print(cost)

Submission status: Accepted

Solution code:
N,T  = map(int,input().split())
AnsC = 9999
for item in range(N):
    C = input().split()
    if int(C[1]) <= T:
        AnsC = min(AnsC,int(C[0]))
        
#print(AnsC)
#print(T)
if AnsC >= 1001:
    print ("TLE")
else:
    print(AnsC)

Submission status: Accepted

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

carr = []
carr2 = []
tarr = []

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

for y in range(N):
    if tarr[y] <= T:
        carr2.append(carr[y])

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

Submission status: Accepted

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

cost_list = []

for i in range(len(list)):
    if list[i][1] <= T:
        cost_list.append(list[i][0])

if len(cost_list) >= 1:
    print(min(cost_list))
elif len(cost_list) == 0:
    print('TLE')

Submission status: Accepted

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

lf = list(filter(lambda x: x[1] <= T, l))

if(len(lf) == 0):
    print('TLE')
else:
    ls = sorted(lf, key=lambda x: x[0])
    print(ls[0][0])

Submission status: Accepted

Solution code:
route_num, limit = map(int, input().split(' '))

costs = []
spends = []
for i in range(route_num):
    cost, spend = map(int, input().split(' '))
    costs.append(cost)
    spends.append(spend)

min_cost = 2000
for cost, spend in zip(costs, spends):
    if spend <= limit and cost < min_cost:
        min_cost = cost

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

Submission status: Accepted

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

for _ in range(n):
    a,b = map(int,input().split())
    if b <= t:
        less.append(a)

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

Submission status: Accepted

Solution code:
N, T = map(int, raw_input().split(' '))
C = 1001

for i in range(N):
    c, t = map(int, raw_input().split(' '))
    if t <= T:
        C = min(c, C)
if C==1001:
    print 'TLE'
else:
    print C

Submission status: Accepted

Solution code:
import numpy as np


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

s = np.array([])

for i in range(N):
    s = np.append(s, np.array(list(map(int, input().split()))))

s = s.reshape((N, 2))

pos = np.where(s[:, 1] <= T)

if pos[0].shape == (0,):
    print('TLE')
else:
    print(int(np.sort(s[pos], axis=0)[0][0]))

Submission status: Accepted

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

inp = input().split(' ')
N = int(inp[0])
T = int(inp[1])
flag = False
ans_cost = 1001

for i in range(N):
    inp = input().split(' ')
    c = int(inp[0])
    t = int(inp[1])
    
    if t <= T:
        if ans_cost >= c:
            flag = True
            ans_cost = c

if flag == True:
    print(ans_cost)
else:
    print('TLE')

Submission status: Accepted

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

Submission status: Accepted

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

idx = 0
minc = 1001

while idx < n:
    rc, rt = map(int, input().split())
    if rt <= l_time:
        if rc < minc:
          minc = rc
    idx = idx + 1

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

Submission status: Accepted

Solution code:
a=input().split()
min=1001
for i in range(int(a[0])):
    aa=input().split()
    if int(aa[1])<=int(a[1]) and int(aa[0])<min:
        min=int(aa[0])
if min==1001:
    print("TLE")
else:
    print(min)

Submission status: Accepted

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


ret = 10**10

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

if ret == 10**10:
    ret = "TLE"

print(ret)

Submission status: Accepted

Solution code:
import numpy as np
n, T = map(int, input().split())
array = np.zeros((0, 2))

for i in range(n):
    #print(np.array(list(map(int, input().split()))))

    array = np.r_[array, np.array(list(map(int, input().split()))).reshape(-1, 2)]

idx = np.argsort(array[:, 0])
array = array[idx]
result = 'TLE'
for c, t in array:
    if t <= T:
        result = int(c)
        break
    

print(result)

Submission status: Accepted

Solution code:
nt = []
nt = list(map(int, input().split()))

grid = []
for i in range(nt[0]):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)

c = 1001
for pair in grid:
    if pair[1] <= nt[1]:
        if pair[0] < c:
            c = pair[0]

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin

N, T = [int(x) for x in stdin.readline().rstrip().split()]
keiro = [[0] * 2 for i in range(N)]
keiro = []
check = 0

for i in range(N):
    c, t = [int(x) for x in stdin.readline().rstrip().split()]
    if t <= T:
        keiro.append([c,t])

if keiro == []:
    print("TLE")
    exit()

keiro_s = sorted(keiro)

print(keiro_s[0][0])

Submission status: Accepted

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

flag = False
for i in range(N):
    if t[i] <= T:
        flag = True

if flag == False:
    print("TLE")

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

if flag == True:
    print(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()
while(len(L) > 0 and L[0][1] > T):
    L.pop(0)
if L.__len__() == 0:
    print("TLE")
else:
    print(L[0][0])

Submission status: Accepted

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

k=[]

for x in range(n):
  if (int(l[x][1]) <= t):
    k.append(int(l[x][0]))
  
if (k==[]):
  print('TLE')
else:  
  print(min(k))

Submission status: Accepted

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

Submission status: Accepted

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


min_c,min_t=map(int, input().split())
result_c=min_c
result_t=min_t

for i in range (n-1):
    ci,ti=map(int, input().split())
    if ci<result_c and ti<=t:
        result_c=ci
        result_t=ti
        
if result_t<=t:
    print(result_c)
else:
    print("TLE")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: utf-8
N,T=map(int,input().split())
ans_t=1001
i=0
for i in range(N):
    c,t=map(int,input().split())
    if(t<=T):
        if(c<ans_t):
            ans_t=c
if(ans_t!=1001):
    print(ans_t)
else:
    print("TLE")

Submission status: Accepted

Solution code:
import sys

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

min_c = 1e4
has_root = False
for i in range(n):
    ci, ti = map(int, input().split())
    if ti > t:
        continue
    if ci < min_c:
        min_c = ci
        has_root = True


if has_root:
    print(min_c)
else:
    print('TLE')

Submission status: Accepted

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

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

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


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

Submission status: Accepted

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

nums=[]
for ct in cts:
    if ct[1] > T:
        continue
    nums.append(ct[0])
if len(nums) == 0:
    print("TLE")
else:
    print(min(nums))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N, T = map(int, input().split())

i = 0

num = 0
minCost = 1001

for i in range(N):
    c, t = map(int, input().split())
    
    if t <= T:
        if c < minCost :
           num = i + 1
           minCost = c;

if num > 0:
    print(minCost)
else:
    print('TLE')