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

Solution (Python):


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

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


if __name__ == '__main__':
    solve()

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

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

c = []
t = []

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

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

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

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

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

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

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

    return ans if ans != 10000 else "TLE"


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

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

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

c = []
cmin = []

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

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

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

Solution (Python):

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

minC = 1001

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

print(mncst)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):

read_line = input().split()
route_count = int(read_line[0])
permit_time = int(read_line[1])

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

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

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

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

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

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

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

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

if __name__ == '__main__':
    main04()

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

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

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

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

Solution (Python):
N, T = map(int,input().split())
ans = float("inf")

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

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

Solution (Python):
N, T = map(int,input().split())
ans = float("inf")

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

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

Solution (Python):
I=lambda:map(int,input().split())
n,t=I()
k=[c for c,s in[(I())for _ in [0]*n]if s<=t]
print(min(k)if k!=[]else"TLE")

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

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

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


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


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



def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)



def lcm(a, b):
    g = gcd(a, b)
    return a / g * b

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

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

if __name__ == '__main__':
    main()

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

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

least = 10000

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

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

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

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

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

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

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

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


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

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

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

print(ans)

Solution (Python):


"""Describe
"""

import numpy as np

STR_TLE = 'TLE'

def get_min_cost(costs_, times_, max_time):
    """Get the minimum cost for required maximum time allowed.
    """

    costs = np.array(costs_)
    times = np.array(times_)
    filt = np.less_equal(times, max_time)
    costs = costs[filt]
    if len(costs) == 0:
        return STR_TLE
    else:
        return str(min(costs))

def main():
    n, t = map(int, input().split())
    costs, times = [], []
    for i in range(n):
        c_, t_ = map(int, input().split())
        costs.append(c_)
        times.append(t_)
    print(get_min_cost(costs, times, t))
        

main()

Solution (Python):
n, tl = map(int,input().split())
ans = 1200 
for i in range(n):
    c, t = map(int,input().split())
    if c<ans and t<=tl:
        ans = c
if ans == 1200:
    print('TLE')
else:
    print(ans)

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

Solution (Python):
n, limit = map(int, input().split())
x = []
for _ in range(n):
  c, t = map(int, input().split())
  x.append((c, t))

y = min((c for c, t in x if t <= limit), default=0)
if y:
  print(y)
else:
  print('TLE')

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

cs = []
ts = []
minc = None

for i in range(N):
    tempc,tempt = map(int,input().strip().split())
    cs.append(tempc)
    ts.append(tempt)
    if tempt <= T:
        if minc is None or tempc < minc:
            minc = tempc

if minc is not None:
    print(minc)
else:
    print('TLE')

Solution (Python):
import sys

C_MAX = 1000 + 1

if __name__ == "__main__":
    N, T = map(int, input().split())

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

    min_cost = C_MAX 

    for c, t in input_list:
        if t <= T and c < min_cost:
            min_cost = c

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

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

min_cost = 100000000

for i in range(N):
  cost, time = map(int, input().split())
  if time <= T and cost < min_cost:
    min_cost = cost
    
if min_cost is 100000000:
  print('TLE')
else:
  print(min_cost)

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

ans = None

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

print(ans if ans else 'TLE')

Solution (Python):
n, t = map(int, input().split())
min = 1001
for i in range(n):
    ci, ti = map(int, input().split())
    if ti <= t and ci < min:
        min = ci
if min == 1001:
    print("TLE")
else:
    print(min)

Solution (Python):
def a():
    n=list(map(int, input().split()))
    c=list()
    t = list()
    for i in range(n[0]):
        s = list(map(int, input().split()))
        c.append(s[0])
        t.append(s[1])
    z=list()
    z[len(z):]=t[:len(t)]
    z.sort()
    if z[0]>n[1]:
        print("TLE")
        return 0
    l=0
    for i in range(1,len(c)):
        if (c[i]<=c[l]) & (t[i]<=n[1]):
            l = i
    print(c[l])
    return 0
a()

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

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

if(c==1001):
  print("TLE")

if(c!=1001):
  print(c)

Solution (Python):
n, t_ = map(int, input().split())
cost_min = 1000
flag = 0
for _ in range(n):
    c,t = map(int, input().split())
    if t <= t_:
        cost_min = min(cost_min, c)
        flag = 1

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

Solution (Python):
N, T = (input().split())
N = int(N)
T = int(T)
road = []
for i in range(N):
    c, t = input().split()
    t = int(t)
    if t in range(1, T + 1):
        road.append((int(c), t))
if len(road) == 0:
    print("TLE")
else:
    road.sort()
    print(road[0][0])

Solution (Python):
N,T = (input().split())
N = int(N)
T = int(T)
roads = []
for i in range(N) :
    c , t = input().split()
    t = int(t)
    if t in range (1, T + 1):
        roads.append((int(c) ,t))

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

