Problem:


Score : 200 points

Problem Statement

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

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

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

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

Constraints

All values in input are integers.

1 \leq N \leq 100

1 \leq T \leq 1000

1 \leq c_i \leq 1000

1 \leq t_i \leq 1000

The pairs (c_i, t_i) are distinct.

Input

Input is given from Standard Input in the following format:

N T
c_1 t_1
c_2 t_2
:
c_N t_N

Output

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

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

Sample Input 1

3 70
7 60
1 80
4 50

Sample Output 1

4

The first route gets him home at cost 7.

The second route takes longer than time T = 70.

The third route gets him home at cost 4.

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

Sample Input 2

4 3
1 1000
2 4
3 1000
4 500

Sample Output 2

TLE

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

Sample Input 3

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

Sample Output 3

5



Sample input:
3 70
7 60
1 80
4 50


Sample output:
4

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = 10**18
# ----------------------------------------------------------- #

n, T = Is()
CT = TIR(n)
ans = INF
for c, t in CT:
    if t <= T:
        ans = min(ans, c)
if ans == INF:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def main():
    n, m = map(int, input().split())
    A = []
    for i in range(n):
        a, b = map(int, input().split())
        if b <= m:
            A.append(a)
    if len(A) == 0:
        print('TLE')
    else:
        print(min(A))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if costs:
    costs.sort()
    ans = costs[0]
else:
    ans = 'TLE'
print(ans)

Submission status: Accepted

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

cost = float(10000)
for a in a:
    if a[1] <= t and a[0] < cost:
        cost = a[0]

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

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
ans = 10000
for i in range(n):
    cost,time = map(int,input().split())
    if time <= t and cost < ans:
        ans = cost
if ans == 10000:
    ans = "TLE"
print(ans)

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
INF = 10**10
min_c = 10**10
for _ in range(n):
    ci, ti = map(int, input().split())
    if ti > t:
        continue
    min_c = min(ci, min_c)
if min_c == INF:
    print('TLE')
    exit()
print(min_c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
ans = float('inf')
flag = False
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        ans = min(ans, c)
        flag = True

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

Submission status: Accepted

Solution code:
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)
print(ans if ans != float('inf') else 'TLE')

Submission status: Accepted

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


    #print(c)
    if len(c)==1:
        print(c[0])
    elif len(c)==2:
        if c[0]>=c[1]:
            print(c[1])
        else:
            print(c[0])
    else:
        print(min(c))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
ans = []
for i in range(n):
    ci,ti = map(int,input().split())
    if ti > t:
        pass
    else:
        ans.append(ci)
if ans==[]:
    print("TLE")
else:
    print(min(ans))

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,t=map(int, input().split())
    costl=[]
    for i in range(n):
        c,tt=map(int, input().split())
        if tt<=t:
            costl.append(c)
    if len(costl)==0:
        print('TLE')
    else:
        print(min(costl))
resolve()

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,t=map(int, input().split())
    costmin=10000
    for i in range(n):
        c,tt=map(int, input().split())
        if tt<=t:
            costmin=min(c,costmin)
    if costmin==10000:
        print('TLE')
    else:
        print(costmin)
resolve()

Submission status: Accepted

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

min_cost = 10000000

for n in range(N):
  cost, time = map(int, input().split())
  if time <= T:
    if cost < min_cost:
      min_cost = cost
if min_cost == 10000000:
  print("TLE")
else:
  print(min_cost)

Submission status: Accepted

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

ans = float('inf')
for _ in range(N):
    cost, elapsed_time = map(int, input().split())
    if elapsed_time <= T:
        ans = min(ans, cost)
print(ans) if ans != float('inf') else print('TLE')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    ans = float("inf")
    for i in range(N):
        if t[i] <= T and c[i] < ans:
            ans = c[i]

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,tmax=map(int,input().split())
c=[0]*n
t=[0]*n
result=9999
for i in range(0,n):
  c[i],t[i]=map(int,input().split())
  if t[i]<=tmax and c[i]<result:
    result=c[i]
