Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

h,w = map(int, input().split())
s = (np.array([input() for _ in range(h)]))
ans = [list() for i in range(h)]
for key_i,i in enumerate(s):
  m = 0
  for j in i:
    if j == ".":
      m += 1
    else:
      for k in range(m):
        ans[key_i].append(m)
      m = 0
      ans[key_i].append(m)
  for k in range(m):
    ans[key_i].append(m)

ans = np.array(ans)
ans = ans.T
ans2 = [list() for i in range(w)]
for key_i,i in enumerate(ans):
  m = 0
  for j in i:
    if j:
      m += 1
    else:
      for k in range(m):
        ans2[key_i].append(m)
      m = 0
      ans2[key_i].append(m)
  for k in range(m):
    ans2[key_i].append(m)
ans2 = np.array(ans2)
print(np.max(ans + ans2) - 1)

Fixed submission:
import numpy as np 
H, W = map(int, input().split())
S = (np.array([list(input()) for _ in range(H)]) == '.')
 

up = np.zeros((H, W), dtype=int)
down = np.zeros((H, W), dtype=int)
left = np.zeros((H, W), dtype=int)
right = np.zeros((H, W), dtype=int)
 
for i in range(H):
    up[i] = (up[i-1] + 1) * S[i]
    down[-i-1] = (down[-i] + 1) * S[-i-1]
    
for i in range(W):
    left[:, i] = (left[:, i-1] + 1) * S[:, i]
    right[:, -i-1] = (right[:, -i] + 1) * S[:, -i-1]

print(np.max(up+down+left+right) - 3)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

h,w = map(int, input().split())
s = (np.array([input() for _ in range(h)]))
ans = [list() for i in range(h)]
for key_i,i in enumerate(s):
  m = 0
  for j in i:
    if j == ".":
      m += 1
    else:
      for k in range(m):
        ans[key_i].append(m)
      m = 0
      ans[key_i].append(m)
  for k in range(m):
    ans[key_i].append(m)

ans = np.array(ans)
ans = ans.T
ans2 = [list() for i in range(w)]
for key_i,i in enumerate(ans):
  m = 0
  for j in i:
    if j:
      m += 1
    else:
      for k in range(m):
        ans2[key_i].append(m)
      m = 0
      ans2[key_i].append(m)
  for k in range(m):
    ans2[key_i].append(m)
print(np.max(ans + ans2) - 1)
  
  

Fixed submission:
import numpy as np 
H, W = map(int, input().split())
S = (np.array([list(input()) for _ in range(H)]) == '.')
 

up = np.zeros((H, W), dtype=int)
down = np.zeros((H, W), dtype=int)
left = np.zeros((H, W), dtype=int)
right = np.zeros((H, W), dtype=int)
 
for i in range(H):
    up[i] = (up[i-1] + 1) * S[i]
    down[-i-1] = (down[-i] + 1) * S[-i-1]
    
for i in range(W):
    left[:, i] = (left[:, i-1] + 1) * S[:, i]
    right[:, -i-1] = (right[:, -i] + 1) * S[:, -i-1]

print(np.max(up+down+left+right) - 3)
Buggy python submission (verdict: Time Limit Exceeded):
l = reversed(list(input()))
mod = 10 ** 9 + 7
ans = 1
for key, i in enumerate(l):
    if i == "1":
        ans =  ((3 ** key) % mod + 2 * ans) % mod
print(ans)

Fixed submission:
l = reversed(list(input()))
mod = 10 ** 9 + 7
ans = 1
for key, i in enumerate(l):
    if i == "1":
        ans = (pow(3,key,mod) % mod + 2 * ans) % mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
l = input()
mod = 10 ** 9 + 7
ans = 1
for key, i in enumerate(reversed(l)):
    if i == "1":
        ans =  (3 ** key + 2 * ans) % mod
print(ans)


Fixed submission:
l = reversed(list(input()))
mod = 10 ** 9 + 7
ans = 1
for key, i in enumerate(l):
    if i == "1":
        ans = (pow(3,key,mod) % mod + 2 * ans) % mod
