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:
from sys import stdin

def findPathToHome():
    N, T = [int(x) for x in stdin.readline().rstrip().split()]
    minCst = 1001
    for i in range(N):
        c, t = [int(x) for x in stdin.readline().rstrip().split()]
        if t <= T:
            minCst = min(c, minCst)
    if minCst != 1001:
        print(minCst)
    else:
        print("TLE")

if __name__ == '__main__':
    findPathToHome()

Submission status: Accepted

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

list=[]
P_COST = 0
P_TIME = 1

for i in range(N):
    route = map(int, raw_input().split())
    if route[P_TIME] <= T :
        list.append(route)

#print list

if len(list) == 0:
    print 'TLE'
else:

    opt_route = list.pop()
    
    for route in list:
        if route[P_COST] < opt_route[P_COST]:
            opt_route = route
            
    print opt_route[P_COST]

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
N, T = map(int, input().split())
cost = 10000
for i in range(N):
  ci, ti = map(int, input().split())
  if ti <= T:
    if ci <= cost:
      cost = ci

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

Submission status: Accepted

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

idx = []
for i in range(n):
    if t[i]<=T:
        idx.append(i)

if len(idx)==0:
    print("TLE")
else:
    minCost = c[idx[0]]
    for j in idx:
        if minCost > c[j]:
            minCost = c[j]
    print(minCost)

Submission status: Accepted

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

for i in range(nt[0]):
    ci.append(list(map(int, input().split())))

for i in range(nt[0]):
    if ci[i][1] <= nt[1]:
        costs.append(ci[i][0])

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

Submission status: Accepted

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

costs = []

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

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

Submission status: Accepted

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

c=[]
tli=[]
for i in range(n):
    [tempc, tempt]=[int(i) for i in input().split()]
    c.append(tempc)
    tli.append(tempt)

min=1001
f=0
for i in range(n):
    if tli[i] <= t:
        f=1
        if c[i] < min:
            min=c[i]

if f:
    print(min)
else:
    print("TLE")

Submission status: Accepted

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

ct = [map(int, input().split(' ')) for _ in range(N)]

cost = 1001
for c, t in ct:
    if t <= T and c < cost:
        cost = c

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

Submission status: Accepted

Solution code:
N,T =map(int,input().split())
min_N=1000
min_T=1000
for  i in range (N):
    N_,T_ =map(int,input().split())
    if T_<=T:
        min_T=T_
        if N_<min_N:
            min_N=N_
            
if min_T>T:
    print ('TLE')
else:
    print (min_N)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 1000
changed = False
for _ in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(c, ans)
        changed = True
if changed == False:
    ans = "TLE"
print(ans)

Submission status: Accepted

Solution code:
#B
c_min=1001
N,T=map(int,input().split())
for n in range(N):
    c,t=map(int,input().split())
    if t<=T:
        if c<=c_min:
            c_min=c
if c_min==1001:
    print("TLE")
else:
    print(c_min)

Submission status: Accepted

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

min_cost = 100000
for n in range(N):
    c, t = map(int, input().split())
    if  t > T:
        continue
    if c < min_cost:
        min_cost = c
if min_cost == 100000:
    print('TLE')
else:
    print(min_cost)

Submission status: Accepted

Solution code:
import numpy as np,math,itertools
n,t=map(int,input().split())
ct=[list(map(int,input().split())) for i in range(n)]
p=[]
for i in range(n):
    if ct[i][1]<=t:
        p+=[ct[i][0]]
if p!=[]:print(min(p))
else:print("TLE")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
def solve():
    N, T = map(int, input().split())
    min_c = 'TLE'
    for _ in range(N):
        c, t = map(int, input().split())
        if t <= T:
            if min_c=='TLE' or c<min_c:
                min_c = c
    res = min_c
    return str(res)

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

Submission status: Accepted

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

Submission status: Accepted

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

line = input().split(" ")
n = int(line[0])
t = int(line[1])
i = 0
minc= 10000
for j in range(n):
    line2 = input().split(" ")
    linec = int(line2[0])
    linet = int(line2[1])
    if linet <= t:
        if linec < minc:
            minc = linec

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,T = map(int,input().split())
lists = [list(map(lambda x:int(x),input().split())) for i in range(n)]
min = 9999
for i in range(n):
    if lists[i][1] <= T:
        if lists[i][0] <= min:
            min = lists[i][0]
