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 = (int(x) for x in input().split())

min_c = 10000
for i in range(1, N+1):
    ci, ti = (int(x) for x in input().split())
    if ti <= T:
        min_c = min(min_c, ci)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
min_c, count = 1000, 0
for n in range(N):
    c, t = map(int, input().split())
    if t <= T:
        count += 1
        min_c = min(min_c, c)

if count != 0:
    print(min_c)
else:
    print('TLE')

Submission status: Accepted

Solution code:
def time_limit_exceeded(N: int, T: int, CT: list) -> int:
    min_cost = float('inf')
    for c, t in CT:
        if t > T:
            continue
        if min_cost > c:
            min_cost = c
    return min_cost


if __name__ == "__main__":
    N, T = map(int, input().split())
    CT = [tuple(int(s) for s in input().split()) for _ in range(N)]
    ans = time_limit_exceeded(N, T, CT)
    print(ans if ans != float('inf') else 'TLE')

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc112/tasks/abc112_b
n, t = [int(x) for x in input().split()]
r = []
s = []
for _ in range(n):
    r.append([int(x) for x in input().split()])
for i in r:
    if i[1] <= t:
        s.append(i[0])
print(min(s)) if len(s) > 0 else print("TLE")

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
ret=9999
for _ in range(N):
  c,t=map(int,input().split())
  if t>T:continue
  ret=min(c,ret)
if ret==9999:
  print('TLE')
else:
  print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = 10**9
for i in range(n):
    if C[i][1] <= t and C[i][0] < ans:
        ans = C[i][0]
    if i == n-1 and ans == 10**9:
        print("TLE")
        exit()
print(ans)

Submission status: Accepted

Solution code:
n,t = map(int, input().split())
ct = [list(map(int, input().split())) for i in range(n)]
ct=sorted(ct, key=lambda cti : cti[0])
for i in range(n):
    if ct[i][1]<=t:
        print(ct[i][0])
        exit()
print('TLE')

Submission status: Accepted

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

ans_c = 10 ** 9
for CTi in CT:
    c, t = CTi
    if t <= T:
        ans_c = c if c < ans_c else ans_c

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

Submission status: Accepted

Solution code:
n, time = map(int, input().split())
path = [tuple(map(int, input().split())) for _ in range(n)]
mincost = 10 ** 9
for c, t in path:
    if t <= time:
        mincost = min(mincost, c)
if mincost == 10 ** 9:
    print('TLE')
else:
    print(mincost)

Submission status: Accepted

Solution code:
from sys import stdin
n, t = [int(x) for x in stdin.readline().rstrip().split()]
data = [stdin.readline().rstrip().split() for _ in range(n)]
data = [[int(i) for i in l] for l in data]

min_time=t
min_cost=float('inf')
for d in data:
  if d[1]<=t:
    if d[0]<min_cost:
      min_cost=d[0]
if min_cost==float('inf'):
  print('TLE')
else:
  print(min_cost)

Submission status: Accepted

Solution code:
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
INF = 10**18

N,T=rl()
ans = INF
for _ in range(N):
    c,t = rl()
    if T >= t and ans > c:
        ans = c

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

Submission status: Accepted

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

TLE_flag = True
result = 1001
for i in range(N):
    c, t = map(int, input().split())
    if t <= T and c < result:
        if TLE_flag:
            TLE_flag = False
        result = c

if TLE_flag:
    print('TLE')
else:
    print(result)

Submission status: Accepted

Solution code:
from sys import stdin
N, T = [int(x) for x in stdin.readline().rstrip().split()]
d = 1001
for i in range(N):
  l = list(map(int, input().split()))
  if l[1] <= T:
    if l[0] < d:
      d = l[0]
if d < 1001:
  print(d)
else:
  print('TLE')

Submission status: Accepted

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

Submission status: Accepted

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

l = []

c = 1000
k = 0

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

Submission status: Accepted

Solution code:
#-*- coding:utf-8 -*-
"""
外出しているXさんは、ABCに参加するためにスマートウォッチで最適な帰宅経路を調べることにしました。
スマートウォッチであるあなたは、N個の帰宅経路を見つけました。
Xさんがi番目の経路を使う場合、コストciかけて時間tiで帰宅できます。
時間T以内に帰宅できる経路のうち、コストが最小となる経路のコストを求めてください。
"""
def main():
    NT = list(map(int, input().split()))
    N = NT[0]
    T = NT[1]
    CandT = []
    for i in range(0, N):
        CandT.append(list(map(int, input().split())))

    CandT = sorted(CandT)  # コストで昇順ソート

    for i in range(0, N):
        if CandT[i][1] <= T:
            print(CandT[i][0])
            exit(0)
        else:
            pass
    print("TLE")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