Solution (Python):
n,T=map(int, input().split())

x=[]

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

Solution (Python):
n,T=map(int, input().split())

x=[]

for i in range(n):
    c,t=map(int, input().split())
    if t<=T:
        x.append((i+1,c))
        
x.sort(key=lambda tup: tup[1])
if len(x)!=0:
    print(x[0][1])
else:
    print('TLE')

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


min_cost=-1
for _ in range(N):
    cost,time=map(int,input().split())
    if(time<=T):
        if(min_cost==-1 or cost <min_cost):
            min_cost=cost

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

Solution (Python):
n,t=input().split()
N=int(n)
T=int(t)
i=0
v=0
while i<N:
    x=input().split()
    y=[int(i) for i in x]
    if y[1]<=T:
        if v==0:
            m=y[0]
        if y[0]<=m:
            m=y[0]
            v=1
    i+=1
if v!=0:
    print(m)
else:
    print('TLE')

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

c=1200
for i in l:
    if (i[1])<=t:
        c=min(c,i[0])
if c<=1000:
    print(c)
else:
    print('TLE')

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

Solution (Python):
N , T = map(int, input().split())
cost = []
error=[]
x = []
for i in range( N ):
    x.append([int(z) for z in input().split()])
for i in range (len(x)):
    if x[i][1]<=T :
        cost.append(x[i][0])
    if x[i][1] > T:
        error.append(x[i][1])
if len(error) == N :
    print("TLE")
else:
    print(min(cost))

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

res = 10000

for i in range(N):
  if L[i][1] <= T:
    if res > L[i][0]:
      res = L[i][0]
     
if res == 10000:
  res = 'TLE'
print(res)

Solution (Python):
s = input().split()
N = int(s[0])
T = int(s[1])
c_min = 1000
count = 0
for i in range(N):
    d = input().split()
    c = int(d[0])
    t = int(d[1])
    if t <= T:
        count += 1
        if c_min >= c:
            c_min = c

if count == 0:
    print('TLE')
else:
    print(c_min)

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

k = [list(map(int, input().split())) for i in range(n)]
"""
114514 810
931 893
364 364

c1=k[0][0] t1=k[0][1]
"""
m=[]
for i in range(n):
    if t >= k[i][1]:
        m.append(k[i][0])

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

Solution (Python):
N, T = (int(i) for i in input().split())
A = [[int(i) for i in input().split()] for i in range(N)]
c = [0]
for i in range(N):
    if A[i][1] <= T:
        c.append(A[i][0])
    c = sorted(c)

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

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

route = []
cnt = 0
for i in range(N):
	if ntlist[i][1] <= T:
		route.append(ntlist[i][0])
	else:
		cnt += 1

if cnt == N:
	print("TLE")
	exit()
	
print(min(route))

Solution (Python):
N,T= [int(x) for x in input().split()]
c=0
t=0
z=0
x=0
mini=0
lcost=[]
ltime=[]
cost=[]
time=[]
for i in range(N):
    c,t=[int(x) for x in input().split()]
    cost.append(c)
    time.append(t)
for i in time:
    z+=1
    if i <= T:
        ltime.append(i)
        lcost.append(cost[z-1])

if ltime==[] and lcost==[]:
    print("TLE")
else:
    
    for i in lcost:
        if x==0:
           mini=i
           x+=1
        if i < mini:
           mini=i
    print(mini)

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

ct=[]
for i in range(N):
    ct.append(list(map(int, input().strip().split(' '))))
    
tle=True
c=100000000

for i in range(N):
    if ct[i][1]<=T:
        tle=False
        c=min(c,ct[i][0])
        
if tle:
    print('TLE')
else:
    print(c)

Solution (Python):
x=list(map(int,input().split()))
ww=[]
min=x[1]
flag=0
min2=100000


for i in range(x[0]):
    ww.append([])
    ww[i] = list(map(int, input().split()))
    if ww[i][1]<=min:
        if ww[i][0]<min2:
            min2=ww[i][0]



    else:
       flag+=1
if flag== x[0]:
    print("TLE")
else:
    print(min2)

Solution (Python):
n,t = map(int, raw_input().split())
a=10000
for i in range(n):
    ci, ti = map(int, raw_input().split())
    if ti <=t and ci<a:
        a=ci
if a==10000:
    print"TLE"
else:
    print a

Solution (Python):
def main():
    N, T = [int(e) for e in input().split()]

    c_t_pairs = []
    for _ in range(N):
        c, t = [int(e) for e in input().split()]
        c_t_pairs.append((c, t))
    

    ok_c = []
    for pair in c_t_pairs:
        c, t = pair
        if t <= T:
            ok_c.append(c)
    if ok_c:
        print(min(ok_c))
    else:
        print("TLE")