if min == 9999:
    print("TLE")
else :
    print(min)

Submission status: Accepted

Solution code:
n,T = map(int,input().split())
cos = 1001
for i in range(n):
    ec,et = map(int,input().split())
    if et <= T:
        if cos > ec:
            cos = ec

if cos >= 1001:
    print("TLE")
else:
    print(cos)

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 :
        if min_c > c :
            min_c = c 
if min_c == 1001 :
    print('TLE')
else :
    print(min_c)

Submission status: Accepted

Solution code:
N,T = map(int,input().split())
L = [list(map(int,input().split())) for i in range(N)]
L.sort()
flag = False
for i in range(N):
  if (L[i][1] > T):
    None
  else:
    flag = True
    break
if flag:
  print(L[i][0])
else:
  print('TLE')

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:
N, T = map(int, input().split())
li = []

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

min = float("inf")
for i in li:
    if i[1] <= T:
        if i[0] < min:
            min = i[0]

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

Submission status: Accepted

Solution code:
from sys import stdin
n,t = map(int,stdin.readline().split())
ans = 'TLE' 
a = []
for i in xrange(n):
 x,y = map(int,stdin.readline().split())
 if y <=t:
  a.append(x)
a.sort()
if len(a):
 ans = a[0]
print ans

Submission status: Accepted

Solution code:
head=[int(n) for n in input().split()]
costList=[]

for n in range(head[0]):
    costList.append([int(n) for n in input().split()])

enableList=[]
for cost in costList:
    if cost[1] <= head[1]:
        enableList.append(cost[0])

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, t = [int(s) for s in input().split()]
l = [o[0] for o in [[int(s) for s in input().split()] for _ in range(n)] if o[1] <= t]
if len(l) == 0:
    print("TLE")
else:
    print(min(l))

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 = []
count = 0
for i in range(N):
    if a[i][1] <= T:
        b.append(a[i][0])
        count += 1
if count == 0:
    print('TLE')