ct = [[int(j) for j in input().split()] for i in range(N)]

ct.sort(key=lambda x: x[0])

ans = 1001

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

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)]
l.sort()
exist = False

for i in l:
  if int(i[1]) <= t:
    print(i[0])
    exist = True
    break
if not exist:
  print("TLE")

Submission status: Accepted

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

Submission status: Accepted

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

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

for a in c_t2: 
    if a[1] <= T:
        print(a[0])
        exit()
print('TLE')

Submission status: Accepted

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

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 C == []:
    print('TLE')
else:
    print(min(C))

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
l=[]
for i in range(n):
    c,time=map(int,input().split())
    if time<=t:
        l.append(c)
print(min(l) if l!=[] else "TLE")

Submission status: Accepted

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

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

ans = 10000
for i in range(N):
    if T[i] <= Tl:
        ans = min(ans, C[i])

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

Submission status: Accepted

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

def test(lst):
    return lst[0] if lst[1]<=T else 10**4

res = min(map(test, cr_list))
if not res <= 1000:
    res = 'TLE'

print(res)

Submission status: Accepted

Solution code:
def solve(string):
    n, t, *ct = map(int, string.split())
    c = [_c for _c, _t in zip(ct[::2], ct[1::2]) if _t <= t]
    return str(min(c)) if len(c) else "TLE"


if __name__ == '__main__':
    n, t = map(int, input().split())
    print(solve("{} {}\n".format(n, t) + "\n".join([input() for _ in range(n)])))

Submission status: Accepted

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

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

if len(c_n)==0:
    print("TLE")
else:
    for i in range(len(c_n)):
        if c_n[i]==min(c_n):
            print(c_n[i])
            break

Submission status: Accepted

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

for i in range(N):
  c,t=map(int, input().split())
  if t<=T:
    C.append(c)
    
print(min(C) if len(C)!=1 else 'TLE')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A, B = map(int,input().split())
cost = list()
m = B + 1
for i in range(A):
  x, y = map(int, input().split())
  if y < m:
    cost.append(x)
print(min(cost) if len(cost) != 0 else 'TLE')

Submission status: Accepted

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

def kitaku(l):
  l.sort()
  for i in range(N):
    if l[i][1] <= T:
      return l[i][0]
    if i == N - 1:
      return "TLE"

print(kitaku(ct))

Submission status: Accepted

Solution code:

# coding: utf-8

# In[9]:


import numpy as np


# In[22]:


N,T = map(int, input().split())
data = []
for _ in range(N):
    c,t = map(int, input().split())
    data.append([c, t])
data = np.array(data)


# In[23]:


if data[data[:,1] <= T].any():
    print(min(data[data[:,1] <= T][:,0]))
else:
    print("TLE")

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
l=[]
for s in range(a):
  c,t=map(int,input().split())
  if t<=b:
    l.append(c)
if len(l)>0:
  print(min(l))
else:
  print("TLE")

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, raw_input().split())
ans = 9999
for _ in range(N):
  c, t = map(int, raw_input().split())
  if t<=T:
    ans = min(ans, c)
if ans<9999:
  print ans
else:
  print "TLE"

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
cn = [list(map(int, input().split())) for _ in range(n)]
cn.sort(key=lambda x: x[0])
m = 10e9
for c in cn:
    if c[1] <= t:
        m = min(m, c[0])

print('TLE' if m == 10e9 else m)

Submission status: Accepted

Solution code:
#cording: utf-8

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

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

c_min = 1001
for i in range(N):
    if (ct[i][1] <= T) and (ct[i][0] <= c_min):
        c_min = ct[i][0]

print(c_min if c_min != 1001 else 'TLE')

Submission status: Accepted

Solution code:
from operator import itemgetter

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

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

	costs = sorted(costs, key=itemgetter(0))
	for i in range(n):
		if costs[i][1] <= t:
			print(costs[i][0])
			return
	print("TLE")
	return

main()

Submission status: Accepted

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

N, T = I()
ct = [I() for _ in range(N)]

minc = 9999

for i in range(N):
    if T >= ct[i][1] and minc >= ct[i][0]:
        minc = ct[i][0]

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

