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())
root = []
for i in range(n):
    c,t = map(int, input().split())
    if T >= t:
        root.append(c)
if root == []:
    print("TLE")
else:
    sort_root = sorted(root)
    print(sort_root[0])

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:
        ans = min(ans, c)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,T=map(int, input().split())
minC = 1000
minT = T+1
for i in range(N):
  c,t=map(int, input().split())
  if t<minT:
    minT = t
  if t<=T and c<minC:
    minC = c

if minT<=T:print(minC)
else: print("TLE")

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
ans ="TLE"
ans_list = []
for _ in range(a):
  c,d = map(int,input().split())
  if b >= d:
    ans_list.append(c)

if len(ans_list) != 0:
  ans = min(ans_list)
print(ans)

Submission status: Accepted

Solution code:
N, L =map(int, input().split())
cost = 1001
count = 0
for i in range(N):
  c, t =map(int, input().split())
  if t <= L:
    if c < cost:
      cost = c
      count += 1
  elif t > L:
    continue;
if count == 0:
  print("TLE")
else:
  print(cost)

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 ans >= c:
        ans = c
if ans != 1001:
    print(ans)
else:
    print("TLE")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
ans = 10000
for _ in range(N):
    c, t = map(int, input().split())
    if T >= t:
        if ans > c:
            ans = c
print(ans if ans != 10000 else 'TLE')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = float("inf")

for _ 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)

Submission status: Accepted

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

Submission status: Accepted

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

ans = float("inf")
for _ 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)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    N, T = (int(i) for i in input().split())
    CT = [[int(i) for i in input().split()] for j in range(N)]
    CT.sort()
    for c, t in CT:
        if t <= T:
            return print(c)
    print("TLE")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,T = map(int,input().split())
mn = 10**6
for i in range(n):
    c,t = map(int,input().split())
    if T >= t:
        if mn > c:
            mn = c
print('TLE' if mn==10**6 else mn)

Submission status: Accepted

Solution code:
def main():
    n, max_t = map(int, input().split())
    max_val = 10 ** 9 + 7
    answer = max_val
    for _ in range(n):
        c, t = map(int, input().split())
        if t <= max_t:
            answer = min(answer, c)
    print(answer if answer != max_val else "TLE")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def solve():
    n,t = map(int,input().split())
    mn = 10**9
    ans = False
    for _ in range(n):
        a,b = map(int,input().split())
        if b<=t:
            mn = min(mn,a)
            ans = True
    if ans:
        print(mn)
    else:
        print('TLE')
if __name__=='__main__':
    solve()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,t = LI()
    g = LIR(n)
    g = [i for (i,j) in g if j <= t]
    if not g:
        print("TLE")
    else:
        print(min(g))
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import sys
def main():
    input = sys.stdin.readline
    N,T=map(int, input().split())
    ans=10**10
    for _ in range(N):
        c,t=map(int, input().split())
        if t<=T: ans = min(ans, c)
    print(ans if ans < 10**10 else 'TLE')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 'TLE'
for ci, ti in ct:
    if ti > T: continue
    #
    if ans == 'TLE':
        ans = ci
    else:
        ans = min(ans, ci)

print(ans)

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
ct = [list(map(int, input().split())) for _ in range(N)]
ct.sort()
ans = "TLE"
for c, t in ct:
  if t <= T:
    ans = c
    break
print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, T = MAP()
ct = [LIST() for _ in range(N)]
ct.sort(key=lambda x:(x[0], x[1]))
for c, t in ct:
    if t <= T:
        print(c)
        break
else:
    print("TLE")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N,T = map(int,input().split())
CT = [tuple(map(int,input().split())) for i in range(N)]
INF = float('inf')
ans = INF
for c,t in CT:
    if t <= T:
        ans = min(ans,c)
print('TLE' if ans==INF else ans)

Submission status: Accepted

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

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

if ans < 1005:
    print(ans)
else:
    print("TLE")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
tici=[]
for i in range(n):
    ci,ti=map(int,input().split())
    if(ti<=t):
        tici.append([ci,ti])
if(len(tici)==0):
    print('TLE')
else:
    tici.sort()
    print(tici[0][0])

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
c_t=[]
mincos=1001
for c,t in zip(range(N),range(N)):
    c,t=map(int,input().split())
    if t<=T:
        if c<mincos:
            mincos=c

print("TLE" if mincos>1000 else mincos)

Submission status: Accepted

