Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
old_count = 1
s = list(s)
new_count = 0
while old_count != new_count:
    old_count = new_count
    for i in range(len(s)-1, 0, -1):
        if s[i] == 'W' and s[i-1] == 'B':
            s[i-1] = 'W'
            s[i] = 'B'
            new_count += 1
print(new_count)


Fixed submission:
s = input()
s = list(s)
count_b = [0] * len(s)
for i in range(len(s)):
    if s[i] == 'B':
        if i == 0:
            count_b[i] = 1
        else:
            count_b[i] = count_b[i-1] + 1
    else:
        if i > 0:
            count_b[i] = count_b[i-1]
count = 0
for i in range(len(s)):
    if s[i] == 'W':
        count += count_b[i]
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, raw_input().split())
edges = [[] for _ in range(n)]

nums = []
for i in range(m):
  nums.append(map(int, raw_input().split()))
nums.sort(key=lambda x: x[2])
start_u = nums[0][0] - 1
max_i = nums[0][2] - 1

for item in nums:
  u, v, s = item
  u, v = u-1, v-1
  edges[u].append([v, s])
  edges[v].append([u, s])
i = 1
total = 0

while i <= max_i:
  values = [0] * n
  values[start_u] = i
  q = [[start_u] + t for t in edges[start_u]]
  visited = [False] * n
  visited[start_u] = True
  legal = True
  while q and legal:
    from_to, to_next, vs = q.pop()
    visited[to_next] = True
    if values[to_next] == 0:
      values[to_next] = vs - values[from_to]
      if values[to_next] <= 0:
        legal = False
      else:
        for item in edges[to_next]:
          if visited[item[0]] == False:
            q.append([to_next, item[0], item[1]])
    elif values[to_next] == vs - values[from_to]:
      for item in edges[to_next]:
          if visited[item[0]] == False:
            q.append([to_next, item[0], item[1]])
    else:
      legal = False
  i += 1
  if legal:
    total += 1
  else:
    if total > 0:
      break
print(total)



Fixed submission:
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

setrecursionlimit(10**6)
n, m = map(int, raw_input().split())
edges = [[] for _ in range(n)]

for i in range(m):
  u, v, s = map(int, raw_input().split())
  u, v = u-1, v-1
  edges[u].append((s, v))
  edges[v].append((s, u))

def quit(x):
  print(x)
  exit()

cond = [[None] * n for _ in range(2)]
cond[0][0] = 0

INF = 10**16

visited = [False] * n

def walk(x):
  if visited[x]:
    return
  visited[x] = True
  for s, y in edges[x]:
    for sig in range(2):
      if cond[sig][x] is not None:
        p = cond[sig][x]
        if cond[1-sig][y] is None or cond[1-sig][y] == s - p:
          cond[1-sig][y] = s - p
        else:
          quit(0)
    walk(y)

walk(0)

for i in range(n):
  if cond[0][i] is not None and cond[1][i] is not None:
    x = (cond[1][i] - cond[0][i]) // 2
    for j in range(n):
      if cond[0][j] is not None and cond[0][j] + x <= 0:
        quit(0)
      if cond[1][j] is not None and cond[1][j] - x <= 0:
        quit(0)
      if cond[0][j] is not None and cond[1][j] is not None and x + cond[0][j] != cond[1][j] - x:
        quit(0)
    quit(1)

pmin = min(p for p in cond[0] if p is not None)
nmin = min(p for p in cond[1] if p is not None)