if result==9999:
  print("TLE")
else:
  print(result)

Submission status: Accepted

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

Submission status: Accepted

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

min_cost = 10000

for i in range(N):
    if int(plan[i][1]) <= T:
        min_cost = min(min_cost, int(plan[i][0]))

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

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools
n, t = map(int, input().split())
pair = []
for i in range(n):
    ci, ti = map(int, input().split())
    pair.append([ci, ti])

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

sorted_by_cost = sorted(r, key=lambda x: x[0])

for i in range(n):
    if sorted_by_cost[i][1] <= t:
        print(sorted_by_cost[i][0])
        exit()
print('TLE')

Submission status: Accepted

Solution code:
inf = 10**15
mod = 10**9+7
n,T = map(int, input().split())
minc = inf
for i in range(n):
    c,t = map(int, input().split())
    if t <= T:
        minc = min(minc, c)
if minc == inf:
    print('TLE')
else:
    print(minc)

Submission status: Accepted

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

mi=10**9

for _ in range(n):
    c,tt=map(int,input().split())

    if tt<=t:
        mi=min(mi,c)

if mi!=10**9:
    print(mi)
else:
    print("TLE")

Submission status: Accepted

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

found = False
min_cost = float("inf")
for i in range(N):
    c, t = map(int, input().split())
    if t <= T and c < min_cost:
        min_cost = c
        found = True
print(min_cost if found else "TLE")

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
ans = 1001
for i in range(N):
    C,T2=map(int, input().split())
    if T2 <= T:
        ans = min(ans, C)
print('TLE' if ans==1001 else ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,T = map(int, input().split())
min_cost = 10**9
for i in range(N):
    c,t = map(int, input().split())
    if T >= t and min_cost > c:
        min_cost = c
if min_cost == 10**9:
    print("TLE")
    exit()
print(min_cost)

Submission status: Accepted

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

Submission status: Accepted

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

c_init = 10 ** 4
ans = c_init
for _ in range(n):
    c, t = [int(x) for x in input().split()]
    if (t <= tl) and (c < ans):
        ans = c
if ans == c_init:
    ans = "TLE"
print(ans)

Submission status: Accepted

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

temp_list = []
for _ in range(n):
    c, t = [int(x) for x in input().split()]
    if t <= tl:
        temp_list.append(c)
temp_list.sort()
if len(temp_list) == 0:
    ans = "TLE"
else:
    ans = temp_list[0]
print(ans)

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
C = 1000
x = 0
for i in range(N):
    c, t = map(int, input().split())
    if t <= T and c <= C:
        x = 1
        C = c
if x:
    print(C)
else:
    print("TLE")

Submission status: Accepted

Solution code:

n,t = map(int,input().split())
ct = [list(map(int,input().split())) for i in range(n)]
min_cost = float("inf")
cnt = 0
for i in range(n):
  if ct[i][1] <= t:
    min_cost = min(min_cost,ct[i][0])
    cnt += 1
if cnt != 0:
  print(min_cost)
else:
  print("TLE")

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 = 'TLE'
for _ in range(n):
  c, t = map(int, input().split())
  if t <= T:
    if ans == 'TLE' or c < ans:
      ans = c
print(ans)

Submission status: Accepted

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

for i in range(N):
  t1, t2 = map(int, input().split())
  if t2 <= T and (t1 < res or res < 0):
    res = t1

if res >= 0:
  print(res)
else:
  print("TLE")

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
CT = []
res = -1

for i in range(N):
  t1, t2 = map(int, input().split())
  CT.append([t1, t2])

for ct in CT:
  if ct[1] <= T and (ct[0] < res or res < 0):
    res = ct[0]

if res >= 0:
  print(res)
else:
  print("TLE")

Submission status: Accepted

Solution code:
n,T = map(int,input().split())
cands = [tuple(map(int,input().split())) for _ in range(n)]
cands.sort()
for c,t in cands:
  if t<= T:
    print(c)
    break
else:
  print('TLE')

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
cmin = 10**10
for i in range(n):
  c, ti = map(int, input().split())
  if ti > t:
    continue
  cmin = min(cmin, c)
if cmin == 10**10:
  print('TLE')
else:
  print(cmin)

Submission status: Accepted

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

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n,t = map(int,input().split())
ct_list = [list(map(int,input().split())) for hoge in range(n)]
ans_list = []
for hoge in ct_list:
  if hoge[1] <= t:
    ans_list.append(hoge[0])
if len(ans_list) > 0:
  print(min(ans_list))
else:
  print('TLE')

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

ans = min(map(lambda t: t[0], filter(lambda t: t[1] <= T, [list(map(int, input().split())) for _ in range(N)] + [[1 << 28, 0]])))

print(ans if ans != 1 << 28 else "TLE")

Submission status: Accepted

Solution code:
n,T=map(int,input().split())
data=[input().split() for i in range(n)]
lc=[]
for row in data:
    if int(row[1]) <=T:
        lc.append(row[0])
ls=[int(j) for j in lc]

if not lc:
    print("TLE")
else:
    print(min(ls))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, limit = map(int, input().split())
cost = list()
for _ in range(n):
  c, time = [int(a) for a in input().split()]
  if time <= limit:
    cost.append(c)
print(min(cost) if len(cost) > 0 else 'TLE')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, T: int, c: "List[int]", t: "List[int]"):
    try:
        print(min(ci for ci, ti in zip(c, t) if ti <= T))
    except ValueError:
        print("TLE")


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    c = [int()] * (N)  # type: "List[int]"
    t = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        c[i] = int(next(tokens))
        t[i] = int(next(tokens))
    solve(N, T, c, t)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# ABC112B