if __name__ == '__main__':
    main()

Solution (Python):
N,T= map(int, input().split())
A=[]

for i in range(N):
	ci,ti=map( int,input().split())
	if ti<=T:
		A.append(ci)
		
if len(A)==0:
	print("TLE")
	
else:
	print(min(A))

Solution (Python):
route=[]
cost=[]
error=[]
best=[]
N,T=map(int,input().split())
for i in range(N):
    route.append([int(j) for j in input().split()])

for i in range(len(route)):
    if route[i][1]<=T:
        cost.append(route[i][0])
    if route[i][1]>T:
        error.append(route[i][1])
    

        
if len(error)==N:
    print("TLE")
else:
    print(min(cost))

Solution (Python):
N,T=input().split()
a=0
b=0
for i in range(int(N)):
    c,t=input().split()
    if int(t)<=int(T):
        if b==0:
            a=c
            b+=1
        if int(c)<int (a):
            a=c
            i+=1
if a==0:
    print("TLE")
else :
    print(a)

Solution (Python):
N,T=input().split()
aaaaaaaaaaaaaaaaaaaaaa=0
b=0
for i in range(int(N)):
    c,t=input().split()
    if int(t)<=int(T):
        if b==0:
            aaaaaaaaaaaaaaaaaaaaaa=c
            b+=1
        if int(c)<int (aaaaaaaaaaaaaaaaaaaaaa):
            aaaaaaaaaaaaaaaaaaaaaa=c
            i+=1
if aaaaaaaaaaaaaaaaaaaaaa==0:
    print("TLE")
else :
    print(aaaaaaaaaaaaaaaaaaaaaa)

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

Solution (Python):
N, T=map(int, input().split())
 
c_list=[]
t_list=[]
ans_list=[]
for i in range(N):
  c,t=map(int, input().split())
  c_list.append(c)
  t_list.append(t)
 
ct_dict=dict(zip(c_list, t_list))  
  
if T<=min(t_list):
  print("TLE")
else:
  for k,v in ct_dict.items():
    if v<=T:
      ans_list.append(k)
 
  print(min(ans_list))

Solution (Python):
route=[]
cost=[]
error=[]

N,T=map(int,input().split())
for i in range(N):
    route.append([int(j) for j in input().split()])

for i in range(len(route)):
    if route[i][1]<=T:
        cost.append(route[i][0])
    if route[i][1]>T:
        error.append(route[i][1])
    

        
if len(error)==N:
    print("TLE")
else:
    print(min(cost))

Solution (Python):
N,T=map(int,input().split())
cmin=1001
for i in range(N):
    cn,tn=map(int,input().split())
    if tn<=T and cn<cmin:
        cmin=cn
if cmin!=1001:
    print(cmin)
else:
    print("TLE")

Solution (Python):
a, b = map(int,input().split())
list1=[]
list2=[]
for i in range (a):
     x,y=map (int,input().split())
     list1.append(x)
     list2.append(y)
mini= 0x3f3f3f3f
for i in range (a) :
    if list1[i] < mini and list2[i] <= b :
        mini=list1[i]

if (mini!= 0x3f3f3f3f):
    print(mini)
else :
    print ("TLE")

Solution (Python):
n, t = map(int, input().split())
path_lst = []
for i in range(n):
    ci, ti = map(int, input().split())
    path_lst.append((ci, ti))
possible_lst = [path_lst[i][0] for i in range(n) if path_lst[i][1] <= t]
if possible_lst == []:
    print("TLE")
else:
    print(min(possible_lst))

Solution (Python):
N,T=map(int,input().split())
dict0 = {}
cost = 1001
for i in range(N) :
    ci,ti=map(int,input().split())
    dict0[ci]=ti
for c in dict0:
    t =dict0[c]
    if t <= T :
        if c <= cost :
            cost = c
if cost < 1001 : print(cost)
else : print("TLE")

Solution (Python):
inputs=input().split()
N=int(inputs[0])
T=int(inputs[1])
q=[]

for i in range (N):
    inputs=input().split()
    q.append((int(inputs[0]),int(inputs[1])))
q.sort()
f=True
for i in range (N):
    v=q[i][0]
    b=q[i][1]
    if b <= T:
        T=b
        f=True
        break
    else :
        f= False
        



if f== True :   
     print (v)
else :
     print("TLE")

Solution (Python):
no_of_routes,time_limit=map(int,input().split())
 
smallest_cost=0
for i in range (no_of_routes):
    costs,times=map(int,input().split())
    if times<=time_limit and smallest_cost==0 :
        smallest_cost=costs
    if times <= time_limit and costs<=smallest_cost:
        smallest_cost = costs
 
