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 = list(map(int,input().split()))
c = []
t = []

for x in range(N):
	ci, ti = list(map(int, input().split()))
	if ti <= T:
		c.append(ci)
		t.append(ti)

if c == []:
	print('TLE')
else:
	print(min(c))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
ans = "TLE"
n, t = map(int, raw_input().strip().split())
tans = t + 1
cans = 1000000
for _ in xrange(n):
  ci, ti = map(int, raw_input().strip().split())
  if ti <= t:
    tans = ti
    cans = min(ci, cans)
if tans > t: print ans
else: print cans

Submission status: Accepted

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

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

print(min(li) if len(li)>0 else "TLE")

Submission status: Accepted

Solution code:
N, T = [int(x) for x in input().strip().split(' ')]
import sys
mincost = -1
for line in sys.stdin:
    c, t = [int(x) for x in line.strip().split(' ')]
    if t <= T:
        if mincost == -1:
            mincost = c
        else:
            mincost = min(mincost, c)
    else:
        continue
if mincost == -1:
    print("TLE")
else:
    print(mincost)

Submission status: Accepted

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

Rs = [r for r in Rs if r[1] <= T]

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

Submission status: Accepted

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

ct = []
tmp = []
for i in range(N):
    tmp = list(map(str,input().split()))
    #tmp = list(map(int,input().split()))
    ct.append(list(tmp))

res = 1001
for c,t in ct:
    if int(t) <= int(T):
        if res > int(c):
            res = int(c)

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

Submission status: Accepted

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

filtered = tuple(filter(lambda x: x[1] <= t, ct))
if len(filtered) != 0:
	print(min(map(lambda x: x[0], filtered)))
else:
	print("TLE")

Submission status: Accepted

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

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18

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

ans = INF
for i in range(N):
    c, t = map(int, raw_input().split())
    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())

c = set()
for i in range(0, N):
    ci, ti = map(int, input().split())
    if ti > T:
        continue
    c.add(ci)

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

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
clst = []
tlst = []
for i in range(n):
    cc, tt = map(int, input().split())
    if tt <= t:
        clst += [cc]
        tlst += [tt]
if len(clst) > 0:
    print(min(clst))
else:
    print('TLE')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, T = list(map(int, input().split(" ")))
c = N*[0]
t = N*[0]

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

ans = 1e9

for i in range(N):
    if(t[i] <= T):
        if(ans > c[i]):
            ans = c[i]

if(ans == 1e9): print("TLE")
else: print(ans)

Submission status: Accepted

Solution code:
N, T = list(map(int, input().split()))
c_min = 1001
for i in range(N):
    cost, time = list(map(int, input().split()))
    if time <= T:
        c_min = min(c_min, cost)
if c_min == 1001:
    print("TLE")
else:
    print(c_min)

Submission status: Accepted

Solution code:
def main():
    n, T = map(int, input().split())
    ans = None
    for _ in range(n):
        c, t = map(int, input().split())
        if t <= T and (ans is None or c < ans):
            ans = c
        # print(c, t, ans)
    if ans is None:
        print('TLE')
    else:
        print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n, T = map(int, input().split())
res = 2e3
for _ in range(n):
    c, t = map(int, input().split())
    if t <= T:
        res = min(c, res)
if res < 2e3:
    print(res)
else:
    print('TLE')

Submission status: Accepted

Solution code:
import sys

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

flag = False
min_c = sys.maxsize
for i in range(1, N + 1):
    c, t = map(int, input().split())

    if t > T:
        continue

    min_c = min(c, min_c)
    flag = True

if flag is True:
    print(min_c)
else:
    print("TLE")

Submission status: Accepted

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

ans = 10000
for v in ct:
    if v[1] <= T:
        ans = min(ans, v[0])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

def main():
    n, t = map(int,input().split())

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

    ans = 10000
    for i in lst:
        if i[1] <= t:
            ans = min(ans,i[0])

    if ans > 9999:
        print("TLE")
    else:
        print(ans)


