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:
def main():
    N, T = map(int, input().split())
    l = []
    cost = 1001
    for i in range(N):
        l.append(list(map(int, input().split())))
    for i in range(N):
        if l[i][1] <= T:
            t = l[i][1]
            if l[i][0] < cost:
                cost = l[i][0]
    if cost == 1001:
        print('TLE')
    else:
        print(cost)
main()

Submission status: Accepted

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

route = list(filter(lambda x:x[1]<=T,route))
if route==[]:
  print('TLE')
  exit()
route = sorted(route)
print(route[0][0])

Submission status: Accepted

Solution code:
N,T = list(map(int,input().split()))
ct = []
for i in range(N):
    ct.append(list(map(int,input().split())))
minCost = 1001
for i in range(N):
    if ct[i][1] <= T and minCost > ct[i][0]:
        minCost = ct[i][0]
if minCost > 1000:
    print("TLE")
else:
    print(minCost)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MM = input().split()
N = int(MM[0])
T = int(MM[1])
list1 =[]
for i in range(N):
  NN = input().split()
  c = int(NN[0])
  t = int(NN[1])
  if t <= T:
    list1.append(c)
list1.sort()
if len(list1) == 0:
  print('TLE')
else:
  print(list1[0])

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
minN = 10000
for i in range(n):
  c, ti = map(int, input().split())
  if t >= ti and minN > c:
    minN = c
print("TLE" if minN == 10000 else minN)

Submission status: Accepted

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

ct = [i[0] for i in ct if i[1]<=t]
if not ct:
    print('TLE')
else:
    print(min(ct))

Submission status: Accepted

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

# B - Time Limit Exceeded /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 外出している X さんは、ABC に参加するためにスマートウォッチで最適な帰宅経路を調べることにしました。
# スマートウォッチであるあなたは、N個の帰宅経路を見つけました。
# X さんが i番目の経路を使う場合、コスト ci かけて時間 tiで帰宅できます。
# 時間 T以内に帰宅できる経路のうち、コストが最小となる経路のコストを求めてください。

# 制約
#     入力はすべて整数である
#     1≤N≤100
#     1≤T≤1000
#     1≤ci≤1000
#     1≤ti≤1000
#     各 (ci,ti)の組は異なる

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N T
# c1 t1
# c2 t2
# :
# cN tN

# 出力
# 時間 T以内に帰宅できる経路のうち、コストが最小となる経路のコストを出力せよ。
# ただし、どの経路を使っても時間 T以内に帰宅できない場合、TLE と出力せよ。

# 入力例 1
# 3 70
# 7 60
# 1 80
# 4 50

# 出力例 1
# 4

# 1番目の経路を使うと、コスト 7で帰宅できます
# 2番目の経路では時間 T=70以内に帰宅できません
# 3番目の経路を使うと、コスト 4で帰宅できます
# 従って、3番目の経路を使ったときのコスト 4が最小です。

# 入力例 2
# 4 3
# 1 1000
# 2 4
# 3 1000
# 4 500

# 出力例 2
# TLE

# どの経路を使っても時間 T=3以内に帰宅できません。

# 入力例 3
# 5 9
# 25 8
# 5 9
# 4 10
# 1000 1000
# 6 1

# 出力例 3
# 5


def calculation(lines):
    # N = int(lines[0])
    N, T = list(map(int, lines[0].split()))
    # n = lines[0]

    min_c = None

    for i in range(1, N+1):
        c, t = list(map(int, lines[i].split()))
        if t <= T:
            if min_c is None:
                min_c = c
            elif min_c > c:
                min_c = c

    if min_c is None:
        return ['TLE']
    else:
        return [min_c]