Solution code:
n, s = map(int, input().split())
c = [0 for i in range(n)]
t = [0 for i in range(n)]
for i in range(n):
    c[i], t[i] = map(int, input().split())
mi = 1001
ans = 0
for i in range(n):
    if s >= t[i] and mi > c[i]:
        mi = c[i]
        ans = c[i]
if ans == 0:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

Solution code:


def solve():

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

    ct = []

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

    ans = 1001

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

    if ans <= 1000:
        print(ans)
    else:
        print("TLE")


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
def main():
    N, T = map(int, input().split())
    ans = 10000
    for _ in range(N):
        c, t = map(int, input().split())
        if t <= T:
            ans = min(ans, c)

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,tt=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())
  if (t[i]<=tt):
    ans=min(ans,c[i])
    
print(ans if (ans<1001) else "TLE")

Submission status: Accepted

Solution code:
N, T=map(int, input().split())
l=[list(map(int, input().split())) for i in range(N)]
c_min=10**3
t_min=10**3

for i in range(N):
    if l[i][1]<=T:
        if l[i][0]<=c_min:
            c_min=l[i][0]
    
    if l[i][1]<=t_min:
        t_min=l[i][1]
    
if t_min > T:
    print("TLE")
else:
    print(c_min)

Submission status: Accepted

Solution code:
# ABC 112: B – Time Limit Exceeded
N, T = [int(s) for s in input().split()]

min_cost = 9999

for _ in range(N):
    c, t = [int(s) for s in input().split()]
    min_cost = min(min_cost, c) if t <= T else min_cost

print(min_cost if min_cost != 9999 else 'TLE')

Submission status: Accepted

Solution code:
def main():
    N, T = map(int, input().split())
    path = [[int(a) for a in input().split()] for i in range(N) ]
    minc = 10000
    for [c, t] in path:
        if t <= T :
            if minc > c:
                minc = c
    if minc == 10000:
        print("TLE")
    else:
        print(minc)
main()

Submission status: Accepted

Solution code:
# solution

n,m=map(int, input().split())
k = 1001
for i in range(n):
    p,j = map(int, input().split())
    if j<=m:k=min(k,p)
print("TLE" if k == 1001 else k)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 10**9
flg = False
for i in range(n):
    c, t = map(int, input().split())
    if T >= t:
        flg = True
        ans = min(ans, c)
if flg: print(ans)
else: print('TLE')

Submission status: Accepted

Solution code:
n, T =map(int, input().split())
ans = 100000
for _ in range(n):
    c, t = map(int, input().split())
    if t <= T and c < ans:
        ans = c
if ans == 100000:
    ans = 'TLE'
print(ans)

Submission status: Accepted

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

ct=sorted(ct, key=lambda x:(x[0],x[1]))

for i in range(N):
    if ct[i][1]<=T:
        print(ct[i][0])
        break
else:
    print('TLE')

Submission status: Accepted

Solution code:
N, T = map(int,input().split())
MIN = 10 ** 8
for _ in range(N):
    c, t = map(int,input().split())
    if t <= T:
        MIN = min(MIN, c)
if MIN == 10 ** 8:
    print('TLE')
else:
    print(MIN)

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
ctn = [list(map(int, input().split())) for _ in range(N)]
ans = 1001
for ct in ctn:
    if ct[1] <= T:
        ans = min(ans, ct[0])
print('TLE' if ans == 1001 else ans)

Submission status: Accepted

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

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


ct=sorted(ct, key=lambda x:(x[0], x[1]))

for i in range(n):
    if ct[i][1]<=t:
        print(ct[i][0])
        break
else:
    print("TLE")

Submission status: Accepted

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

Submission status: Accepted

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

ct_1 = sorted(ct, key=lambda h: (h[0], h[1]))
ct_2 = sorted(ct, key=lambda h: (h[1], h[0]))

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

if ct_2[0][1]>T:
    print('TLE')

Submission status: Accepted

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

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

print("TLE" if cost == float("inf") else cost)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
  c, x = map(int,input().split())
  if x <= t:
    ans.append(c)

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

Submission status: Accepted

Solution code:
N,T,*L=map(int,open(0).read().split())
print(min([1111]+[c for c,t in zip(*[iter(L)]*2)if t<=T])%1111or"TLE")

Submission status: Accepted

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

CT=[[0,0]]*N
i=0
while i<N:
    CT[i]=list(map(int,input().split()))
    i+=1

CT=sorted(CT)

ans='TLE'
for x,y in CT:
    if y<=T:
        ans=x
        break
print(ans)

Submission status: Accepted