n, T = map(int, input().split())
Min = -1
for i in range(n):
    c, t = map(int, input().split())
    if t <= T:
        if Min == -1:
            Min = c
        else:
            Min = min(Min, c)
if Min == -1:
    print('TLE')
else:
    print(Min)

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
ans=1001
for i in range(N):
    a,b=map(int,input().split())
    if b<=T:
        ans=min(ans,a)

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

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(N)]
ans=[]
for list in lists:
  if list[1]<=T:
    ans.append(list)
if len(ans)==0:
  print('TLE')
else:
  ans.sort(key=lambda x:x[0])
  print(ans[0][0])

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7

n,t=MI()
costs=[]
for i in range(n):
    c,ti=MI()
    if ti<=t:
        costs.append(c)
if len(costs)==0:
    print("TLE")
else:
    costs.sort()
    print(costs[0])

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N, T = map(int, input().split())
c = [0] * N
t = [0] * N
for i in range(N): c[i], t[i] = map(int, input().split())
idx = []
ans = 1000
for i in t:
    if i <= T:
        idx.append(t.index(i))
if len(idx) == 0:
    print("TLE")
    exit()
else:
    for i in idx:
        if ans > c[i]:
            ans = c[i]
print(ans)

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
keepcost=10**10
for i in range(0,n):
  c,tt=map(int,input().split())
  if tt<=t:
    if c<keepcost:
      keepcost=c
print([keepcost,"TLE"][keepcost==10**10])

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
res=10**5
for i in range(n):
    a,b=map(int,input().split())
    if b <= t:
        res=min(res,a)
    else:
        continue

if res==10**5:
    print("TLE")
else:
    print(res)

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
ct = []
for i in range(n):
    c, time = map(int, input().split())
    ct.append([c, time])
min_t = t
cost = float('inf')
cnt = 0
for i in range(n):
    if ct[i][1] > t:
        cnt += 1
    else:
        if cost >= ct[i][0]:
            min_t = ct[i][1]
            cost = ct[i][0]
if cnt == n:
    print('TLE')
else:
    print(cost)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

N, T = mi()
ct = li2(N)