# 引数を取得
def get_input_lines():
    line = input()
    values = list(map(int, line.split()))
    N = values[0]
    lines = list()
    lines.append(line)
    for _ in range(N):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3 70', '7 60', '1 80', '4 50']
        lines_export = [4]
    if pattern == 2:
        lines_input = ['4 3', '1 1000', '2 4', '3 1000', '4 500']
        lines_export = ['TLE']
    if pattern == 3:
        lines_input = ['5 9', '25 8', '5 9', '4 10', '1000 1000', '6 1']
        lines_export = [5]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines()
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, T = LI()
    ct = [LI() for _ in range(N)]

    l = [i[0] for i in ct if i[1] <= T]

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, t = map(int, readline().split())
cost = 9999
for i in range(n):
    inpt = list(map(int, readline().split()))
    if inpt[1] <= t:
        cost = min(cost, inpt[0])
print(cost if cost != 9999 else 'TLE')

Submission status: Accepted

Solution code:
n = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(n[0])]
ans = []
for i in x:
  if n[1] >= i[1]:
    ans.append(i[0])
if ans == []:
  print('TLE')
else:
  print(sorted(ans)[0])

Submission status: Accepted

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

ans = []
for i in range(len(grid)):
    if grid[i][1] <= T:
        ans.append(grid[i])

if len(ans) != 0:
    print(sorted(ans)[0][0])
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 and c<ans:
        ans=c
print("TLE" if ans==1001 else ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 10000

for i in range(n):
    cost,time = map(int,input().split())
    
    if time <= lim and cost < ans:
        ans = cost

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print([cost, "TLE"][cost == 1001])

Submission status: Accepted

Solution code:
# 初期入力
from bisect import bisect_right
import sys
input = sys.stdin.readline  #文字列では使わない
N,T = (int(i) for i in input().split())
cost_time =[]
time =[]
for i in range(N):
    c,t = (int(j) for j in input().split())
    cost_time.append((c,t))
    time.append(t)


time.sort()
ind =bisect_right(time,T)
if ind ==0:
    ans ="TLE"
else:
    cost_time.sort(key =lambda x:x[1])
    ans1 =[]
    for i in range(ind):
        ans1.append(cost_time[i][0])
    ans =min(ans1)    
print(ans)

Submission status: Accepted

Solution code:
# その19 ABC112 B - Time Limit Exceeded

N,T = map(int,input().split())
C = []
D = []

for i in range(N):
    A,B = map(int,input().split())
    C.append(A)
    D.append(B)
if min(D) > T:
    print('TLE')
else :
    F=[]
    for i in range(N):
        if D[i] <= T:
            F.append(C[i])
    print(min(F))

Submission status: Accepted

Solution code:
# B - Time Limit Exceeded
N, T = map(int, input().split())
CT = [list(map(int, input().split())) for _ in range(N)]

ans = float("inf")

for i in range(N):
	if CT[i][1] <= T:
		ans = min(ans, CT[i][0])
	else:
		pass

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

print(ans)

Submission status: Accepted

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

ans = 10**6
for n in range(N):
  if ct[n][1] <= T:
    if ct[n][0] <= ans:
      ans = ct[n][0]
if ans != 10**6:
  print(ans)
else:
  print("TLE")

Submission status: Accepted

Solution code:
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, T = map(int, input().split())
can = False
res = 1e5
for _ in range(N):
  c, t = map(int, input().split())
  if t <= T:
    can = True
    res = min(res, c)
print(res if can else "TLE")

Submission status: Accepted

Solution code:
#b

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

intime = [ct[0] for ct in CT if ct[1]<=T]
if len(intime)==0:
    print("TLE")
else:
    print(min(intime))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def main():
  n,time = list(map(int,input().split()))
  ct = [map(int, input().split()) for _ in range(n)]
  c,t = [list(i) for i in zip(*ct)]
  cost=1001
  for i in range(0,n):
    if t[i]<=time and c[i]<cost:
      cost=c[i]
  if cost==1001:
    print("TLE")
  else:
    print(cost)
main()

Submission status: Accepted

Solution code:
n,T = map(int,input().split())
c = 500000
for i in range(n):
    a,b = map(int,input().split())
    if T >= b:
        c = min(c,a)
print(c if c < 500000 else 'TLE')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

N, T = LI()
costs = []
for i in range(N):
    c, t = LI()
    if t <= T:
        costs.append(c)

if len(costs) > 0:

    costs.sort()
    print(costs[0])
else:
    print("TLE")

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)

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