Solution code:
n, T = map(int, input().split())
cost = []
time = []
element = []
ans = 1000

for i in range(n):
    c, t = map(int, input().split())
    cost.append(c)
    time.append(t)

for c, t in zip(cost, time):
    if t <= T:
        element.append(c)

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

Submission status: Accepted

Solution code:
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    n,T = map(int,input().split())
    ans = INF
    for _ in range(n):
        c,t = map(int,input().split())
        if t <= T:
            ans = min(ans,c)
    
    if ans == INF:
        print('TLE')
    else:
        print(ans)
if __name__ =='__main__':
    main()

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, acos, atan, asin, log, log10
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def debug(*args):
    if debugmode:
        print(*args)
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def FLOAT(): return float(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]
debugmode = True

n, t = MAP()
ans = inf
for _ in range(n):
    c, tt = MAP()
    if tt <= t:
        ans = min(ans, c)
if ans == inf:
    ans = 'TLE'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
ct = [list(map(int,input().split())) for i in range(n)]
ans = 10**4
for i in ct:
    if i[1] <= t:
        ans = min(ans,i[0])
if ans == 10**4:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

Solution code:
def Time_Limit_Exceeded(n , t , ctl):

    ans = 0
    count = []

    for i in ctl:
        if i[1] <= t:
            count.append(i[0])

    return min(count) if len(count) != 0 else "TLE"

def main():
    n , t = map(int , input().split())
    ctl = [list(map(int , input().split())) for i in range(n)]
    print(Time_Limit_Exceeded(n , t , ctl))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

if not d:
    print("TLE")
else:
    print(d[0][0])

Submission status: Accepted

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

Submission status: Accepted

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

cost=[]

for i in range(n):
    c,time=[int(i) for i in input().split()]
    if time<=limit:
        cost.append(c)
cost.sort()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
line = input()
a, b = [int(n) for n in line.split()]
tempo = b
custo = 1001
tle = True
for n in range(1, a+1):
    line = input()
    c, t = [int(n) for n in line.split()]
    if t<=tempo and c<=custo:
        custo = c
        tle = False

print(custo if tle==False else "TLE")

Submission status: Accepted

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

#print(ci,ti)

lowest=1000

if min(ti)>T:
  print('TLE')
else:
  for i in range(N):
    if ti[i]<=T and ci[i]<=lowest:
      lowest=ci[i]
  print(lowest)

Submission status: Accepted

Solution code:
n, T = map(int, input().split())
out = list()
for _ in range(n):
    c, t = map(int, input().split())
    if t > T: continue
    out.append((c, t))
print(min(out)[0]) if out and min(out)[1] <= T else print("TLE")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
p,q= input().split()
a,b =(int(p), int(q))
ans_list = []
for i in range(a):
    c = input().split()
    if int(c[1]) <= b:
        ans_list.append(int(c[0]))

if len(ans_list) is not 0:
    print(min(ans_list))
else:
    print('TLE')

Submission status: Accepted

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

'''aux=[input().split() for _ in range(N)]
aux.sort()'''

c, aux=[], []
for i in range(N):
	x, y=map(int, input().split())
	
	if(y<=T):
		aux=[[int(x), int(y)]]	
		c.extend(aux)
			

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

Submission status: Accepted

Solution code:
linha = input()
Nvezes,TempoMax = [int(n) for n in linha.split()]
listaCusto = []
listaTempo = []
minimo = 1001
for aux in range(Nvezes):
    entrada = input()
    custo,tempo = [int(n) for n in entrada.split()]
    listaCusto.append(custo)
    listaTempo.append(tempo)
indiceMenor = listaCusto.index(min(listaCusto))
#print("indice menor: " , indiceMenor)
#print(listaTempo)
#print(listaCusto)
if listaTempo[indiceMenor] <= TempoMax:
    print(min(listaCusto))
elif listaTempo[indiceMenor] > TempoMax:
    for posicao, elemento in enumerate(listaCusto):
        if listaCusto[posicao] < minimo and listaTempo[posicao] <= TempoMax:
            minimo = listaCusto[posicao]
    if minimo == 1001:
         print("TLE")
    else:
        print(minimo)

Submission status: Accepted

Solution code:
line = input()
n, t = [int(n) for n in line.split()]
min_coust = 0
route = 0
for _ in range(n):
    line = input()
    coust, time = [int(n) for n in line.split()]
    if min_coust == 0 and time <= t:
        min_coust = coust
    elif time <= t and coust <= min_coust:
        min_coust = coust