ans = float('inf')

for i in range(N):
    if ct[i][1] > T:
        continue
    if ct[i][0] < ans:
        ans = ct[i][0]

if ans == float('inf'):
    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:
    ans=min(c,ans)
print("TLE" if ans==1001 else ans)

Submission status: Accepted

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

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 and c<ans:
        ans=c
if ans==10**5:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
ans=10**10
for i in range(N):
  c,t=map(int,input().split())
  if t<=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())
cost =[]
for i in range(n):
    c, t = map(int, input().split())
    if t <= T:
        cost.append(c)
if cost:
    print(min(cost))
else:
    print('TLE')

Submission status: Accepted

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

ct.sort()
jdg = False

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

Submission status: Accepted

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

for a in sorted(c_t):
    if a[1] <= T:
        print(a[0])
        break
else:
    print("TLE")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, t = map(int, input().split(" "))
ct = []
for i in range(n):
    c1, t1 = map(int, input().split(" "))
    ct.append((c1, t1))

res = "TLE"
cts = sorted(ct)
for i in cts:
    if i[1] > t:
        pass
    else:
        res = i[0]
        break
print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
min_t = 10000
for i in range(n):
    c,s = map(int,input().split())
    if s <= t and c<=min_t:
        min_t = min(c,min_t)
        ans = c
    
if min_t == 10000:
    print("TLE")
else:
    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=min(c,C)
print(C if C<1001 else "TLE")

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:
  ans="TLE"
print(ans)

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
ans=10000000000000000
for i in range(n):
    a,s=map(int,input().split())
    if s<=t:ans=min(ans,a)
print(ans if 10000000000000000!=ans else "TLE")

Submission status: Accepted

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

Submission status: Accepted

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

judge = False
cost = list()
for a in range(N):
    c, t = map(int, input().split())
    if t <= T:
        cost.append(c)
        judge = True

if judge:
    print(min(cost))
else:
    print('TLE')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, T = lr()
CT = np.array([lr() for _ in range(N)])
CT = CT[CT[:, 1] <= T]
time = CT[:, 0]
if len(time) == 0:
    print('TLE')
else:
    answer = time.min()
    print(answer)

Submission status: Accepted

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

for i in range(n):
    ci, ti = map(int, input().split())
    if ti <= t:
        ans = min(ans, ci)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,T = map(int,input().split())
c = 0
for _ in range(N):
  _c, _t = map(int,input().split())
  if _t <= T:
    if c == 0:
      c = _c
    elif c != 0 and _c <= c:
      c = _c
print(c if c != 0 else "TLE")

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
cost=10001
ans=-1
for i in range(N):
    c,t=map(int,input().split())
    if t<=T and c<cost:
        cost=c
        ans=cost
if ans==-1:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

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

minimum = 1001
for cni in ct:
    if cni[1] <= T:
        minimum = min(cni[0], minimum)

answer = minimum if minimum < 1001 else 'TLE'

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

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, groupby
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)]

c = 1001

for i in range(N):
	if ct[i][1] <= T:
		c = min(c, ct[i][0])

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

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

Submission status: Accepted

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

for i in range(N):
    M, B = map(int, input().split())
    List.append([M,B])
    M, B = 0, 0

for k in range(N):
    if int(List[k][1]) <= T:
        List2.append(List[k])

for n in range(len(List2)):
    if List2[n][0] <= min:
        min = List2[n][0]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n,t = map(int, input().split())
    res = 100000000000
    for _ in range(n):
        a,b = map(int, input().split())
        if b<=t:
            res = min(res, a)
    if res ==100000000000:
        print('TLE')
    else:
        print(res)

if __name__ == '__main__':
    main()

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:
        pass
    else:
        if c < C:
            C = c

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
m=[]
count=0
for i in range(n):
  c,k=map(int,input().split())
  if k<=t:
    m.append(c)
    count=1
if count==1:
  print(min(m))
else:
  print('TLE')

Submission status: Accepted

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