else:
    print(min(b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

n, t = [int(_) for _ in input().split()]
inputList = [[ int(_) for _ in input().split()] for _ in range(n)]
sortedList = sorted(inputList, key=lambda x:x[0])

for data in sortedList:
  cc, tt = data
  if tt <= t:
    print(cc)
    sys.exit()

print("TLE")

Submission status: Accepted

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

ans = 10000

for row in keiro:
    c,t = row

    if t <= T:
        ans = min(ans,c)


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

else:
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    n, t = map(int, input().split())
    ct = []
    for i in range(n):
        ci, ti = map(int, input().split())
        ct.append((ci, ti))

    ac = [ci for (ci, ti) in ct if ti <= t]
    if len(ac) == 0:
        print('TLE')
    else:
        print(min(ac))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#coding:utf-8
min_c = 10000
n,T = list(map(int,input().split()))
for i in range(n):
    c,t = list(map(int,input().split()))
    if t <= T and c < min_c:
        min_c = c
if min_c!=10000:
    print (min_c)
else:
    print ('TLE')

Submission status: Accepted

Solution code:
n1,t1=map(int,input().split())
min=10000
for i in range(0,n1):
    c,t=map(int,input().split())
    if t<=t1:
        if min>c:
            min=c
if min==10000:
    print("TLE")
else:
    print(min)

Submission status: Accepted

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

Submission status: Accepted

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

c = [0]*n
t = [0]*n

ans = 1001

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

for i in range(n) :

   if ( t[i] <= time and c[i] < ans ) :
      ans = c[i]

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

Submission status: Accepted

Solution code:
import sys
iN,iT = [int(_) for _ in input().split()]
aData = [[int(_) for _ in sLine.split()] for sLine in sys.stdin.readlines()]
aData = [x for x,y in aData if y <= iT]
if aData:
    print(min(aData))
else:
    print("TLE")

Submission status: Accepted

Solution code:
N, T = list(map(int, input().split()))
pairs = []
for i in range(N):
  c, t = list(map(int, input().split()))
  if t<=T:
    pairs.append((c, t))
if len(pairs)==0:
  print('TLE')
else:
  print(sorted(pairs, key=lambda p:p[0])[0][0])

Submission status: Accepted

Solution code:
import math
from functools import reduce
import collections
import itertools
a = list(map(int,input().split()))
n = a[0]
x = a[1]
li = [list(map(int,input().split())) for i in range(n)]
aa = []#cost
for i in range(n):
    if li[i][1] <= x:
        aa.append(li[i][0])
if len(aa) == 0:
    print("TLE")
else:
    print(min(aa))

Submission status: Accepted

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

min_c = 1001
for i in range(N):
    tmp_c, tmp_t = map(int, raw_input().split())
    if tmp_t <= T and tmp_c < min_c:
        min_c = tmp_c
if min_c == 1001:
    print 'TLE'
else:
    print min_c

Submission status: Accepted

Solution code:
n,t = map(int, input().split())
ct = []
for i in range(n):
  tc, tt = map(int, input().split())
  if tt <= t:
    ct.append(tc)
ct.sort()
if len(ct) != 0:
  print(ct[0])
else:
  print("TLE")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
x=[]
for i in range(N):
  c1=list(map(int,input().split()))
  x.append(c1)
  
x.sort()
for i in range(N):
  if x[i][1]<=T:
    print(x[i][0])
    break
  elif i==N-1:
    print('TLE')
  else:
    continue

Submission status: Accepted

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

r = min(t)
if r > T:
    print("TLE")
    exit()
else:
    m = max(c)
    for i in range(0,N):
        if t[i] <= T:
            if m > c[i]:
                m = c[i]
print(m)

Submission status: Accepted

Solution code:
n = (input().split(" "))
nn = int(n[0])
t = int(n[1])
min = 100000000
ans = 0
for i in range(nn):
    aa = (input().split(" "))
    a = int(aa[0])
    b = int(aa[1])
    if b<=t and min>a:
        ans = a
        min = a
if ans ==0:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, T, CT):
    ctm = list(filter(lambda x: x[1] <= T, CT))
    if ctm:
        return(min(ctm)[0])
    return 'TLE'


def main():
    N, T = read_int_n()
    CT = [read_int_n() for _ in range(N)]
    print(slv(N, T, CT))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

#print(cost_time)

minVal = 1001

for i in  range(N):
  if cost_time[i][1] <= T:
    if  cost_time[i][0] < minVal:
      minVal = cost_time[i][0]

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

Submission status: Accepted

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

Submission status: Accepted

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

a = []
for i in range(n):
    check = list(map(int,input().split(" ")))
    if check[1] <= t:
        a.append(check)

if a == []:
    print("TLE")
else:
    ans = min(a,key = lambda x:x[0])[0]
    print(ans)

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
ans=chk=10000
for i in range(n):
    x,y=map(int,input().split())
    if y<=t: ans=min(ans,x)
print(ans if ans<10000 else "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:
n=list(map(int,input().split()))
answer=1001
for i in range(n[0]):
    a=list(map(int,input().split()))
    if a[0]<answer and a[1]<=n[1]:
        answer=a[0]
if answer==1001:
    print('TLE')
else:
    print(answer)

Submission status: Accepted

Solution code:
import math, string, fractions, heapq, re, array, bisect, sys, random, time, copy
import itertools as it
import collections as cl
import functools as ft

def LI(): return list(map(int, input().split()))
def LI_(): return list(map(lambda x: int(x) - 1, input().split()))
def LF(): return list(map(float, input().split()))
def LS(): return input().split()
def I(): return int(input())
def F(): return float(input())
def S(): return input()


N, T = LI()
C = []
for _ in range(N):
    c, t = LI()
    if t <= T:
        C.append(c)

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

Submission status: Accepted

Solution code:
# coding: utf-8

nt = [int(s) for s in input().strip().split()]
num_of_root = nt[0]
time_limit = nt[1]
min_cost = 1001

for i in range(num_of_root):
    ct = [int(s) for s in input().strip().split()]
    cost = ct[0]
    time = ct[1]
    if time > time_limit:
        continue
    if cost < min_cost:
        min_cost = cost
    
if min_cost == 1001:
    print("TLE")
else:
    print(min_cost)

Submission status: Accepted

Solution code:
N, T = map(int, input().split(" "))
ret = "TLE"
m = 0
for i in range(N):
    c, t = map(int, input().split(" "))
    if (m == 0 or m > c) and t <= T:
        ret = c
        m = c
        
print (ret)

Submission status: Accepted

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

ans = 1001
for _ in range(n):
    cc, tt = list(map(int, input().split()))

    if tt <= t and cc < ans:
        ans = cc

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

Submission status: Accepted

Solution code:
n,T=map(int,input().strip().split())
arr=[]
for _ in range(n):
    c,t=map(int,input().strip().split())
    arr.append((c,t))
arr=sorted(arr,key=lambda x:x[0])
flag=True
for a,b in arr:
    if b<=T:
        flag=True
        print(a)
        break
    else:
        flag=False 
if flag==False:
    print('TLE')

Submission status: Accepted

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

min_c = c_arr[0]
flag = False
for i, v in enumerate(t_arr):
  if v <= T:
    flag = True
    min_c = min(min_c, c_arr[i])

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

Submission status: Accepted

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

Submission status: Accepted

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

way = []

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = float('inf')
for i in range(n):
    if l[i][1] <= t:
        ans = min(ans, l[i][0])

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

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)
flg = 0
ans = []
for i in range(N):
    if t[i] <= T:
        ans.append(c[i])
        flg = 1
if flg==0: print("TLE")
else:
    ans.sort()
    print(ans[0])

Submission status: Accepted

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

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

mincost = 10000
flg = 0
for keiro in keiros:
	if keiro[0] < mincost and keiro[1] <= t:
		mincost = keiro[0]
		flg = 1

if flg == 0:
	print("TLE")
else:
	print(mincost)

Submission status: Accepted

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

Submission status: Accepted

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

[N,T] = map(int,input().split())
ca = 10000
ta = None
for _ in range(N):
    c, t = map(int,input().split())
    
    if c < ca and t <= T:
        ca = c
        ta = t

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

Submission status: Accepted

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

Submission status: Accepted

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

costv = 2000
for i in range(N):
    if CT[i][1]<= T:
        costv = min(costv,CT[i][0])

if costv == 2000:
    print('TLE')
else:
    print(costv)

Submission status: Accepted

Solution code:

NT = input()
N, T = NT.split(" ")

mincost = 1001
mintime = 1001
for i in range(int(N)):

    ct = input()
    c, t = ct.split(' ')
    if int(t) <= int(T) and int(c) < mincost:
        mincost = int(c)
        mintime = int(t)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N, T = map(int, input().split())
best_c = 1001
for i in range(N):
    c, t = map(int, input().split())
    if (t <= T) and (c < best_c):
        best_c = c
if best_c < 1001:
    print(best_c)
else:
    print('TLE')

Submission status: Accepted

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

cs = []; ts = []
for i in range(n):
    cc, tt = list(map(int, input().split(' ')))
    cs.append(cc)
    ts.append(tt)

minc = -1
for i in range(n):
    if ts[i] <= t:
        if minc < 0 or minc > cs[i]:
            minc = cs[i]

if minc < 0:
    print("TLE")
else:
    print(minc)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
li = list(map(int, input().split()))
N = li[0]
L = li[1]
m = 10001
idx = 0
flag=0
for i in range(N):
    li = list(map(int, input().split()))
    if li[1] <= L and li[0]<m:
        m=li[0]
        idx = i
        flag=1

if flag:
    print(m)
else:
    print('TLE')

Submission status: Accepted

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

ans = 10000

for i in range(N):
    A, B = map(int, input().split())
    if B<= T:
        if A<ans:
            ans = A

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

Submission status: Accepted

Solution code:
import sys

lines = sys.stdin.read().split('\n')
nt_text = lines[0].split(' ')
N = int(nt_text[0])
T = int(nt_text[1])

HIGHEST_COST = 1000

smallest_cost = HIGHEST_COST + 1
for i in range(1, N+1):
    ct_text = lines[i].split(' ')
    if int(ct_text[1]) <= T:
        smallest_cost = min(smallest_cost, int(ct_text[0]))

if smallest_cost > HIGHEST_COST:
    print('TLE')
else:
    print(smallest_cost)

Submission status: Accepted

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

ans_cost = 100000
exists = False

for i in range(N):
    inp = list(map(int, input().split()))
    c, t = inp[0], inp[1]
    if t > T or c > ans_cost:
        continue
    ans_cost = c
    exists = True

if exists:
    print(ans_cost)
else:
    print('TLE')

Submission status: Accepted

Solution code:
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(len(cost)==0):
	print("TLE")
else:
	print(min(cost))

Submission status: Accepted

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

min_c = -1
for i in range(N):
    c,t1 = map(int,input().split())
    if t1 <= T:
        if min_c == -1 or min_c > c:
            min_c = c

if min_c == -1:
    print("TLE")
else:
    print(min_c)

Submission status: Accepted

Solution code:
from sys import stdin

N, T = [int(i) for i in stdin.readline().rstrip().split()]
c = []
t = []

for i in range(N):
    tmp1, tmp2 = [int(i) for i in stdin.readline().rstrip().split()]
    c.append(tmp1)
    t.append(tmp2)

ans = 1001
for i in range(len(t)):
    if t[i] <= T and 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())