if __name__ == "__main__":
        main()

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
c = []
t = []
ans = 10 ** 9
for _ in range(N):
  c_i, t_i = map(int, input().split())
  c.append(c_i)
  t.append(t_i)
for i in range(N):
  if t[i] <= T:
    ans = min(ans, c[i])
if ans == 10 ** 9:
  ans = 'TLE'
print(ans)

Submission status: Accepted

Solution code:
# vim: set fileencoding=utf-8:


def main():
    N, T = map(int, raw_input().split())
    ans = 9999999

    for idx in xrange(N):
        c, t = map(int, raw_input().split())
        if t <= T:
            ans = min(c, ans)

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

nums.sort(key=lambda x:x[0])
for i in range(n):
  if nums[i][1] <= t:
    print(nums[i][0])
    exit()
print('TLE')

Submission status: Accepted

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

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

if ans_cost == 9999999:
    print('TLE')
else:
    print(ans_cost)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

N, T = map(int,input().split())
A = []
B = []

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
c = float('inf')
for _ in range(n):
    ci, ti  = map(int, input().split())
    if ti <= t:
        c = min(ci, c)
if c == float('inf'):
    print('TLE')
else:
    print(c)

Submission status: Accepted

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

min_c = 1001

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

if min_c != 1001:
  print(min_c)
else:
  print('TLE')

Submission status: Accepted

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

b = []

c = []

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

for i in range(a[0]):
    if b[i][1] <= a[1]:
        c.append(b[i])

c.sort()

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

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+1:
        l.append(c)
if len(l)==0:
    print('TLE')
else:
    print(min(l))

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

Submission status: Accepted

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

arr = []
for _ in range(n):
    arr.append([int(e) for e in input().split()])

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

for k,i in enumerate(arr):
    if i[1] <= t:
        print(i[0])
        break
    if k == len(arr)-1:
        print('TLE')

Submission status: Accepted

Solution code:
n, tl = 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())
sols = []
for i in range(n):
    if t[i] <= tl:
        sols.append(c[i])
    else:
        continue
if len(sols) == 0:
    print("TLE")
else:
    print(min(sols))

Submission status: Accepted

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

result =float('inf')

for c,t in CT:
    if t<=T:
        result = min(result,c)

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

Submission status: Accepted

Solution code:
def solve(r, T):
    d = [int(i[0]) for i in r if int(i[1]) <= T]
    if len(d):
        return min(d)
    else:
        return "TLE"


if __name__ == "__main__":
    N, T = tuple(input().split(" "))
    r = [input().split(" ") for i in range(int(N))]
    print(solve(r, int(T)))

Submission status: Accepted

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

ans = 9999
for c,t in ct:
    if t <= T:
        ans = min(ans, c)
    
if ans == 9999:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

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

m = 9999
for i in range(N):
    if t[i] <= T:
        if c[i] < m:
            m = c[i]
if m == 9999:
    print("TLE")
    exit()

print(m)

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

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

Submission status: Accepted

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

ct.append((1001, 1))
a = min([c for c, t in ct if T >= t])
if a != 1001:
    print(a)
else:
    print("TLE")

Submission status: Accepted

Solution code:
a = input().split()
a = [int(i) for i in a]
task = []
for i in range(a[0]):
    temp = input().split()
    temp = [int(i) for i in temp]
    task.append(temp)

lister = []
for i in task:
    if i[1] <= a[1]:
        lister.append(i[0])

if lister == []:
    print ('TLE')
else: 
    print (min(lister))

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(min(l))
else:
    print("TLE")

Submission status: Accepted

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

c=[]
t=[]

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

ans=1000000   
for i in range(n):
    if t[i]<=T:
        ans=min(ans,c[i])
        
if ans==1000000:
    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) and (c <= ans):
        ans = c

if ans == 10**10:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

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

current_c = 10000