if smallest_cost==0:
    print("TLE")
else :
    print(smallest_cost)

Solution (Python):
N,T=list(map(int ,input().split()))
C=[]
for i in range(N):
    ci,ti=list(map(int ,input().split()))
    if ti <=T :
        C.append(ci)

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

Solution (Python):
n,t=map(int,input(). split())
a = [[int(j) for j in input().split()] for i in range(n)]
a=sorted(a)
z=True
for i in range(n) :
    if a[i][1]<=t :
        print(a[i][0])
        z=False
        break
if  z  :
    print("TLE")

Solution (Python):
n,t=map(int,input().split())
xList=[]

for i in range(n):
    x,y=map(int,input().split())
    if y<=t:
        xList.append(x)
if len(xList)==0:
    print('TLE')
    exit()

minn=xList[0]
for i in xList:
    if i<minn:
        minn=i

print (minn)

Solution (Python):
n,x=map(int,input().split())
minn=19999
for i in range (n):
    c,t=map(int,input().split())
    if t > x:
        continue
    else :
        if c<minn:
            minn=c
if minn<19999 :
    print(minn)
else :
    print("TLE")

Solution (Python):
import sys
N,T=map(int,input().split())
x=[]
h=[]
for i in range (N):
    c,t =map(int,input().split())
    m=tuple([int(c), int(t)])
    x.append(m)
for i in range (N):
          if x[i][1]<=T:
                h.append(x[i][0])

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

Solution (Python):
def LimitedTime(Array , T , N):
    MinC=1001
    for i in range (N):
            if Array[i][1]<=T:
               if Array[i][0]<MinC:
                   MinC=Array[i][0]
    if MinC==1001:
        return 'TLE'
    else:
        return MinC
                
                
                   
                   



TandN=list(map(int ,input().split()))
N=TandN[0]
T=TandN[1]
Array=[[int(j) for j in input().split()]for i in range(N)]
print(LimitedTime(Array , T ,N))

Solution (Python):
n, t = [int(x) for x in input().split()]
result = 1001
for i in range(n):
    a, b = [int(x) for x in input().split()]
    if b <= t and result >= a:
        result = a
if result < 1001:
    print(result)
else:
    print("TLE")

Solution (Python):
numOfRouts,TotTime=map(int,input().split())
cost=[]
time=[]
z=[]
for i in range(numOfRouts):
    a,b=map(int,input().split())
    cost.append(a)
    time.append(b)
    if time[i]<=TotTime:
        z.append(cost[i])
if len(z)==0:
    print("TLE")
else:
    print(min(z))

Solution (Python):
no_of_routes,time_limit=map(int,input().split())

smallest_cost=0
for i in range (no_of_routes):
    costs,times=map(int,input().split())
    if times<=time_limit and smallest_cost==0 :
        smallest_cost=costs
    if times <= time_limit and costs<=smallest_cost:
        smallest_cost = costs

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

Solution (Python):
N,T=map(int,input().split())
c=[]
mn=1001
for i in range(N):
    cost,time=map(int,input().split())
    if time<=T:
        c.append(cost)
for i in c:
    if i<=mn:
        mn=i
if len(c)==0:
    print('TLE')
else:
    print(mn)

Solution (Python):
N,T = map(int,input().split())
l=1003

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


if l==1003:
	print("TLE")
else:
	print(l)

Solution (Python):
n,k=map(int,input().split())
x=[]
for i in range(n):
    a, b = map(int, input().split())
    if b<=k:
        x.append(a)
if len(x)<=0:
    print("TLE")
else:
    print(min(x))

Solution (Python):
n,k=map(int,input().split())
x=[]
for i in range(n):
    a, b = map(int, input().split())
    if b<=k:
        x.append(a)
if len(x)<=0:
    print("TLE")
else:
    print(min(x))

Solution (Python):
n,k=map(int,input().split())
x=[]
for i in range(n):
    a, b = map(int, input().split())
    if b<=k:
        x.append(a)
if len(x)<=0:
    print("TLE")
else:
    print(min(x))

Solution (Python):
n,k=map(int,input().split())
x=[]
for i in range(n):
    a, b = map(int, input().split())
    if b<=k:
        x.append(a)
if len(x)<=0:
    print("TLE")
else:
    print(min(x))

Solution (Python):
r,k=map(int,input().split())
x=[]
for i in range(r):
    a, b = map(int, input().split())
    if b<=k:
        x.append(a)
if len(x)<=0:
    print("TLE")
else:
    print(min(x))

Solution (Python):
n,k=map(int,input().split())
x=[]
for i in range(n):
    a, b = map(int, input().split())
    if b<=k:
        x.append(a)
if len(x)<=0:
    print("TLE")
else:
    print(min(x))