r=100000
for _ in range(n):
    c,t=map(int,input().split())
    if t<=T:
        r=min(r,c)
print(r if r!=100000 else 'TLE')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def run():
	N, T = (int(x) for x in input().split())
	cost = 1001
	for _ in range(N):
		c, t = (int(x) for x in input().split())
		if t <= T and cost > c:
			cost = c

	print(cost if cost <= 1000 else 'TLE')


if __name__ == '__main__':
	run()

Submission status: Accepted

Solution code:
GI = lambda: int(input()); GIS = lambda: map(int, input().split()); LGIS = lambda: list(GIS())

def main():
    N, T = GIS()

    mnc = float('inf')
    for _ in range(N):
        c, t = GIS()
        if t <= T:
            mnc = min(c, mnc)
    print(mnc if mnc < float('inf') else 'TLE')

main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N, T = map(int, input().split())
    c, t = zip(*(
        map(int, input().split())
        for _ in range(N)
    ))

    INF = float("inf")
    ans = INF
    for _c, _t in zip(c, t):
        if _t <= T:
            ans = min(ans, _c)

    if ans == INF:
        ans = "TLE"

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

R = 9999

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

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

Submission status: Accepted

Solution code:
from sys import stdin

def main():
    N, T = map(int, input().split())
    CT = [tuple(map(int, input().split())) for _ in [0] * N]

    cost = 1001
    for c, t in CT:
        if t <= T:
            cost = min(cost, c)
    if cost == 1001:
        print('TLE')
    else:
        print(cost)

input = lambda: stdin.readline()
main()

Submission status: Accepted

Solution code:
(N, T) = map(int, input().split())
c = []
for i in range(N):
    (tmpc, tmpt) = map(int, input().split())
    if tmpt <= T:
        c.append(tmpc)

if len(c) == 0:
    ans = 'TLE'
else:
    ans = min(c)

print(ans)

Submission status: Accepted

Solution code:
n, tmax = list(map(int, input().split()))
cmin = 10000

for i in range(0, n):
    c, t = list(map(int, input().split()))
    if t <= tmax:
        cmin = min(cmin, c)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    buf = input()
    buflist = buf.split()
    N = int(buflist[0])
    T = int(buflist[1])
    c = []
    t = []
    for i in range(N):
        buf = input()
        buflist = buf.split()
        c.append(int(buflist[0]))
        t.append(int(buflist[1]))
    min = None
    index = None
    for i in range(N):
        if t[i] <= T:
            if min == None:
                min = c[i]
                index = i
            elif c[i] < min:
                min = c[i]
                index = i
    if min == None:
        print("TLE")
    else:
        print(min)

if __name__ == '__main__':
    main()