for n in range(N):
  c, t = map(int, input().split())
  if t > T:
    continue
  if current_c > c:
    current_c = c

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

Submission status: Accepted

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

def main():
    N, T = list(map(int, input().split()))
    paths = []
    for i in range(N):
        c, t = list(map(int, input().split()))
        paths.append((c, t))
    paths = sorted(paths, key=lambda x: x[0])

    for p in paths:
        if p[1] <= T:
            print(p[0])
            exit()
    print("TLE")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

minc = 1001

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N, T = map(int, input().split())
    r = []
    for i in range(N):
        r.append(list(map(int, input().split())))
    tmp = 1e+9
    for i in range(N):
        if r[i][1] <= T:
            if r[i][0] < tmp:
                tmp = r[i][0]

    if tmp == 1e+9:
        print('TLE')
    else:
        print(tmp)

Submission status: Accepted

Solution code:
N, T = map(int,input().split())
R = []
for k in range(N):
    c, t = map(int,input().split())
    if t <= T:
        R.append([c,t])
R = sorted(R)
if R != []:
    print(R[0][0])
else:
    print("TLE")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math,string,itertools,fractions,heapq,collections,re,array,bisect

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

ans = max(C)+1

for i in range(N):
    t,c = T[i],C[i]
    if t <= TT:
        if ans > c:
            ans = c
if ans == max(C) + 1:
    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 1000 < ans:
  ans = 'TLE'
print(ans)

Submission status: Accepted

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

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


val = float("inf")
for c, t in route.items():
    if t <= T:
        if c <= val:
            val = c

if val < float("inf"):
    print(val)
else:
    print("TLE")

Submission status: Accepted

Solution code:
n, ti = [int(_) for _ in input().split(' ')]
cost = 1001
for i in range(n):
    c, t = [int(_) for _ in input().split(' ')]
    if t <= ti and c < cost:
        cost = c
if cost <= 1000:
    print(cost)
else:
    print('TLE')

Submission status: Accepted

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

Submission status: Accepted

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

for _ in range(N):
    c,t=map(int,input().split())
    if t<=T:
        C.append(c)
        
