Problem:


Score : 200 points

Problem Statement

When Mr. X is away from home, he has decided to use his smartwatch to search the best route to go back home, to participate in ABC.

You, the smartwatch, has found N routes to his home.

If Mr. X uses the i-th of these routes, he will get home in time t_i at cost c_i.

Find the smallest cost of a route that takes not longer than time T.

Constraints

All values in input are integers.

1 \leq N \leq 100

1 \leq T \leq 1000

1 \leq c_i \leq 1000

1 \leq t_i \leq 1000

The pairs (c_i, t_i) are distinct.

Input

Input is given from Standard Input in the following format:

N T
c_1 t_1
c_2 t_2
:
c_N t_N

Output

Print the smallest cost of a route that takes not longer than time T.

If there is no route that takes not longer than time T, print TLE instead.

Sample Input 1

3 70
7 60
1 80
4 50

Sample Output 1

4

The first route gets him home at cost 7.

The second route takes longer than time T = 70.

The third route gets him home at cost 4.

Thus, the cost 4 of the third route is the minimum.

Sample Input 2

4 3
1 1000
2 4
3 1000
4 500

Sample Output 2

TLE

There is no route that takes not longer than time T = 3.

Sample Input 3

5 9
25 8
5 9
4 10
1000 1000
6 1

Sample Output 3

5



Sample input:
3 70
7 60
1 80
4 50


Sample output:
4

Submission status: Accepted

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

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)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""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()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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()

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(ti <= T):
    c = min(c,ci)

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

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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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])

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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))
    # print(c_t_pairs)

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

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
N = input().split()
N = [int(n) for n in N]
#print(N)
c = 1001
for i in range(N[0]):
    #print(i)
    data = input().split()
    data = [int(n) for n in data]
    if(data[1]<=N[1]):
        if(data[0] < c):
            c = data[0]

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

Submission status: Accepted

Solution code:
n,t = map(int,input().split(' '))
cost = float('inf')
num = 0
for i in range(n):
    nc,nt = map(int,input().split(' '))
    #print(nc,nt)
    if t >= nt and nc < cost:
        cost = nc
    
if cost == float('inf'):
    print('TLE',end='')    