ans = "TLE" if min_coust== 0 else min_coust
print(ans)

Submission status: Accepted

Solution code:
fline = input()
it, max_time = [int(n) for n in fline.split()]


cost_time = []
for i in range(it):
    line = input()
    c, t = [int(n) for n in line.split()]
    pair = (c, t)
    cost_time.append(pair)

cost_time.sort(key=lambda x: x[1])
cost_time2 = []
for i in range(it):
    tupl = cost_time[i]
    if(tupl[1]<=max_time):
        cost_time2.append(cost_time[i])

cost_time2.sort(key=lambda x: x[0])
if(len(cost_time2)==0):
    print('TLE')
else:
    el = cost_time2[0]
    print(el[0])

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
menor_t, menor_c = 1000, 1000
index = 0
for i in range(a):
    c, t = map(int, input().split())
    if t <= b:
        if c < menor_c:
            menor_c = c
        index = i + 1
if index == 0:
    print('TLE')
else:
    print(menor_c)

Submission status: Accepted

Solution code:
line = input()
N, T = [int(n) for n in line.split()]
lst = []
for i in range(N):
	cost, time = list(map(int, input().split()))
	if time <= T:
		lst.append(cost)
print('TLE' if len(lst) == 0 else min(lst))

Submission status: Accepted

Solution code:
line = input()
X, Y = [int(n) for n in line.split()]

value = "TLE"
route_cost = []
for _ in range(X):
    line = input()
    cost, time = [int(n) for n in line.split()]
    route_cost.append([cost, time])

route_cost.sort(key=lambda x: x[0])
for cost, time in route_cost:
    if time > Y:
        continue
    else:
        value = cost
        break
print(value)

Submission status: Accepted

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


c = []
t = []

for i in range(N):
    p = input()
    y = p.split(" ")
    if int(y[1]) <= T:
        c.append(int(y[0]))
        t.append(int(y[1]))

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

Submission status: Accepted

Solution code:
def main():
    line = input()
    n, T = [int(x) for x in line.split()]
    lista_tempos = []
    lista_custos = []
    for i in range(n):
        line = input()
        c, t = [int(x) for x in line.split()]
        if t <= T:
            lista_tempos.append(t)
            lista_custos.append(c)
    if lista_tempos:
        print(min(lista_custos))
    else:
        print('TLE')
main()

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
rotas = list()
for _ in range(n):
    n1, t1 = map(int, input().split())
    if t1 <= t:
        rotas.append(n1)
if rotas:
    print(min(rotas))
else:
    print("TLE")

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
M = 10000
for n in range(N):
    c, t = map(int, input().split())
    if T >= t:
        M = min(M, c)
if M == 10000:
    print("TLE")
else:
    print(M)

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
keiro = []
for _ in range(N):
    C, time = map(int, input().split())
    if time <= T:
        keiro.append(C)
keiro.sort()
if len(keiro)>0:
    print(keiro[0])
else:
    print("TLE")

Submission status: Accepted

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

Submission status: Accepted

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

res = 10000
for i in range(n):
  if List[i][1] <= t:
    res = min(res, List[i][0])
if res == 10000:
  print("TLE")
else:
  print(res)

Submission status: Accepted

Solution code:
import sys

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

for i in sorted(d):
    if i[1] <= T:
        print(i[0])
        sys.exit()
else:
    print('TLE')

Submission status: Accepted

Solution code:
N, T = [int(num) for num in input().split()]
costs = []
times = []
for i in range(N):
  c, t = [int(num) for num in input().split()]
  if t <= T:
    costs.append(c)
    times.append(t)
if times == []:
  print("TLE")
else:
  print(min(costs))

Submission status: Accepted

Solution code:
n, T = map(int, input().split())
l = []
for i in range(n):
    c, t = map(int, input().split())
    if not t > T:
        l.append(c)
print("TLE" if len(l) == 0 else sorted(l)[0])

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
p=[]
for i in range(n):
    c,t1=map(int,input().split())
    if t >= t1:
        p.append(c)
if p==[]:
    print('TLE')
else:
    print(min(p))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC-112-B
N, T = map(int, input().split())
ans = 1001
for _ in range(N):
    ci, ti = map(int, input().split())
    if ti <= T:
        ans = min(ans, ci)
        
if ans == 1001:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,T = LI()
ct = [LI() for _ in range(n)]
ct.sort()
for c,t in ct:
    if t <= T:
        print(c)
        quit()
print('TLE')

Submission status: Accepted

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