INF = 2000
cost = INF 
for i in range(n):
    c, time = map(int, input().split())
    if t >= time:
        cost = min(cost, c)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve():
    n, k = map(int, input().split())
    res = 10**10
    for i in range(n):
        a, b = map(int, input().split())
        if b <= k:
            res = min(res, a)
    print(res if res != 10**10 else "TLE")


solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n,T=map(int,input().split())
ans=10000
for i in range(n):
    c,t=map(int,input().split())
    if t>T:
        continue
    if c<ans:
        ans=c
if ans==10000:
  print("TLE")
else:
  print(ans)

Submission status: Accepted

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

c_ans = float('inf')
for ct in cts:
    if ct[1] <= t:
        c_ans = min(c_ans, ct[0])
if c_ans == float('inf'):
    print('TLE')
else:
    print(c_ans)

Submission status: Accepted

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


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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, T = [int(i) for i in input().split()]  # 数字はなるべく早い段階でint型にしておいた方がわかりやすい

all_pattern_list = []
# 次のようにするともっとシンプルにall_pattern_list = [[c1, t1], [c2, t2], ... , [cN, tN]] という2次元リストを作れる
for i in range(N):
    all_pattern_list.append([int(j) for j in input().split()])  # もしタプルにしたい場合はtuple([int(j) for j in input().split()])とすればOK

INF = 1001
ans = INF  # 解が見つからなかった場合を判定できるようにコストが取り得ない大きな値を初期値に設定しておく
# どうせ最悪全部見ることになるのでソートしなくてもOK
for c, t in all_pattern_list:  # アンパックを使うとわかりやすい変数名を使える
    if t <= T:
        ans = min(ans, c)  # 暫定最小コストより小さい場合は最小コストを更新

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

Submission status: Accepted

Solution code:
N, T = [int(i) for i in input().split()]  # 数字はなるべく早い段階でint型にしておいた方がわかりやすい
all_pattern_list = []
# all_list = [[c1, t1], [c2, t2], ... , [cN, tN]] という2次元リストを作る
for i in range(N):
  all_pattern_list.append([int(j) for j in input().split()])

INF = 1001
ans = INF  # 解が見つからなかった場合を判定できるようにコストが取り得ない大きな値を初期値に設定しておく
# どうせ最悪全部見ることになるのでソートしなくてもOK
for c, t in all_pattern_list:  # アンパックを使うとわかりやすい
  if t <= T:
    ans = min(ans, c)  # 暫定最小コストより小さい場合は最小コストを更新

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

Submission status: Accepted

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

all_pattern_list = sorted(list(zip(*[iter(all_list)]*2)))

for pattern in all_pattern_list:
    if pattern[1] <= int(T):
        print(pattern[0])
        break
    elif pattern == all_pattern_list[-1]:
        print('TLE')

Submission status: Accepted

Solution code:
def resolve():
    N, T = list(map(int, input().split()))
    CT = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: x[0])
    for cost, time in CT:
        if time > T:
            continue
        print(cost)
        break
    else:
        print("TLE")



if '__main__' == __name__:
    resolve()

Submission status: Accepted

Solution code:
N,T = map(int,input().split())
array = []
array = [ [lista for lista in map(int,input().split())] for I in range(N) ]

min = 1001
for I in array:
    if I[1] > T:
        continue
    elif I[1] <= T:
        if I[0] < min: min = I[0]
print(min) if min < 1001 else print('TLE')

Submission status: Accepted

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

cost = 100000

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

if cost == 100000:
    print('TLE')
else:
    print(cost)

Submission status: Accepted

Solution code:
import math
inf = float('inf')

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

min_c = inf
for i in c_t:
    if i[1] <= t:
        min_c = min(min_c, i[0])

if min_c == inf:
    print("TLE")
else:
    print(min_c)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n, t = rm()
min_ = inf
flag = False
for _ in range(n):
  a, b = rm()
  if b <= t:
    min_ = min(min_, a)
    flag = True
if flag:
  print(min_)
else:
  print('TLE')

Submission status: Accepted