print(max(0, nmin + pmin - 1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
a = map(int, raw_input().split())
for i in range(len(a)):
  a[i] -= (i+1)
min_total = sum([abs(t) for t in a])
for item in a:
  total = sum([abs(t-item) for t in a])
  if total < min_total:
    min_total = total

print(min_total)


Fixed submission:
n = int(raw_input())
a = map(int, raw_input().split())
for i in range(len(a)):
  a[i] -= (i+1)


b = sorted(a)
i = n // 2
what = b[i]
print(sum([abs(t - what) for t in b]))
Buggy python submission (verdict: Runtime Error):
s = raw_input()
total = 0
for t in s:
  if t == '+':
    total += 1
  else:
    total -= 1
print(total)


Fixed submission:
s = raw_input()
total = 0
for t in s:
  if t == '+':
    total += 1
  else:
    total -= 1
print(total)
Buggy python submission (verdict: Runtime Error):
n_str = raw_input()
n = int(n_str)
total = sum(map(int, list(n_str)))
if n % total == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
n_str = raw_input()
n = int(n_str)
total = sum(map(int, list(n_str)))
if n % total == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n_str = raw_input()
n = int(n_str)
total = sum(map(int, list(n_str)))
if n % total == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
n_str = raw_input()
n = int(n_str)
total = sum(map(int, list(n_str)))
if n % total == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import operator as op
N, A, B, K = map(int, raw_input().split())
ab = []
max_a = K // A
max_a = min(max_a, N)
for i in range(max_a+1):
  if ((K-A*i) % B) == 0:
    j = (K-A*i) / B
    if j > N:
      continue
    ab.append([i, j])

def ncr(n, r):
  r = min(r, n-r)
  numer = reduce(op.mul, xrange(n, n-r, -1), 1)
  denom = reduce(op.mul, xrange(1, r+1), 1)
  return numer//denom

total = 0
for a, b in ab:
  total += ncr(N, a) * ncr(N, b)
print(total % 998244353)


Fixed submission:
MOD = 998244353
fact = [1] * 300001
ifact = [1] * 300001

for i in range(1, 300001):
    fact[i] = (fact[i-1] * i) % MOD
    ifact[i] = pow(fact[i], MOD-2, MOD)

def nCk(n, k):
    if k < 0 or k > n: return 0
    return (fact[n] * ifact[n-k] * ifact[k]) % MOD

N, A, B, K = map(int, raw_input().split())
ab = []
max_a = K // A
max_a = min(max_a, N)
for i in range(max_a+1):
  if ((K-A*i) % B) == 0:
    j = (K-A*i) / B
    if j > N:
      continue
    ab.append([i, j])

total = 0
for a, b in ab:
  total += nCk(N, a) * nCk(N, b)
print(total % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(raw_input())
a = map(int, raw_input().split())


def check(b1, b2):
  res = ''
  for x, y in zip(b1, b2):
    if x == '0' and y == '0':
      res += '0'
    elif (x == '0' and y == '1') or (x == '1' and y == '0'):
      res += '1'
    else:
      return False
  return res


total = n
for i in range(n):
  b_1 = '{0:020b}'.format(a[i])
  for j in range(i+1, n):
    b_2 = '{0:020b}'.format(a[j])
    t = check(b_1, b_2)
    if t:
      b_1 = t
      total += 1
    else:
      break

print(total)


Fixed submission:
n = int(raw_input())
a = map(int, raw_input().split())

i = 0
j = 1
res = a[i]
total = n

while i < n and j < n:
  if res & a[j] == 0:
    res += a[j]
    j += 1
  else:
    res -= a[i]
    i += 1
    total += j - i
    if j == i:
      j += 1
      res = a[i]

if j == n:
  if i < n-1:
    for k in range(i+1, n):
      total += j-k

print(total)
Buggy python submission (verdict: Runtime Error):
n = int(raw_input())
k = int(raw_input())
x = int(raw_input())
y = int(raw_input())
if n < = k:
  print(x*n)
else:
  print(x*k+y*(n-k))

Fixed submission:
n = int(raw_input())
k = int(raw_input())
x = int(raw_input())
y = int(raw_input())
if n <= k:
  print(x*n)
else:
  print(x*k+y*(n-k))
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input.split())

def max(a,b):
    if a > b:
        return a
    else:
        return b

def min(a,b):
    if a < b :
        return a
    else:
        return b

if min(a,b) < c < max(a,b):
    print('Yes')
else:
    print('No')


Fixed submission:
a,b,c = map(int,input().split())

def max(a,b):
    if a > b:
        return a
    else:
        return b

def min(a,b):
    if a < b :
        return a
    else:
        return b

if min(a,b) < c < max(a,b):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = list(input())
K = int(input())

key = S[K-1]

for i in renge(len(S)):
    if not S[i] == key:
        S[i] = '*'

print(''.join(S))


Fixed submission:
N = int(input())
S = list(input())
K = int(input())

key = S[K-1]

for i in range(len(S)):
    if not S[i] == key:
        S[i] = '*'

print(''.join(S))
Buggy python submission (verdict: Runtime Error):
A=[]
Y = []
for i in range(5):
    x = int(input())
    y = x % 10
    x = x + (10-y)
    A.append((y,x))

B = sorted(A):
sum = 0

for i in range(len(B)):
    x,y = B[i]
    sum += x
    if i == len(B)-1:
        sum -= y

print(sum)


Fixed submission:
A=[]
Y=[]
for i in range(5):
    x = int(input())
    y = x % 10
    if y != 0:
        x = x + (10-y)
    A.append((y,x))

B = sorted(A)
sum = 0
flag = 0
#print(B)
for i in range(len(B)):
    y,x = B[i]
    sum += x
    if flag == 0:
        if y != 0:
            sum -= 10-y
            flag = 1

print(sum)
Buggy python submission (verdict: Runtime Error):
#実験をしっかりとしよう
X,Y,Z,K = (int(_) for _ in input().split())
A = (int(_) for _ in input().split())
B = (int(_) for _ in input().split())
C = (int(_) for _ in input().split())
#この手の問題はまずsortする(今回は大きい順の方がすっきり)
A = sorted(A)
B = sorted(B)
C = sorted(C)
#Aのa位とb位とc位ならその上にはa*b*c-1(自分以外)が上にいる。
A.reverse()
B.reverse()
C.reverse()

ABC = []
for i in range(len(A)):
    for j in range(len(B)):
        if (i+1)*(j+1) > K:
            break
        for k in range(len(C)):
            if (i+1)*(j+1)*(k+1) > K:
                break
            ABC.append(A[i]+B[j]+C[k])
ABC.sort().reverse()

for i in range(K):
    print(ABC[i])
#pythonだとTLEになる?


Fixed submission:
#実験をしっかりとしよう
X,Y,Z,K = (int(_) for _ in input().split())
A = (int(_) for _ in input().split())
B = (int(_) for _ in input().split())
C = (int(_) for _ in input().split())
#この手の問題はまずsortする(今回は大きい順の方がすっきり)
A = sorted(A)
B = sorted(B)
C = sorted(C)
#Aのa位とb位とc位ならその上にはa*b*c-1(自分以外)が上にいる。
A.reverse()
B.reverse()
C.reverse()

ABC = []
for i in range(len(A)):
    for j in range(len(B)):
        if (i+1)*(j+1) > K:
            break
        for k in range(len(C)):
            if (i+1)*(j+1)*(k+1) > K:
                break
            ABC.append(A[i]+B[j]+C[k])
ABC.sort()
ABC.reverse()

for i in range(K):
    print(ABC[i])
#pythonだとTLEになる?

Buggy python submission (verdict: Runtime Error):
#実験をしっかりとしよう
X,Y,Z,K = (int(_) for _ in input().split())
A = (int(_) for _ in input().split())
B = (int(_) for _ in input().split())
C = (int(_) for _ in input().split())
#この手の問題はまずsortする(今回は大きい順の方がすっきり)
A = sorted(A).reverse()
B = sorted(B).reverse()
C = sorted(C).reverse()
#総和は変わらないので残ったやつの累積和で考えてみる。
#1000*1000なら全列挙できるそのうち3000個を取り除いて、3の1000個を
#それに組み合わせて全探索する。(2重forかな)
AB = []

for i in range(X):
    for j in range(Y):
        AB.append(A[i]+B[i])
AB = sorted(AB).reverse()[:3001]

ABC = []
for i in range(len(AB)):
    for j in range(Z):
        ABC.append(AB[i]+C[j])

ABC = sorted(ABC).reverse()
for i in range(3000):
    print(ABC[i])


Fixed submission:
#実験をしっかりとしよう
X,Y,Z,K = (int(_) for _ in input().split())
A = (int(_) for _ in input().split())
B = (int(_) for _ in input().split())
C = (int(_) for _ in input().split())
#この手の問題はまずsortする(今回は大きい順の方がすっきり)
A = sorted(A)
B = sorted(B)
C = sorted(C)
#Aのa位とb位とc位ならその上にはa*b*c-1(自分以外)が上にいる。
A.reverse()
B.reverse()
C.reverse()

ABC = []
for i in range(len(A)):
    for j in range(len(B)):
        if (i+1)*(j+1) > K:
            break
        for k in range(len(C)):
            if (i+1)*(j+1)*(k+1) > K:
                break
            ABC.append(A[i]+B[j]+C[k])
ABC.sort()
ABC.reverse()

for i in range(K):
    print(ABC[i])
#pythonだとTLEになる?
Buggy python submission (verdict: Runtime Error):
A,B,C = (int(_) for _ in input().split())

if A == B and B == C:
    print(Yes)
else:
    print(No)


Fixed submission:
A,B,C = (int(_) for _ in input().split())

if A == B and B == C:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
S = input()

if S == 'A':
    print('T')
elif S == 'C':
    print('G')
elif S == 'G':
    print('C')
elif S == 'T'::
    print('A')


Fixed submission:
S = input()

if S == 'A':
    print('T')
elif S == 'C':
    print('G')
elif S == 'G':
    print('C')
elif S == 'T':
    print('A')

Buggy python submission (verdict: Runtime Error):
S = input()

if S == 'A':
    print('T')
elif S == 'C':
    print('G')
elif S == 'G':
    print('C')
elif S == 'T'::
    print('A')


Fixed submission:
S = input()

if S == 'A':
    print('T')
elif S == 'C':
    print('G')
elif S == 'G':
    print('C')
elif S == 'T':
    print('A')

Buggy python submission (verdict: Runtime Error):
N,Q = map(int,input().split())
S = input()
for i in range(Q):
    l,r = (int(_) for _ in input().split())
    s = S[l-1:r]
    print(s.count('AC'))


Fixed submission:
S = input()

if S == 'A':
    print('T')
elif S == 'C':
    print('G')
elif S == 'G':
    print('C')
elif S == 'T':
    print('A')
Buggy python submission (verdict: Runtime Error):
def main():
    N = int(input())
    sum = 0
    for i in range(N):
        x,y = (int(_) for _ input().split())
        if y == 'JPY':
            sum += x
        elif y == 'BTC':
            sum += x * 380000.0
    print(sum)

if __name__  == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    sum = 0
    for i in range(N):
        x,y = (_ for _ in input().split())
        if y == 'JPY':
            sum += float(x)
        elif y == 'BTC':
            sum += float(x) * 380000.0
    print(sum)

if __name__  == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#方針　もっとも近い敵でない島の集まりを調べると区間スケジュール問題となる。
#一列に並んでいるので飛んだ島とは繋げない
#橋の取り壊しの最小値というが、分割としてはもっとも番号の若いものまでしか無理である。
#最近接の敵である島の数字をもつ配列を考える。
N,M = (int(_) for _ in input().split())
mostNeightborOpponent = [N+1 for _ in range(N)]
#print(mostNeightborOpponent)
for i in range(M):
    a,b = (int(_) for _ in input().split())
    if mostNeightborOpponent[a-1] > b:
        mostNeightborOpponent[a-1] = b
#print(mostNeightborOpponent)
#island:・・・島|島・・・の右の島のindex
island = 1
bridgeWillBreak = 0

while island < N:
    minOpIsland = mostNeightborOpponent[island-1]
    for i in range(island-1,N):
        if minOpIsland > mostNeightborOpponent[i]:
            minOpIsland=mostNeightborOpponent[i]
    #print(minOpIsland)
    island = minOpIsland
    if island > N:
        break
    bridgeWillBreak += 1

print(bridgeWillBreak)


Fixed submission:
#TLEした
#方針　もっとも近い敵でない島の集まりを調べると区間スケジュール問題となる。
#一列に並んでいるので飛んだ島とは繋げない
#橋の取り壊しの最小値というが、分割としてはもっとも番号の若いものまでしか無理である。
#最近接の敵である島の数字をもつ配列を考える。

#TLEの解決さく最小値順に初めから並べ替えておく。そのとき島の位置がindexkara
#測れないのでtupleを作っていく。

from operator import itemgetter
N,M = (int(_) for _ in input().split())
mostNeightborOpponent = [(N+1,i+1) for i in range(N)]
#print(mostNeightborOpponent)
for i in range(M):
    a,b = (int(_) for _ in input().split())
    if mostNeightborOpponent[a-1][0] > b:
        mostNeightborOpponent[a-1] = (b,a) #tupleを作るsortは第一引数を考えるので順序はこの順
#print(mostNeightborOpponent)
#island:・・・島|島・・・の右の島のindex
island = 1
bridgeWillBreak = 0

sortedOpponent = sorted(mostNeightborOpponent,key = itemgetter(0))

for b,a in sortedOpponent:
    if a < island :
        continue
    island = b
    if island > N :
        break
    bridgeWillBreak += 1

print(bridgeWillBreak)
Buggy python submission (verdict: Runtime Error):
#文字列Tを突っ込むのはできるだけ最後の方が良い(残りは全てaにしないと辞書順で負けうる。)
#if 文字列が入らない→UNRESTORABLE
#if 文字列が入ったら全部aを入れられる。(ん？これってここまでやったら絶対に一番最初のやつになるのでは?)
#※すでに文字が入っていたら、文字列を入れずに全てaを突っ込む
#文字列をどうやって探すか。
#Tの長さと同じだけ?が連続している場所があるならいける
#というか一文字ずつみて(その文字or?ならオーケー)失敗したらindexを戻していけばいいので

def strProduct(S,T):
    Tindex = 0#Tのindex失敗するたびに0に戻る
    lt = len(T) #Tの文字列の長さ
    flag = False#Tの材料に ?がなければFalse
    reasonable = False#文字を作れるかどうか
    translateIndex = [] #SがTの文字列になる場所の初めの位置
    S.reverse()
    T.reverse()
    for si in range(len(S)):
        s = S[si]
        if s == T[Tindex] or s == "?":
            if Tindex == 0:#初めての一致
                translateIndex.append(si)
            if s == "?":#?をつかって文字列をつくる時と作らない時で異なるし、?を使わないのがあればそれを優先するべき
                flag = True
                if len(translateIndex) > 1:#すでに一つ完成している時はそっちを優先する
                    translateIndex.pop()#translateIndexには残らない
            Tindex += 1
            if Tindex == lt:#全てmatchingした時
                reasonable = True
                if not flag:#?を使わないなら優先的にそれを使う
                    break
                #初期化して次のを探す
                Tindex = 0
                flag = False
        else: #一回でも失敗すれば初期化
            Tindex = 0
            flag = False
            #translateIndexはあまり関係ない
    if flag:#?を使わないとできないなら変更します。
        for j in range(translateIndex[len(translateIndex)-1],translateIndex[len(translateIndex)-1]+lt):
            S[j] = T[j-translateIndex[len(translateIndex)-1]]
    S.reverse()
    #T.reverse()
    if not reasonable:
        return "UNRESTORABLE"
    else:
        for si in range(len(S)):
            if S[si] == "?":
                S[si] = "a"
        modifiedS = ''.join(S)
        return modifiedS

S = list(input())
T = list(input())
#print(S)
#print(T)
print(strProduct(S,T))


Fixed submission:
sp = input()
t = input()
len_t = len(t)
len_s = len(sp)
cand = []
part_start = -1

for i in range(len_s - len_t + 1):
    num = 0
    for j in range(len_t):
        if (sp[i + j] == '?' or sp[i + j] == t[j]):
            num += 1

    if (num == len_t):
        part_start = i

if part_start != -1:
    # 部分文字列は最後にあったほうがいい?はaで最小化できる可能性があり、文字列の先頭に近い部分にそれらがあったほうがよい
    ans = sp[:part_start] + t + sp[part_start + len_t:]
    ans = ans.replace('?', 'a')
    print(ans)
else:
    print('UNRESTORABLE')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, c, d = map(int, input().split())
nums = list()
for i in range(a, b+1):
    if i%c == 0 or i%d == 0:
        continue
    nums.append(i)

print(len(nums))

Fixed submission:
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


def lcd(a, b):
    return a*b // gcd(a, b)


a, b, c, d = map(int, input().split())

higher = b//c + b//d - b//lcd(c, d)
lower = (a-1)//c + (a-1)//d - (a-1)//lcd(c, d)

print((b-a+1)-higher+lower)
Buggy python submission (verdict: Runtime Error):
S = input()
s = list(S)
year = int(s[0] + s[1] + s[2] + s[3])
month = int(s[5] + s[6])
day = int(s[8] + s[9])
if year <2019:
    print('Heisei')
    break
elif month < 5:
    print('Heisei')
    break
else:
    print('TBD')

Fixed submission:
S = input()
s = list(S)
year = int(s[0] + s[1] + s[2] + s[3])
month = int(s[5] + s[6])
day = int(s[8] + s[9])
if year <2019:
    print('Heisei')
elif month < 5:
    print('Heisei')
else:
    print('TBD')
Buggy python submission (verdict: Runtime Error):
N = int(input())
xu = [[] for i in range(N)]
otoshidama = 0
for i in range(N):
    xu[i] = list(input().split())
for i in xu:
    if i[1] == 'JPY':
        otoshidama += int(i[0])
    else:
        otoshidama +=

Fixed submission:
N = int(input())
xu = [[] for i in range(N)]
otoshidama = 0
for i in range(N):
    xu[i] = list(input().split())
for i in xu:
    if i[1] == 'JPY':
        otoshidama += int(i[0])
    else:
        otoshidama += float(i[0])*380000
print(otoshidama)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
if B % A =0:
    print(A + B)
else:
    print(B - A)

Fixed submission:
A, B = map(int, input().split())
if B % A ==0:
    print(A + B)
else:
    print(B - A)
Buggy python submission (verdict: Runtime Error):
D = input()
if D ==25:
    print('Christmas')
elif D == 24:
    print('Christmas Eve')
elif D == 23:
    print('Christmas Eve Eve')
else D == 22:
    print('Christmas Eve Eve Eve')

Fixed submission:
D = int(input())
if D ==25:
    print('Christmas')
elif D == 24:
    print('Christmas Eve')
elif D == 23:
    print('Christmas Eve Eve')
elif D == 22:
    print('Christmas Eve Eve Eve')
Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
ct = [[] for _ in range(N)]
for i in range(N):
    ct[i] = list(map(int, input().split()))
cost =[]
for v in ct:
    if v[1] <= T:
        cost.append(v)
if len(cost) <1:
    print('TLE')
else:
    for i, v in enumerate(cost):
        if i == 0:
            least = v[0]
        else:
            if v[0] <= least:
                least = v[0]
print(least)

Fixed submission:
N, T = map(int, input().split())
ct = [[] for _ in range(N)]
for i in range(N):
    ct[i] = list(map(int, input().split()))
cost =[]
for v in ct:
    if v[1] <= T:
        cost.append(v)
if len(cost) <1:
    print('TLE')
else:
    for i, v in enumerate(cost):
        if i == 0:
            least = v[0]
        else:
            if v[0] <= least:
                least = v[0]
    print(least)

Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
ct = [[] for _ in range(N)]
for i in range(N):
    ct[i] = list(map(int, input().split()))
cost =[]
for v in ct:
    if v[1] <= T:
        cost.append(v)
for i, v in enumerate(cost):
    if i == 0:
        least = v[0]
    else:
        if v[0] <= least:
            least = v[0]
if least <= T:
    print(least)
else:
    print('TLE')

Fixed submission:
N, T = map(int, input().split())
ct = [[] for _ in range(N)]
for i in range(N):
    ct[i] = list(map(int, input().split()))
cost =[]
for v in ct:
    if v[1] <= T:
        cost.append(v)
if len(cost) <1:
    print('TLE')
else:
    for i, v in enumerate(cost):
        if i == 0:
            least = v[0]
        else:
            if v[0] <= least:
                least = v[0]
    print(least)

Buggy python submission (verdict: Runtime Error):
N, T = map(int, input().split())
ct = [[] for _ in range(N)]
for i in range(N):
    ct[i] = list(map(int, input().split()))
cost =[]
for v in ct:
    if v[1] <= T:
        cost.append(v)
for i, v in enumerate(cost):
    if i == 0:
        least = v[0]
    else:
        if v[0] <= least:
            least = v[0]
if least <= T:
    print(least)
else:
    print('TLE')

Fixed submission:
N, T = map(int, input().split())
ct = [[] for _ in range(N)]
for i in range(N):
    ct[i] = list(map(int, input().split()))
cost =[]
for v in ct:
    if v[1] <= T:
        cost.append(v)
if len(cost) <1:
    print('TLE')
else:
    for i, v in enumerate(cost):
        if i == 0:
            least = v[0]
        else:
            if v[0] <= least:
                least = v[0]
    print(least)