if C==[]: print("TLE")
else: print(min(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(c,ans)
if ans==1001:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8
#
    
def main(n, t, ct):
    rtl = []
    for i in range(n):
        if ct[i][1] <= t:
            rtl.append(ct[i][0])
    if rtl == []:
        print('TLE')
    else:
        print(min(rtl))
    
    
if __name__ == '__main__':
    try:
        n, t  = list(map(int,input().strip().split(' ')))
        ct = []
        for i in range(n):
            ct.append(list(map(int, input().strip().split(' '))))
        main(n, t, ct)
    except EOFError:
        pass

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n,t = [int(i) for i in input().split()]
k = []
for i in range(n):
    ci,ti = [int(i) for i in input().split()]
    if t >= ti:
        k.append([ci,ti])

if len(k) == 0:
    print('TLE')
else:
    k.sort()
    print(k[0][0])

Submission status: Accepted

Solution code:
# B
N, T = list(map(int, input().split()))
min_cost = 9999

for i in range(N):
    c, t = list(map(int, input().split()))
    if t <= T and c < min_cost:
        min_cost = c
        
if min_cost == 9999:
    min_cost = 'TLE'
    
print(min_cost)

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

Submission status: Accepted

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

mc = float("inf")
ans = "TLE"

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

"""
RC112 B
"""

n,t = map(int,input().split())

costs = []
for i in range(n):
    ci,ti = map(int,input().split())
    if ti <= t:
        costs.append(ci)

if bool(costs):
    print(min(costs))
else:
    print('TLE')

Submission status: Accepted

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

Submission status: Accepted

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

min = 10000

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, t = [int(i) for i in input().split()]
r = [[int(i) for i in input().split()] for j in range(n)]
min_cost = 10000
for i in r:
    if i[1] <= t:
        if i[0] < min_cost:
            min_cost = i[0]
if min_cost == 10000:
    print('TLE')
else:
    print(min_cost)

Submission status: Accepted

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

ct = [tuple(map(int, input().split())) for _ in range(N)]
ct = sorted(filter(lambda x: x[1] <= T, ct), key=lambda x: x[0])
try:
    print(ct[0][0])
except IndexError:
    print("TLE")

Submission status: Accepted

Solution code:
# coding:utf-8

INF = float('inf')


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


N, T = inpl()
X = []
for i in range(N):
    c, t = inpl()
    X.append([t, c])

X.sort()
ans = INF
for i in range(N):
    if X[i][0] > T:
        break
    if X[i][1] < ans:
        ans = X[i][1]

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

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 = 99999

    for a in A:
        cost, time = a

        if time <= T and cost < ans:
            ans = cost

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


main()

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n,t = na()
ct = [na() for _ in range(n)]

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

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

Submission status: Accepted

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

print(min_cost if min_cost != float('inf') else "TLE")

Submission status: Accepted

Solution code:
nums = [int(num) for num in input().split()]
n = nums[0]
T = nums[1]
ans = 10000
for i in range(n):
    ct = [int(num) for num in input().split()]
    c = ct[0]
    t = ct[1]
    if t <= T:
        ans = min(ans,c)
if ans == 10000:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,T=[int(x) for x in input().split()]
ans=10**10
for _ in [0]*n:
    ci,ti=[int(x) for x in input().split()]
    if ti<=T:
        ans=min(ci,ans)
if ans==10**10:
    print("TLE")
else:
    print(ans)

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

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

Submission status: Accepted

Solution code:
n,T=map(int,input().split())
f=0
mins=99999999
for i in range(n):
    a,b=map(int,input().split())
    if b<=T:
        f=1
        mins=min(mins,a)
if f:
    print(mins)
else:
    print('TLE')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
fin = sys.stdin.readline

N, T = [int(elem) for elem in input().split(' ')]
cost_and_times = [[int(elem) for elem in fin().split(' ')] for _ in range(N)]
min_cost = float('inf')
for c, t in cost_and_times:
    if t <= T:
        min_cost = min(min_cost, c)

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

Submission status: Accepted

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

ans = 10 ** 9

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

if ans == 10 ** 9:
    print('TLE')
else:
    print(ans)

Submission status: Accepted

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

ans = 10**9

for i in range(N):
    if t[i] <= T:
        ans = min(ans, c[i])

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def getN():
    return int(input())

def getMN():
    a = input().split()
    b = [int(i) for i in a]
    return b[0],b[1]

def getlist():
    a = input().split()
    b = [int(i) for i in a]
    return b

N, T = getMN()

maxtime = 10000000000
roots = []
for i in range (N):
    a,b = getMN()
    roots.append((a,b))

for root in roots:
    if root[1] <= T:
        if root[0] < maxtime:
            maxtime = root[0]

if maxtime > 10000000:
    print("TLE")
else:
    print(maxtime)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# your code goes here
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:
			ans = min(ans,c)

if ans == -1:
	print('TLE')
else:
	print(ans)

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(n)]
a=sorted([i for i in l if i[1]<=t],key=lambda x:x[0])
if a:
  print(a[0][0])
else:
  print("TLE")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

N,T = li()

ans = 10**5
for i in range(N):
    c,t = li()
    if t <= T:
        ans = min(ans,c)
     
if ans == 10**5:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
c, t = [0]*N, [0]*N
best = float('inf')
flag = False
for i in range(N):
    ci, ti = map(int, input().split())
    if ti <= T:
        flag = True
        best = min(best, ci)
if flag:
    print(best)
else:
    print('TLE')

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

c = []

for i in range(n):
	c.append(list(map(int,input().split())))



a = 100000000
for i in c:
	if i[1] <= t:
		a = min(a,i[0])

if a == 100000000:
	print('TLE')
else:
	print(a)