Solution code:
n,ct = map(int, raw_input().split(' '))
m = min([u for u,v in [map(int,raw_input().split()) for _ in range(n)] if v <= ct] or [+float('inf')])
print 'TLE' if m == +float('inf') else m

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    n,t=map(int,input().split())
    ct=[tuple(map(int,input().split())) for _ in range(n)]
    minc = 1001
    for c,tt in ct:
        if t >= tt and minc > c:
            minc = c
    print(minc if minc != 1001 else "TLE")

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,T=map(int,input().split())
la=[]
for i in range(n):
    c,t=map(int,input().split())
    if t<=T:la+=[(c,t)]
la=sorted(la,key=lambda x:x[0])
print("TLE" if la ==[] else la[0][0])

Submission status: Accepted

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

ans = -1
cost = 10**5

for i in range(0,N,1):
    c,t = map(int,input().split())
    if t <= T and c < cost:
        cost =c
        ans = i+1

print(cost if ans != -1 else "TLE")

Submission status: Accepted

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

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

if minCost == float("inf"):
    print("TLE")
else:
    print(minCost)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

di = dict(l)

keys = [k for k, v in di.items() if v <=T]

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

Submission status: Accepted

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

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

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

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

# print(n, t)
# print(ct)
for i in ct:
    if i[1] <= t:
        print(i[0])
        exit()

print("TLE")

Submission status: Accepted

Solution code:
n, t = map(int, input().split())
lst = []
for i in range(n):
  tp = tuple(map(int, input().split()))
  if tp[1] <= t:
    lst.append(tp)
if lst == []:
  print('TLE')
  exit()
print(min(lst, key=lambda x: x[0])[0])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
def s(): return input()
def i(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
INF = 10**9
mod = 10**9+7

N,T = I()
ans = INF
for i in range(N):
    c,t = I()
    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())
A = []

for n 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())
X = [list(map(int, input().split())) for _ in range(N)]
Y = [x for x in X if x[1]<=T]
Z = [y[0] for y in Y]
print("TLE" if Y==[] else min(Z))

Submission status: Accepted

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

def MI():
    return map(int, input().split())

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

N, T = MI()
ct = []

for _ in range(N):
    c, t = MI()
    ct.append([c, t])
    
ct.sort(key = lambda x : x[0])
flg = False
ans = 0

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

Submission status: Accepted

Solution code:
n,time=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**10
for i in range(n):
    if t[i]<=time:
        ans=min(ans,c[i])

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

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
INF = float('inf')


def main():
    N, T = map(int, readline().split())
    ans = INF

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

    if ans == INF:
        print('TLE')
    else:
        print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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())
record = [map(int,input().split()) for i in range(N)]
record2 = [i  for i,j in record if j<=T]
print(min(record2) if len(record2)!=0 else "TLE")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

index = -1
min_c = 9999
for i in range(n):
    c, t = map(int, input().split())
    # print(f'{c} {t}')
    
    if t <= T and min_c > c:
        index = i + 1
        min_c = c
    # print(min_c)
        
if index == -1:
    print('TLE')
else:
    print(min_c)

Submission status: Accepted

Solution code:
n,T = map(int,input().split())
ct = [map(int, input().split()) for _ in range(n)]
c,t = [list(i) for i in zip(*ct)]
ans = 1000000
for i in range(n):
  if(T >= t[i]):
    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 = 100000
for i in range(n):
    c, tt = map(int, input().split())
    if tt <= t:
        ans = min(ans, c)
if ans == 100000:
    print("TLE")
else:
    print(ans)

Submission status: Accepted

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N, T, *_CT = map(int, open(0).read().split())
CT = list(zip(*[iter(_CT)]*2))

costs = [ct[0] for ct in CT if ct[1] <= T]
if costs == []:
    print("TLE")
else:
    print(min(costs))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
c=[]
for _ in range(a):
    c.append(list(map(int,input().split())))
result=[]
for i in range(a):
    if c[i][1]<=b:
        result.append(c[i][0])
if result==[]:
    print('TLE')
    exit()
print(min(result))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

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)

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

Submission status: Accepted

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

Submission status: Accepted

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