Submission status: Accepted

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

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

minc = 9999

for i in range(N):
    if T >= ct[i][1] and minc >= ct[i][0]:
        minc = ct[i][0]

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

Submission status: Accepted

Solution code:
N,T=map(int,input().split())
res=2000
for i in range(N):
  c,t=map(int,input().split())
  if t>T:
    continue
  else:
    res=min(res,c)
if res==2000:
  print("TLE")
else:
  print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,T=list(map(int,input().split()))
l=[]
for i in range(N):
  l.append(list(map(int,input().split())))
l.sort(key=lambda x:(x[1],x[0]))

if l[0][1] > T:
  print('TLE')
  quit()
else:
  minimum = l[0][0]

for i in range(1,N):
  if l[i][1] > T:
    break
  elif l[i][1] == l[i-1][1]:
    pass
  else:
    minimum = min(l[i][0], minimum)
print(minimum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,t=map(int,input().split())
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
c=[]
flag=False
for i in range(n):
    if l[i][1]<=t:
        flag=True
        c.append(l[i][0])
    else:
        pass
if flag:
    print(min(c))
else:
    print("TLE")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,T = map(int,input().split())
c_min = 1 << 60
ans = 'TLE'
for i in range(N):
    c,t = map(int,input().split())
    if t <= T:
        if c_min > c:
            c_min = c
            ans = str(c_min)
print(ans)

Submission status: Accepted

Solution code:
n, time = map(int, input().split())
list = []
list_ok = []

for i in range(n):
    c, t = map(int, input().split())
    object = [c, t]
    list.append(object)
    
count = 0

for j in range(n):
    if list[j][1] > time:
        continue
    else:
        list_ok.append(list[j][0])
        count += 1

if count == 0:
    print("TLE")
else:
    ans = min(list_ok)
    print(ans)

Submission status: Accepted

Solution code:
n,T=map(int,input().split())
a = []
for i in range(n):
  A,t=map(int,input().split())
  if t > T:
    pass
  else:
    a.append(A)
if a != []:
    print(min(a))
else:
  print('TLE')

Submission status: Accepted

Solution code:
N,T = map(int,input().split())
min = 1000
count=0
for i in range(N):
    c,t = map(int,input().split())
    if t <= T and c < min:
        min = c
    elif t > T:
        count+=1

print("TLE") if count == N else print(min)

Submission status: Accepted

Solution code:
N, T = [int(i) for i in input().split()]
data_ls = list()
for i in range(N):
  data_ls.append([int(i) for i in input().split()])
data_ls = [i for i in data_ls if i[1] <= T]
if len(data_ls) == 0:
  print("TLE")
else:
  data_ls = sorted(data_ls, key=lambda x:x[0])
  print(data_ls[0][0])

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
ct = [None] * N
for i in range(N):
  ct[i] = list(map(int, input().split()))
ct = sorted([x[0] for x in ct if x[1] <= T]) + ['TLE']
print(ct[0])

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
ct = [None] * N
for i in range(N):
  ct[i] = list(map(int, input().split()))
ct = list(filter(lambda x: x[1] <= T, ct))
if not len(ct) > 0:
  ct.append(['TLE', 0])
ct = sorted(ct, key=lambda x: x[0])
print(ct[0][0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,Y = map(int,input().split())
ct = {}
for i in range(N):
    temp = [int(i) for i in input().split()]
    if temp[1] > Y:
        pass
    else:
        ct[temp[0]] = temp[1]

if len(ct) > 0:
    ct = sorted(ct.items(),key=lambda x: x[0])
    print(ct[0][0])
else:
    print("TLE")

Submission status: Accepted

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

import math
import sys
import heapq
from operator import itemgetter
import itertools
input = sys.stdin.readline

# a = int(input().rstrip())
# a, b = map(int, input().rstrip().split())
# D = list(map(int, input().rstrip().split()))
# H = [int(input().rstrip()) for _ in range(L)]
# DD = [[0 for j in range(100)] for i in range(200)]
# dict = {} ## dictionary

# a = sorted(a, key=lambda x: x[1]))
# if __name__ == '__main__':

N, T = map(int, input().rstrip().split())
ct_s = []
for i in range(N):
	ct = list(map(int, input().rstrip().split()))
	if ct[1] <= T:
		ct_s.append(ct[0])

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

Submission status: Accepted

Solution code:
n, T = map(int, input().split())
pair = []
for i in range(n):
  pair.append(list(map(int, input().split())))
a = []
for i in range(len(pair)):
  if pair[i][1] <= T:
    a.append(pair[i])
if len(a) == 0:
  print('TLE')
  exit()
else:
  a.sort()
  print(a[0][0])

Submission status: Accepted

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

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)
print(min(l) if len(l) > 0 else 'TLE')

Submission status: Accepted

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

l = []

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

ans = float('inf')

for i in range(n):
    if l[i][1] <= t:
        ans = min(ans, l[i][0])

if ans != float('inf'):
    print(ans)
else:
    print('TLE')

Submission status: Accepted

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

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

time_list = list(filter(lambda x: x[1] <= t, li_keiro))

if len(time_list) == 0:
    print("TLE")
else:
    print(min(time_list, key=lambda x: x[0])[0])

Submission status: Accepted

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

Submission status: Accepted

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

min = float("inf")
cost = 5000
for i,v in enumerate(e):
    if v[1] <= t:
        if v[0] <= cost:
            min = v[1]
            cost = v[0]
            


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

Submission status: Accepted

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

li = []
for i in range(n):
  if ct[i][1] <= t:
    li.append(ct[i])
  else:
    continue

if len(li) > 0:
  li2 = []
  for i in range(len(li)):
    li2.append(li[i][0])
  print(min(li2))
else:
  print("TLE")

Submission status: Accepted

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

data = []

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

Submission status: Accepted

Solution code:
N, TL = map(int, input().split())
C = []
T = []
for i in range(N):
    a, b = map(int, input().split())
    C.append(a)
    T.append(b)
cost = 10000
for i in range(N):
    if T[i] <= TL:
        cost = min(cost, C[i])
if cost == 10000:
    print("TLE")
else:
    print(cost)

Submission status: Accepted

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

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

if not cost:
    print("TLE")
else:
    cost.sort()
    print(cost[0])

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
from sys import stdin

N, T, *ct = map(int, stdin.read().split())

cost = 1001
for i in range(N):
    c, t = ct[2*i:2*(i+1)]
    if t > T:
        continue
    cost = min(cost, c)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
from sys import stdin
N,T=[int(x) for x in stdin.readline().rstrip().split()]

a=[]
for i in range(N):
    a.append([int(x) for x in stdin.readline().rstrip().split()])

flag=0
cost=1000
for data in a:
    if data[0] <= cost and data[1] <= T:
        cost=data[0]
        flag=1
if flag == 0:
    print("TLE")
else:
    print(cost)

Submission status: Accepted

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

route = []
for i in range(N):
    c, t = map(int, input().split())
    route.append((c, t))
#print(route)    
    
route_ = list(filter(lambda x:x[1] <= T, route))
#print(route_)

if len(route_) == 0:
    print('TLE')
else:
    print(min(route_, key = lambda x:x[0])[0])

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc112/tasks/abc112_b

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

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


cs = []
for ct in cts:
    if ct[1] <= T:
        cs.append(ct)

if len(cs) == 0:
    print("TLE")
    exit()

ans = 1000

for c in cs:
    ans = min(ans, c[0])

print(ans)

Submission status: Accepted

Solution code:
def tl():
    n,t=map(int,input().split())
    ct=[list(reversed(list((map(int,input().split()))))) for i in range(n)]
    ct.sort()

    if ct[0][0]<=t:
        cos=[[i[1],i[0]] for i in ct]
        cos.sort()
        for i in cos:
            if i[1]<=t:
                print(i[0])
                exit()
    else:
        ans='TLE'
    return ans

print(tl())

Submission status: Accepted

Solution code:
i=lambda:map(int,input().split())
N,T=i()
a=1001
for _ in[0]*N:
  c,t=i()
  if t<=T and a>=c:a=c
print('TLE'*(a>1000)or a)

Submission status: Accepted

Solution code:
# B
N, T = map(int, input().split())
c = [0] * N
t = [0] * N
can_list = []
for i in range(N):
    c[i], t[i] = map(int, input().split())
    if t[i] <= T:
        can_list.append(c[i])
if len(can_list) == 0:
    print('TLE')
else:
    result = min(can_list)
    print(result)

Submission status: Accepted

Solution code:
def main():
  n, T = map(int, input().split())
  kiro = []
  for _ in range(n):
    c_i, t_i = map(int, input().split())
    kiro.append([c_i, t_i])

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

  for c, t in kiro:
    if t <= T:
      print(c)
      return
  print('TLE')

main()

Submission status: Accepted

Solution code:
def main() -> None:
    N, T = map(int, input().split())
    R = [[int(i) for i in input().split()] for _ in range(N)]
    ROK = [x for x in R if int(x[1]) <= T]
    if ROK:
        ROK.sort(key=lambda x: x[0])
        print(ROK[0][0])
    else:
        print('TLE')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
C = [c for c, t in X if t <= T]
if len(C) == 0:
    print("TLE")
else:
    print(min(C))

Submission status: Accepted

Solution code:
result=[]
n,Time=[int(i) for i in input().split()]
for i in range(n):
    c,t=[int(j) for j in input().split()]
    if t<=Time:
        result.append(c)
if len(result)==0:
    print("TLE")
else:
    print(sorted(result)[0])

Submission status: Accepted

Solution code:
import numpy as np

N, T = (int(i) for i in input().split())

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

selected_c = np.array(selected_c)
if(len(selected_c)==0):
    print("TLE")
else:
    print(np.min(selected_c))

Submission status: Accepted

Solution code:
n,t = list(map(int,input().split()))
in_time = list()
           
for i in range(n):
    a,b =  list(map(int,input().split()))
    if t >= b:
        in_time.append(a)

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

Submission status: Accepted

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

c_t = sorted(c_t, key=lambda x:x[1])
if c_t[0][1]>T:
    print('TLE')
    import sys
    sys.exit()
ans = c_t[0][0]
for i in range(N):
    if c_t[i][1]>T:
        break
    if ans>c_t[i][0]:
        ans = c_t[i][0]
print(ans)

Submission status: Accepted

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

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:
N,T = map(int,input().split())
paths = list()
for i in range(N):
  ci,ti = map(int,input().split())
  paths.append((ci,ti))
paths.sort(key=lambda x: x[0])

flag=False
for path in paths:
  if path[1] <= T:
    print(path[0])
    flag=True
    break
if not flag:
  print('TLE')

Submission status: Accepted

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

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

c = []
t = []

for i in range(N):
    c.append(ct[i][0])
    t.append(ct[i][1])

minc = 10000

for i in range(len(c)):
    if t[i] <= T and c[i] < minc:
        minc = c[i]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def main():
  input = sys.stdin.readline
  N, T = map(int, input().split())
  C = 1010
  for _ in range(N):
    c, t = map(int, input().split())
    if t > T:
      continue
    else:
      C = min(C, c)
  
  if C == 1010:
    print('TLE')
  else:
    print(C)


if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
class Solver(object):
    def __init__(self):
        self.n, self.t = list(map(int, input().split(" ")))

    def solve(self):
        min_cost = 1001
        for _ in range(self.n):
            c, t = list(map(int, input().split(" ")))
            if t <= self.t:
                if c < min_cost:
                    min_cost = c
            min_cost
        if min_cost < 1001:
            print(min_cost)
        else:
            print("TLE")


if __name__ == "__main__":
    s = Solver()
    s.solve()

Submission status: Accepted

Solution code:
n,t=list(map(int,input().split(" ")))
list_ct=[]
list_ctT=[]
for count in range(n):
    list_ct.append(list(map(int,input().split(" "))))

for count in range(n):
    if list_ct[count][1]<=t:
        list_ctT.append(list_ct[count][0])
    else:
        pass
if list_ctT!=[]:
    print(min(list_ctT))
else:
    print("TLE")

Submission status: Accepted

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

X.sort(key=lambda x:x[1])
if X[0][1]>t:
    print('TLE')
else:
    Y=[i for i in X if i[1]<=t]
    Y.sort(key=lambda x:x[0])
    print(Y[0][0])

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

Submission status: Accepted

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

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

if ans == 1500:
    ans = "TLE"
print(ans)

Submission status: Accepted

Solution code:
cost = list()
p = [int(i) for i in input().split()]
for j in range(p[0]):
    ipt = [int(i) for i in input().split()]
    if p[1]>=ipt[1]:
        cost.append(ipt[0])
if cost==list():
    print('TLE')
else:
    print(min(cost))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,T = list(map(int, input().split()))
CT = [list(map(int,input().split())) for i in range(N)]
CT.sort()
res = float('inf')
for c,t in CT:
    if t <= T:
        res = min(res,c)

print(res if res!=float('inf') else 'TLE')