print(ans)
Buggy python submission (verdict: Runtime Error):
a,p ＝ map(int, input().split())
print((a * 3 + p) // 2)


Fixed submission:
a,p = map(int, input().split())
print((a*3+p)//2)

Buggy python submission (verdict: Runtime Error):
a,p ＝map(int, input().split())
print((a*3 + p) // 2)

Fixed submission:
a,p = map(int, input().split())
print((a*3+p)//2)
Buggy python submission (verdict: Runtime Error):
a = [0] * (10 ** 9)

Fixed submission:
a,b = map(int, input().split())
if a >= 13:
  print(b)
elif 6 <= a <= 12:
  print(b//2)
else:
  print(0)

Buggy python submission (verdict: Time Limit Exceeded):
a = [0 for i in range(10 ** 9)]

Fixed submission:
a,b = map(int, input().split())
if a >= 13:
  print(b)
elif 6 <= a <= 12:
  print(b//2)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]


n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(m)]
uf = UnionFind(n)
for i in a:
    uf.union(i[0],i[1])

print(len(list(set(uf.par))))

Fixed submission:
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        """
        x が属するグループを探索
        """
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        """
        x と y のグループを結合
        """
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        """
        x と y が同じグループか否か
        """
        return self.find(x) == self.find(y)

    def get_size(self, x):
        """
        x が属するグループの要素数
        """
        x = self.find(x)
        return self.size[x]


n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(m)]
uf = UnionFind(n)
b = []
for i in a:
    uf.union(i[0]-1,i[1]-1)
for i in range(n):
  b.append(uf.find(i))
print(len(list(set(b))))
Buggy python submission (verdict: Runtime Error):
def all_divisor(n):
  small = [1]
  large = [n]
  for i in range(2, int(n ** 0.5)+1):
    if n % i == 0:
      small.append(i)
      large.append(n//i)
  large.reverse()
  divisor = small + large
  return divisor


n = int(input())
n_divisor = all_divisor(n)
ans = 0
for i in n_divisor:
  mini_ans = (n - i) // i
  if i >= mini_ans:
    break
  ans += mini_ans 
print(ans)


Fixed submission:
n,k = map(int, input().split())
print(n-k+1)
Buggy python submission (verdict: Runtime Error):
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
i = bisect.bisect_left(a,0)
if i % 2 == 0:
    ans = abs(sum(a[:i]))+sum(a[i:])
else:
    if i == n:
        ans = abs(sum(a[:i])+a[i])
    else:
        ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
print(ans)


Fixed submission:
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
i = bisect.bisect_left(a,0)
if i % 2 == 0:
    ans = abs(sum(a[:i]))+sum(a[i:])
else:
    if i == n:
        ans = abs(sum(a[:i-1]))+a[i-1]
    else:
        ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
print(ans)

Buggy python submission (verdict: Runtime Error):
import bisect

n = int(input())
a = list(map(int, input().split()))
a.sort()
i = bisect.bisect_left(a,0)
if i % 2 == 0:
    ans = abs(sum(a[:i]))+sum(a[i:])
else:
    ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
print(ans)

Fixed submission:
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
i = bisect.bisect_left(a,0)
if i % 2 == 0:
    ans = abs(sum(a[:i]))+sum(a[i:])
else:
    if i == n:
        ans = abs(sum(a[:i-1]))+a[i-1]
    else:
        ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i,j in enumerate(a):
  if j >= 0:
    if i % 2 == 0:
      ans = abs(sum(a[:i]))+sum(a[i:])
      break
    else:
      ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
      break
print(ans)


Fixed submission:
import bisect

n = int(input())
a = sorted(list(map(int, input().split())))
i = bisect.bisect_left(a,0)
if i % 2 == 0:
    ans = abs(sum(a[:i]))+sum(a[i:])
else:
    if i == n:
        ans = abs(sum(a[:i-1]))+a[i-1]
    else:
        ans = abs(sum(a[:i-1]))+abs(a[i]+a[i-1])+sum(a[i+1:])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
ans = 1
MAX = s[0]
for i in s[1:]:
  if i >= MAX:
    ans += 1
    MAX = i
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
now = a[0]
ans = 1
for i in a[1:]:
  if i >= now:
    ans += 1
    now = i
print(ans)
Buggy python submission (verdict: Runtime Error):
a = [int(input()) for i in range(5)]
k = input()
if max(a) - min(a) <= k:
  print("Yay!")
else:
  print(":(")

Fixed submission:
a = [int(input()) for i in range(5)]
k = int(input())
if max(a) - min(a) <= k:
  print("Yay!")
else:
  print(":(")
Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,n = map(int, input().split())
a = sorted(list(map(int, input().split())),reverse = True)
b = sorted(list(map(int, input().split())),reverse = True)
c = sorted(list(map(int, input().split())),reverse = True)
d = []
for i,i1 in enumerate(a):
  for j,j1 in enumerate(b[:n // (i+1)]):
    for k,k1 in enumerate(c[:n // (i+1) * (j+1)]):
        d.append(i1 + j1 + k1)

d.sort(reverse = True)
for i in d[:n]:
  print(i)


Fixed submission:
x,y,z,n = map(int, input().split())
a = sorted(list(map(int, input().split())),reverse = True)
b = sorted(list(map(int, input().split())),reverse = True)
c = sorted(list(map(int, input().split())),reverse = True)
d = []
for i,i1 in enumerate(a):
  for j,j1 in enumerate(b):
    if (i+1)*(j+1) <= n:
      for k,k1 in enumerate(c):
        if (i+1) * (j+1) * (k+1) <= n:
          d.append(i1 + j1 + k1)
        else:
          break
    else:
      break
d.sort(reverse = True)
for i in d[:n]:
  print(i)

Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,n = map(int, input().split())
a = sorted(list(map(int, input().split())),reverse = True)
b = sorted(list(map(int, input().split())),reverse = True)
c = sorted(list(map(int, input().split())),reverse = True)
d = []
for i,i1 in enumerate(a):
  for j,j1 in enumerate(b):
    for k,k1 in enumerate(c):
      if (i+1) * (j+1) * (k+1) <= n:
        d.append(i1 + j1 + k1)
d.sort(reverse = True)
for i in d[:n]:
  print(i)

Fixed submission:
x,y,z,n = map(int, input().split())
a = sorted(list(map(int, input().split())),reverse = True)
b = sorted(list(map(int, input().split())),reverse = True)
c = sorted(list(map(int, input().split())),reverse = True)
d = []
for i,i1 in enumerate(a):
  for j,j1 in enumerate(b):
    if (i+1)*(j+1) <= n:
      for k,k1 in enumerate(c):
        if (i+1) * (j+1) * (k+1) <= n:
          d.append(i1 + j1 + k1)
        else:
          break
    else:
      break
d.sort(reverse = True)
for i in d[:n]:
  print(i)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def main():
  n = int(input())
  a = [[] for row in range(200000)]
  C = [int(input()) for i in range(n)]
  b = 0
  d = [0]
  mod = 10 ** 9 + 7
  mini_ans = 0
  for i,c in enumerate(C):
    if b != c:
      for j in a[c]:
        mini_ans += (d[j] + 1) % mod
      a[c].append(i)
    d.append(mini_ans % mod)
    b = c
  print(d[-1]+1)

if __name__ == '__main__':
    main()

Fixed submission:
mod = 10 ** 9 + 7
n = int(input())
s = input()
a = [0]*26
ans = 1
for i in s:
  a[ord(i)-ord("a")] += 1
for i in a:
  ans = (ans * (i+1)) % mod
print(ans-1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [[] for row in range(200000)]
b = 0
e = [int(input()) for i in range(n)]
d = [0]
mini_ans = 0
for i,c in enumerate(e):
  if b != c:
    for j in a[c]:
      mini_ans += d[j] + 1
    a[c].append(i)
  d.append(mini_ans)
  b = c
print(d[-1]+1)

Fixed submission:
mod = 10 ** 9 + 7
n = int(input())
s = input()
a = [0]*26
ans = 1
for i in s:
  a[ord(i)-ord("a")] += 1
for i in a:
  ans = (ans * (i+1)) % mod
print(ans-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
btc = 0
jpy = 0
for i in range(n):
  a,b = input().split()
  if b = "BTC":
    btc += float(a)
  else:
    jpy += int(a)
print(jpy+btc*380000)

Fixed submission:
n = int(input())
btc = 0
jpy = 0
for i in range(n):
  a,b = input().split()
  if b == "BTC":
    btc += float(a)
  else:
    jpy += int(a)
print(jpy+btc*380000)
Buggy python submission (verdict: Runtime Error):
k,a,b = map(int, input().split())
if b - a <= 2:
  print(k + 1)
else:
  yen = 0
  if k >= a + 1:
    yen += 1
    k -= a + 1
    c,d = divmod(k,2)
    yen += c
    print(a + (b-a) * yen + d)
  else:
    print(k + 1)

Fixed submission:
a,b = map(int, input().split())
if b * 2 - 1 <= a:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = [10 ** 18] * (n+1)
dp[1] = 0
for i,v in enumerate(h,1):
  for j in range(i+1,min(n+1,i+k+1)):
    dp[j] = min(dp[j],dp[i]+abs(v-h[j-1]))
print(dp[n])


Fixed submission:
n,k = map(int, input().split())
h = list(map(int, input().split()))
dp = [10 ** 18] * (n+1)
dp[1] = 0
for i,v in enumerate(h,1):
  for j in range(i+1,min(n+1,i+k+1)):
    dp[j] = min(dp[j],dp[i]+abs(v-h[j-1]))
print(dp[n])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
ans = 1
b = 0
c = []
for i in a:
  if i > b:
    for j in range(i-b):
      c.append(0)
  else:
    c[i-1] += 1
    c = c[:i]
    if c[i-1] >= ans:
      ans += 1
  b = i    
print(ans)


Fixed submission:
s = list(input())
ans = 0
w = 0
for i,j in enumerate(s):
  if j == "W":
    ans += (i - w)
    w += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
a = [int(n[i:i+3]) for i in range(len(n)-3)]
ans = abs(a[0]-753)
for i in a:
  b = abs(a[i]-753)
  if b < ans:
    ans = b
print(ans)
  

Fixed submission:
n = input()
a = [int(n[i:i+3]) for i in range(len(n)-2)]
ans = abs(a[0]-753)
for i in a:
  b = abs(i-753)
  if b < ans:
    ans = b
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = []
e = [0,0,0,0,0]
f = [74,24,14,4,2]
for i in prime_list:
  a = n
  b = 0
  c = 1
  while a // (i**c) > 0:
    b += a // (i**c)
    c += 1
  else:
    d.append(b)
count = 0
len_d = len(d)-1
for k in f:
  for i,j in enumerate(d):
    if j < k:
      e[count] = i
      count += 1
      break
    elif i == len_d:
      e[count] = i+1
      count += 1
      break


print(e[0]+e[1]*(e[4]-1)+e[2]*(e[3]-1)+(e[3]*(e[3]-1)//2)*(e[4]-2))


Fixed submission:
n = int(input())
prime_list = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
d = []
e = [0,0,0,0,0]
f = [74,24,14,4,2]
for i in prime_list:
  a = n
  b = 0
  c = 1
  while a // (i**c) > 0:
    b += a // (i**c)
    c += 1
  else:
    d.append(b)
count = 0
len_d = len(d)-1
for k in f:
  for i,j in enumerate(d):
    if j < k:
      e[count] = i
      count += 1
      break
    elif i == len_d:
      e[count] = i+1
      count += 1
      break



print(e[0]+e[1]*(e[4]-1)+e[2]*(e[3]-1)+(e[3]*(e[3]-1)//2)*(e[4]-2))

Buggy python submission (verdict: Runtime Error):
d = []
e = [0,0,0,0,0]
f = [74,24,14,4,2]
for i in prime_list:
  a = n
  b = 0
  c = 1
  while a // (i**c) > 0:
    b += a // (i**c)
    c += 1
  else:
    d.append(b)
count = 0
len_d = len(d)-1
for k in f:
  for i,j in enumerate(d):
    if j < k:
      e[count] = i
      count += 1
      break
    elif i == len_d:
      e[count] = i+1
      count += 1
      break


print(e[0]+e[1]*(e[4]-1)+e[2]*(e[3]-1)+(e[3]*(e[3]-1)//2)*(e[4]-2))

Fixed submission:
n = int(input())
prime_list = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47]
d = []
e = [0,0,0,0,0]
f = [74,24,14,4,2]
for i in prime_list:
  a = n
  b = 0
  c = 1
  while a // (i**c) > 0:
    b += a // (i**c)
    c += 1
  else:
    d.append(b)
count = 0
len_d = len(d)-1
for k in f:
  for i,j in enumerate(d):
    if j < k:
      e[count] = i
      count += 1
      break
    elif i == len_d:
      e[count] = i+1
      count += 1
      break



print(e[0]+e[1]*(e[4]-1)+e[2]*(e[3]-1)+(e[3]*(e[3]-1)//2)*(e[4]-2))
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(m)]
c = [0]*n
for i in a:
  p,y = i[0],i[1]
  c[p-1] += 1
  num = c[p-1]
  print("0"*(6-len(p))+"0"*(6-len(num))+num)
  

Fixed submission:
import math
n,m = map(int, input().split())
a = []
for i in range(m):
  pk,yk = map(int,input().split())
  b = [pk,yk,i]
  a.append(b)
a.sort(key=lambda x:(x[0],x[1]))
b = a[0][0]
c = 0
for i in range(len(a)):
  if a[i][0] != b:
    b = a[i][0]
    c = 1
  else:
    c += 1
  a[i].append(c)
a.sort(key=lambda x:x[2])
for i in range(len(a)):
  a[i].append(math.floor(math.log10(a[i][0])+1.0))
  a[i].append(math.floor(math.log10(a[i][3])+1.0))
  print(str("0"*(6-a[i][4]))+str(a[i][0])+str("0"*(6-a[i][5]))+str(a[i][3]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
b = []
c = 0
for i in range(n):
 ak = int(input())
 a.append(ak)
a.sort()
for i in range(n-1):
 bk = a[i+1] -  a[i]
 b.append(bk)
if len(b) % 2 == 1:
 for i in range(len(b) // 2):
  c += sum(b[i:len(b)-i])*2
 c += b[len(b)//2]
else:
 for i in range(len(b) // 2):
  c += sum(b[i:len(b)-i])*2
 c -= min(b[len(b)//2-1],b[len(b)//2])
print(c)

Fixed submission:
n = int(input())
a = []
b = []
d = []
c = 0
for i in range(n):
 ak = int(input())
 a.append(ak)
a.sort()
for i in range((len(a)-1)//2):
 d.append(a[-i-1]-a[i])
for i in range(n-1):
 bk = a[i+1] -  a[i]
 b.append(bk)
e = len(b)
c = sum(d) * 2
if e % 2 == 1:
 c += b[e//2]
else:
 c -= min(b[e//2-1],b[e//2])
print(c)
Buggy python submission (verdict: Runtime Error):
n, t = map(int,input().split())
mydict = {}
for i in range(n):
	a, b = map(int,input().split())
	mydict.setdefault(a, b)
sortedDict = sorted(mydict.items())
k = 0
for j in sortedDict:
	k += 1
	if j[1] <= t:
		print(j[0])
		break
	if k == len(sortedDict):
		print("TLE")
		break


Fixed submission:
n = int(input())
if n == 1:
	print("Hello World")
elif n == 2:
	a = int(input())
	b = int(input())
	print(a+b)

Buggy python submission (verdict: Runtime Error):
n, t = map(int,input().split())
mydict = {}
for i in range(n):
	a, b = map(int,input().split())
	mydict.setdefault(a, b)
sortedDict = sorted(mydict.items())
k = 0
for j in sortedDict:
	k += 1
	if j[1] <= t:
		print(j[0])
		break
	if k == len(sortedDict):
		print("TLE")


Fixed submission:
n = int(input())
if n == 1:
	print("Hello World")
elif n == 2:
	a = int(input())
	b = int(input())
	print(a+b)

Buggy python submission (verdict: Runtime Error):
n = int(input())
if n == 1:
	print("Hello World")
elif n == 2:
	a = int(input())
    b = int(input())
    print(a+b)

Fixed submission:
n = int(input())
if n == 1:
	print("Hello World")
elif n == 2:
	a = int(input())
	b = int(input())
	print(a+b)
Buggy python submission (verdict: Runtime Error):
n, t = map(int,input().split())
mydict = {}
for i in range(n):
	a, b = map(int,input().split())
	mydict.setdefault(a, b)
sortedDict = sorted(mydict.items())
k = 0
for j in sortedDict:
	k += 1
	if j[1] <= t:
		print(j[0])
        break
	if k == len(sortedDict):
		print("TLE")


Fixed submission:
n,t = map(int, input().split())
a = []
b = 0
for i in range(n):
  l = list(map(int, input().split()))
  a.append(l)
a.sort()
for i in range(n):
  if a[i][1] <= t:
    b = a[i][0]
    break
if b > 0:
  print(b)
else:
  print("TLE")

Buggy python submission (verdict: Runtime Error):
n, t = map(int,input().split())
mydict = {}
for i in range(n):
  a, b = map(int,input().split())
  mydict.setdefault(a, b)
sortedDict = sorted(mydict.items())
k = 0
for j in sortedDict:
  k += 1
  if j[1] <= t:
    print(j[0])
    break
  if k == len(sortedDict):
  	print("TLE")
	break

Fixed submission:
n,t = map(int, input().split())
a = []
b = 0
for i in range(n):
  l = list(map(int, input().split()))
  a.append(l)
a.sort()
for i in range(n):
  if a[i][1] <= t:
    b = a[i][0]
    break
if b > 0:
  print(b)
else:
  print("TLE")

Buggy python submission (verdict: Runtime Error):
n, t = map(int,input().split())
mydict = {}
for i in range(n):
  a, b = map(int,input().split())
  mydict.setdefault(a, b)
sortedDict = sorted(mydict.items())
print(sortedDict)
k = 0
for j in sortedDict:
  k += 1
  if j[1] <= t:
    print(j[0])
    break
  if k == len(sortedDict):
  	print("TLE")
    break

Fixed submission:
n,t = map(int, input().split())
a = []
b = 0
for i in range(n):
  l = list(map(int, input().split()))
  a.append(l)
a.sort()
for i in range(n):
  if a[i][1] <= t:
    b = a[i][0]
    break
if b > 0:
  print(b)
else:
  print("TLE")
Buggy python submission (verdict: Runtime Error):
print(1100-int((input()))

Fixed submission:
print(1110-int(input()))

Buggy python submission (verdict: Runtime Error):
print(1100-int((input()))

Fixed submission:
print(1110-int(input()))
Buggy python submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
v = list(map(int,input().split()))
even1 = v[0::2]
odd1 = v[1::2]
even2 = Counter(v1)
odd2 = Counter(v2)
a = even2.most_common()[0][0]
b = odd2.most_common()[0][0]
c = even2.most_common()[0][1]
d = odd2.most_common()[0][1]
if a != b:
 print(len(even1)-c+len(odd1)-d)
else:
 if len(list(set(even1))) == 1 and len(list(set(odd1))) == 1:
  print(len(even1))

 else:
  if c <= d:
   print(len(even1)*2-d-even2.most_common()[1][1])
  else:
   print(len(even1)*2-c-odd2.most_common()[1][1])


Fixed submission:
from collections import Counter

n = int(input())
v = list(map(int,input().split()))
even1 = v[0::2]
odd1 = v[1::2]
even2 = Counter(even1)
odd2 = Counter(odd1)
a = even2.most_common()[0][0]
b = odd2.most_common()[0][0]
c = even2.most_common()[0][1]
d = odd2.most_common()[0][1]
if a != b:
 print(len(even1)-c+len(odd1)-d)
else:
 if len(list(set(even1))) == 1 and len(list(set(odd1))) == 1:
  print(len(even1))
 elif len(list(set(even1))) == 1:
  print(len(odd1)-odd2.most_common()[1][1])
 elif len(list(set(odd1))) == 1:
  print(len(even1)-even2.most_common()[1][1])
 else:
  e = even2.most_common()[1][1]
  f = odd2.most_common()[1][1]
  if c-e >= d-f:
   print(len(even1)*2-c-f)
  else:
   print(len(even1)*2-d-e)