else:
    print(cost,end='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, T = [int(i) for i in input().split()]
R = [input().split() for i in range(N)]
Clist = [int(i[0]) for i in R if int(i[1]) <= T]
C = 'TLE' if Clist == [] else sorted(Clist)[0]
print(C)

Submission status: Accepted

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

lc = []

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

Submission status: Accepted

Solution code:
n, t = map(int, raw_input().split())
cm = 1000
f = 0
for i in range(n):
    ci, ti = map(int, raw_input().split())
    if ti <= t:
        f = 1
        if ci <= cm:
            cm = ci
if f == 0:
    print "TLE"
else:
    print cm

Submission status: Accepted

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

ret_cost = 1001
ret_time = 1001

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

if ret_time > T:
	print('TLE')
else :
	print(ret_cost)

Submission status: Accepted

Solution code:
Input = input()
li = Input.split(" ")
NT = list(map(int,li))
N = NT[0]
T = NT[1]
i = 1
mi = 9999

while i <= N:
    Input = input()
    li = Input.split(" ")
    a = list(map(int,li))
    c = a[0]
    t = a[1]
    if t <= T and c < mi:
        mi = c
    i += 1

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
li = []
for i in range(a):
    c,d = map(int,input().split())
    if b >= d:
        if li != []:
            if li[0] > c:li = [c,d]
        else:li = [c,d]
if li == []:print("TLE")
else:print(li[0])

Submission status: Accepted

Solution code:
a,b = map(int,input().split())

li = []

for i,n in enumerate(range(a)):
    c,d = map(int,input().split())
    if b >= d:
        if li != []:
            if li[0] > c:
                li = [c,d]
        else:
            li = [c,d]

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

Submission status: Accepted

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

for i in range (0,N):
    c_,t_= map(int, input().split())
    if(t_<=T):#コストが高いものを除外
        c.append(c_)
        t.append(t_)

if( len(t)==0 ):#一つも低コストがない
    print("TLE")
else:
    print(min(c))

Submission status: Accepted

Solution code:
n, t = map(int, input().split(" "))
ct = [list(map(int, input().split(" "))) for _ in range(n)]
valid = [_ct for _ct in ct if _ct[-1] <= t]
if len(valid) > 0:
    print(sorted(valid, key=lambda x: x[0])[0][0])
else:
    print("TLE")

Submission status: Accepted

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

if len(distArray)>1:
    tmp=distArray[1][0]
    for num in range(2,len(distArray)):     
        
        if distArray[num][0]<tmp:   
            tmp=distArray[num][0]       

    print(tmp)
else:        
    print("TLE")

Submission status: Accepted

Solution code:
N , T  = map(int,input().split())
result = 1001
while N > 0:
 a,b = map(int,input().split())
 if b <= T and a < result:
  result = a
 N = N - 1
if result == 1001:
 print('TLE')
else:
 print(result)

Submission status: Accepted

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

for i in range(N):
    cost, time = map(int, input().split())

    if time <= T:
        min_cost = min(cost, min_cost)

if min_cost <= 1000:
    print(min_cost)
else:
    print('TLE')

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
A = list(map(int,input().split()))
N = A[0]
T = A[1]
ans = 999999
for i in range(0,N):
  A = list(map(int,input().split()))
  if T >= A[1]:
    ans = (A[0] if ans > A[0] else ans)
print(ans if ans != 999999 else "TLE")

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N, T = li_input()
    A = []

    for i in range(N):
        A.append(li_input())

    ans = 9999999999999999999

    for a in A:
        c, t = a

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

    if ans != 9999999999999999999:
        print(ans)
    else:
        print("TLE")


main()

Submission status: Accepted

Solution code:
# abc112_b

INITIAL_COST = 1001

def main():

    # costs and times storage
    costs = []
    times = []

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

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

    # map with the routes after reading input
    routes = dict(zip(costs, times))

    current_cost = INITIAL_COST
    for c, t in routes.items():
        if t <= T and c < current_cost:
            current_cost = c

    if current_cost == INITIAL_COST:
        print("TLE")
    else:
        print(current_cost)


if __name__ == "__main__": main()

Submission status: Accepted

Solution code:
d = list(map(int,(input().strip().split(' '))))
N = d[0]
T = d[1]
min = 100000000
for i in range(0, N):
    d = list(map(int,input().strip().split(' ')))
    c = d[0]
    t = d[1]
    if t <= T:
        if min >= c:
            min = c
if min == 100000000:
    print("TLE")
else:
    print(min)

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
i = 0
min_cost = 1000
fg = False
while i < N:
    i += 1
    c, t = map(int, input().split())
    if t <= T:
        if c <= min_cost:
            fg = True
            min_cost = c

if fg:
    print(min_cost)
else:
    print('TLE')

Submission status: Accepted

Solution code:
n, T = map(int, input().split())
ans = 1003
for _ in range(n):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)

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

Submission status: Accepted

Solution code:
import math

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

c_list = []
for i in range(N):
    c1, t1=[int(i) for i in input().split()]
    if t1 <= T:
        c_list.append(c1)

if not c_list:
    print('TLE')
else:
    print(min(c_list))

Submission status: Accepted

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

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

cost_min = max(ct[:,0])
ans = "TLE"
for ct0 in ct:
    cost_i = ct0[0]
    time_i = ct0[1]
    if time_i <= T:
        if cost_i <= cost_min:
            cost_min = cost_i
            ans = cost_min

print(ans)

Submission status: Accepted

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

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

print('TLE')

Submission status: Accepted

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

c = 1001
for i in range(n):
    if e[i][1] <= t:
        c = min(c, e[i][0])
if c <= 1000:
    print(str(c))
else:
    print('TLE')

Submission status: Accepted

Solution code:
#coding: utf-8

n,T = map(int,raw_input().split())
c = []
t = []
for i in range(n):
    c_new, t_new = map(int,raw_input().split())
    c.append(c_new)
    t.append(t_new)

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

c_min = 10000
for i in a:
    if c[i] < c_min: c_min = c[i] 

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