Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    A = list(map(lambda n: int(n)-1, input().split()))

    visited = [False] * N
    visited[0] = True

    index = 0
    visited_index = [0]

    while K:
        index = A[index]
        if visited[index]:
            K -= 1
            start = A.index(A[index])
            loop_index = visited_index[start:]
            print(visited_index[K % len(loop_index)] + 1)
            exit()
        visited_index.append(index)
        visited[index] = True
        K -= 1
    print(index + 1)
    
main()

Fixed submission:
import sys
input = sys.stdin.readline

def main():
    N, K = map(int, input().split())
    A = list(map(lambda n: int(n)-1, input().split()))

    visited = [False] * N
    visited[0] = True

    index = 0
    visited_index = [0]

    while K:
        index = A[index]
        if visited[index]:
            K -= 1
            start = visited_index.index(index)
            loop_index = visited_index[start:]
            print(loop_index[K % len(loop_index)] + 1)
            sys.exit()
        visited_index.append(index)
        visited[index] = True
        K -= 1
    print(index + 1)
    
main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    S = input().replace('\n', '')
    Q = int(input())

    for _ in range(Q):
        query = input().split()
        if len(query) == 1:
            S = S[::-1]
        else:
            T, F, C = query
            if int(F) == 1:
                S = C + S
            else:
                S = S + C
    print(S)


main()

Fixed submission:
import sys
input = sys.stdin.readline

def main():
    S = input().replace('\n', '')
    Q = int(input())

    flg = 0
    head = ""
    tail = ""
    for _ in range(Q):
        query = input().split()
        if len(query) == 1:
            head, tail = tail, head
            flg += 1
        else:
            T, F, C = query
            if int(F) == 1:
                head += C
            else:
                tail += C
    if flg % 2:
        print(head[::-1] + S[::-1] + tail)
    else:
        print(head[::-1] + S + tail)
main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

def main():
    S = input().replace('\n', '')
    Q = int(input())

    for _ in range(Q):
        query = input().split()
        if len(query) == 1:
            S = S[::-1]
        else:
            T, F, C = query
            if int(F) == 1:
                S = C + S
            else:
                S = S + C
    print(S)


main()

Fixed submission:
import sys
input = sys.stdin.readline

def main():
    S = input().replace('\n', '')
    Q = int(input())

    flg = 0
    head = ""
    tail = ""
    for _ in range(Q):
        query = input().split()
        if len(query) == 1:
            head, tail = tail, head
            flg += 1
        else:
            T, F, C = query
            if int(F) == 1:
                head += C
            else:
                tail += C
    if flg % 2:
        print(head[::-1] + S[::-1] + tail)
    else:
        print(head[::-1] + S + tail)
main()
Buggy python submission (verdict: Runtime Error):
n = int(input())

w = list(map(int, input().split()))

subs = []
s = 0
for i in range(n):
    s += w[i]
    subs.append(s)

ans = 1000
for i in range(n-1):
    a = abs(subs[-1] - 2*subs[i])
    ans = min(ans, a)

print(ans)

Fixed submission:
p, q, r = map(int, input().split())

print(min(min(p+q, q+r), p+r))
Buggy python submission (verdict: Runtime Error):
from fractions import *
import sys
N, M = map(int, input().split())

a = list(map(int, input().split()))

a = sorted(a)
bc = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]

bc = sorted(bc)    

subar = a
for i in bc:
    sc = [i[1]] * i[0]
    suba = []
    ra = subar[i[0]:]
    if i[0] == len(a):
        suba = a
    suba = subar[:i[0]]
    if i[1] - max(suba) < 0:
        continue
    subar = sc + ra
    subar.sort()

print(sum(subar))





Fixed submission:
from fractions import *
a, b = map(int, input().split())

if a<= 5:
    print(0)
elif 6 <= a and a <= 12:
    print(int(b/2))
else:
    print(b)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import *
import sys
N, M = map(int, input().split())

a = list(map(int, input().split()))

a = sorted(a)
bc = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]

bc = sorted(bc)    

subar = a
for i in bc:
    sc = [i[1]] * i[0]
    suba = []
    ra = subar[i[0]:]
    if i[0] == len(a):
        suba = a
    suba = subar[:i[0]]
    if i[1] - max(suba) < 0:
        continue
    subar = sc + ra
    subar.sort()

print(sum(subar))





Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

pairs = [list(map(int, input().split())) for _ in range(m)]
pairs = sorted(pairs, key=lambda x: x[1])
cnt = 0
ans = 0
while cnt < n:
    if pairs != [] and a[-1] < pairs[-1][1] and cnt+pairs[-1][0] <= n:
        cnt += pairs[-1][0]
        ans += pairs[-1][0]*pairs[-1][1]
        pairs.pop(-1)
    elif pairs != [] and a[-1] < pairs[-1][1] and cnt+pairs[-1][0] > n:
        ans += (n - cnt)*pairs[-1][1]
        cnt += n - cnt
        break
    else:
        cnt+= 1
        ans += a[-1]
        a.pop(-1)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from fractions import *
N, M = map(int, input().split())

a = list(map(int, input().split()))

a = sorted(a)
bc = [list(map(int, input().split())) for i in range(M)]

bc = sorted(bc)    

subar = a
for i in bc:
    sc = [i[1]] * i[0]
    suba = []
    ra = subar[i[0]:]
    if i[0] == len(a):
        suba = a
    suba = subar[:i[0]]
    if i[1] - max(suba) < 0:
        continue
    subar = sc + ra
    subar.sort()

print(sum(subar))





Fixed submission:
n, m = map(int, input().split())
a = list(map(int, input().split()))

a.sort()

pairs = [list(map(int, input().split())) for _ in range(m)]
pairs = sorted(pairs, key=lambda x: x[1])
cnt = 0
ans = 0
while cnt < n:
    if pairs != [] and a[-1] < pairs[-1][1] and cnt+pairs[-1][0] <= n:
        cnt += pairs[-1][0]
        ans += pairs[-1][0]*pairs[-1][1]
        pairs.pop(-1)
    elif pairs != [] and a[-1] < pairs[-1][1] and cnt+pairs[-1][0] > n:
        ans += (n - cnt)*pairs[-1][1]
        cnt += n - cnt
        break
    else:
        cnt+= 1
        ans += a[-1]
        a.pop(-1)

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

b = 0

ans = []

s = list(S)

for i in s:
  if (i == 'A' or i == 'G' or i == 'C' or i == 'T'):
    b += 1
  else:
    ans.append(b)
    b = 0
print(max(ans))   

Fixed submission:
S = list(input())

b = 0

ans = [0]

for n, i in enumerate(S, 1):
  if (i == 'A' or i == 'G' or i == 'C' or i == 'T'):
    b += 1
  else:
    b = 0
  ans.append(b)
print(max(ans))

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

b = 0

ans = []

for i in s:
  if (i == 'A' or i == 'G' or i == 'C' or i == 'T'):
    b += 1
  else:
    ans.append(b)
    b = 0

print(max(ans))   

Fixed submission:
S = list(input())

b = 0

ans = [0]

for n, i in enumerate(S, 1):
  if (i == 'A' or i == 'G' or i == 'C' or i == 'T'):
    b += 1
  else:
    b = 0
  ans.append(b)
print(max(ans))
Buggy python submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
 
B = list(map(int, input().split()))
 
ans = 0
 
src = []

for i in range(N):
  src.append(list(map(int, input().split()))) 
  
for i in range(N):
  d += C
  for n in range(M):
    d += src[i][n]*B[n]
  print(d)
  if (d > 0):
    ans+= 1

print(ans)

Fixed submission:
N, M, C = map(int, input().split())
 
B = list(map(int, input().split()))
 
ans = 0
 
src = []

for i in range(N):
  src.append(list(map(int, input().split()))) 
  
for i in range(N):
  d = C
  for n in range(M):
    d += src[i][n]*B[n]
  if (d > 0):
    ans+= 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, C = map(int, input().split())
 
B = list(input().split())
 
ans = []
 
src = []
 
for i in range(N):
  src.append(list(map(int, input().split())))
  
  for n in range(M):
    d = src[i][n]*B[n] + C
    if (d > 0):
      ans.append(1)
 
print(ans.count(1))

Fixed submission:
N, M, C = map(int, input().split())
 
B = list(map(int, input().split()))
 
ans = 0
 
src = []

for i in range(N):
  src.append(list(map(int, input().split()))) 
  
for i in range(N):
  d = C
  for n in range(M):
    d += src[i][n]*B[n]
  if (d > 0):
    ans+= 1

print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, C = map(int, input().split())

B = list(input().split())

ans = []

src = []

for i in range(N):
  src.append(list(map(int, input().split())))
  
  for n in range(N):
    d = src[i][n]*B[n] + C
    if (d > 0):
      ans.append(1)

print(ans.count(1))

  
  

Fixed submission:
N, M, C = map(int, input().split())
 
B = list(map(int, input().split()))
 
ans = 0
 
src = []

for i in range(N):
  src.append(list(map(int, input().split()))) 
  
for i in range(N):
  d = C
  for n in range(M):
    d += src[i][n]*B[n]
  if (d > 0):
    ans+= 1

print(ans)
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())

ans = 0

lista = list(range(a+1))
aa = lista.pop(0)

listb = list(range(b+1))
bb = listb.pop(0)

if (a < b):
    li = [i for i in lista if a % i == 0 and b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]
else:
    li = [i for i in listb if a % i == 0 and b % i == 0]
    li = sorted(li, reverse=True)
    ans = li[k-1]

print(ans)

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

ans = 0

if (b < a):
    ans = 0
elif (b / a < c):
    ans = int(b / a)
else:
    ans = c

print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())

b = []

for i in range(a):
    b.append(input().split())

res = 0

for i in b:
    if (i[1] == 'BTC'):
        res += int(i[0])*380000
    else:
        res += int(i[0])

print(res) 

Fixed submission:
a = str(input())

a = a[:4] + a[5:7] + a[8:]

a = int(a)

if (a > 20190430):
    print('TBD')
else:
    print('Heisei')

Buggy python submission (verdict: Runtime Error):
a = int(input())

b = []

for i in range(a):
    b.append(input().split())

res = 0

for i in b:
    if (i[1] == 'BTC'):
        res += i[0]*380000
    else:
        res += i[0]

print(res) 

Fixed submission:
a = str(input())

a = a[:4] + a[5:7] + a[8:]

a = int(a)

if (a > 20190430):
    print('TBD')
else:
    print('Heisei')

Buggy python submission (verdict: Runtime Error):
a = str(input.split())

a = int(a[:4]) + int(a[5:7]) + int(a[8:])

if (a > 20190430):
    print('TBD')
else:
    print('Heisei') 

Fixed submission:
a = str(input())

a = a[:4] + a[5:7] + a[8:]

a = int(a)

if (a > 20190430):
    print('TBD')
else:
    print('Heisei')

Buggy python submission (verdict: Runtime Error):
a = str(input.split())

a = int(a[0][:4]) + int(a[0][5:7]) + int(a[0][8:])

if (a > 20190430):
    print('TBD')
else:
    print('Heisei') 

Fixed submission:
a = str(input())

a = a[:4] + a[5:7] + a[8:]

a = int(a)

if (a > 20190430):
    print('TBD')
else:
    print('Heisei')

Buggy python submission (verdict: Runtime Error):
a = list(map(string, input.split()))

a = int(a[0][:4]) + int(a[0][5:7]) + int(a[0][8:])

if (a > 20190430):
    print('TBD')
else:
    print('Heisei') 

Fixed submission:
a = str(input())

a = a[:4] + a[5:7] + a[8:]

a = int(a)

if (a > 20190430):
    print('TBD')
else:
    print('Heisei')
Buggy python submission (verdict: Runtime Error):
m = list(map(int, input().split()))

hp = list(map(int, input().split()))
result = 0
checkyakusuru = []
checkodd = []
checkeven = []

if (hp.count(hp[0]) == m[0]):
    result = hp[0]

minhp = min(hp)

for p in hp:
    if (p % minhp == 0):
        checkyakusuru.append(1)
    
    if (checkyakusuru.count(1) == m[0]):
        result = p
        break
    else:
        if (p % 2 == 0):
            checkeven.append(1)
        if (checkeven.count(1) == m[0]):
            result = 2
            break
        else:
            result = 1

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

def f(a, b):
    if (b % a == 0):
        return a + b 
    else:
        return b - a 
print(f(a[0], a[1]))

Buggy python submission (verdict: Runtime Error):
m = list(map(int, input().split()))

hp = list(map(int, input().split()))
result = 0
checkyakusuru = []
checkodd = []
checkeven = []

if (hp.count(hp[0]) == m[0]):
    result = hp[0]

minhp = min(hp)

for p in hp:
    if (p % minhp == 0):
        checkyakusuru.append(1)
    
    if (checkyakusuru.count(1) == m[0]):
        result = p
        break
    else:
        if (p % 2 == 0):
            checkeven.append(1)
        if (checkeven.count(1) == m[0]):
            result = 2
        else:
            result = 1

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

def f(a, b):
    if (b % a == 0):
        return a + b 
    else:
        return b - a 
print(f(a[0], a[1]))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []
 
X.sort()
 
for i in range(M-1):
  dif = X[i+1] -X[i]
  diff.append(dif)
  
diff.sort()
 
for n in range(N):
  diff.pop(-1)
 
for i in range(len(diff)):
  ans += diff[i]

print(ans)

Fixed submission:
T, X = map(int, input().split())
  
ans = T / X
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
L = list(input().split())
b=0
L.sort()
 
a = L.pop(-1)
 
for i in range(N-1):
  b += L[i]
 
if (a < b):
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
b=0
L.sort()
 
a = L.pop(-1)
 
for i in range(N-1):
  b+= L[i]
 
if (a < b):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N = input()
L = list(input().split())
b=0
L.sort()
 
a = L.pop(-1)
 
for i in range(N-1):
  b+= L[i]
 
if (a < b):
  print("Yes")
else:
  print("No")

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
b=0
L.sort()
 
a = L.pop(-1)
 
for i in range(N-1):
  b+= L[i]
 
if (a < b):
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N = input()
L = input().split()
b=0
L.sort()

a = L.pop(-1)

for i in range(N-1):
  b+= L[i]

if (a < b):
  print("Yes")
else:
  print("No")



Fixed submission:
N = int(input())
L = list(map(int, input().split()))
b=0
L.sort()
 
a = L.pop(-1)
 
for i in range(N-1):
  b+= L[i]
 
if (a < b):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []
 
X.sort()
 
for i in range(M-1):
  dif = X[i+1] -X[i]
  diff.append(dif)
  
diff.sort()
 
for n in range(N):
  diff.pop(-1)
 
for i in range(len(diff)):
  ans += diff[i]

print(ans)

Fixed submission:
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []
 
X.sort()
 
if (N < M): 
    for i in range(M-1):
        dif = X[i+1] - X[i]
        diff.append(dif)
    
    diff.sort()
    
    for i in range(M-N):
        ans += diff[i]
    # for n in range(N):
    #     diff.pop(-1)
   
    # for i in range(len(diff)):
    #     ans += diff[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []
 
X.sort()
 
for i in range(M-1):
  dif = X[i+1] -X[i]
  diff.append(dif)
  
diff.sort()
 
for n in range(N):
  diff.pop(-1)
 
for i in range(len(diff)):
  ans += diff[i]

print(ans)

Fixed submission:
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []
 
X.sort()
 
if (N < M): 
    for i in range(M-1):
        dif = X[i+1] - X[i]
        diff.append(dif)
    
    diff.sort()
    
    for i in range(M-N):
        ans += diff[i]
    # for n in range(N):
    #     diff.pop(-1)
   
    # for i in range(len(diff)):
    #     ans += diff[i]
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []

X.sort()

for i in range(M-1):
  dif = X[i+1] -X[i]
  diff.append(dif)
  
diff.sort()

for n in range(N):
  diff.pop(-1)

for i in range(len(diff)):
  ans += diff[i]


Fixed submission:
N, M = map(int, input().split())
X = list(map(int, input().split()))
ans = 0
diff = []
 
X.sort()
 
if (N < M): 
    for i in range(M-1):
        dif = X[i+1] - X[i]
        diff.append(dif)
    
    diff.sort()
    
    for i in range(M-N):
        ans += diff[i]
    # for n in range(N):
    #     diff.pop(-1)
   
    # for i in range(len(diff)):
    #     ans += diff[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
s = int(input())

ans = 0

if (s == 1 || s == 2 || s == 4):
  print(4)

while (s != 4):
  if (s % 2 == 0):
    s /= 2
  else:
    s = 3*s + 1
  ans += 1

print(ans+4)


  

Fixed submission:
s = int(input())
 
ans = 0
 
if (s == 1 or s == 2 or s == 4):
  print(4)
else:
  while (s != 4):
    if (s % 2 == 0):
      s  =  int(s/2)
    else:
      s = 3*s + 1
    ans += 1
  
 
  print(ans+4)

Buggy python submission (verdict: Time Limit Exceeded):
s = int(input())
 
ans=0
 
def f(n):
  if (n % 2 == 0):
    return n / 2
  else:
    return 3*n + 1
  
while (True):
  a_n = [s]
  for i in range(len(a_n)):
    a_i  = f(a_n.pop(-1))
    a_n.append(a_i)
    
print(ans)

Fixed submission:
s = int(input())
 
ans = 0
 
if (s == 1 or s == 2 or s == 4):
  print(4)
else:
  while (s != 4):
    if (s % 2 == 0):
      s  =  int(s/2)
    else:
      s = 3*s + 1
    ans += 1
  
 
  print(ans+4)

Buggy python submission (verdict: Time Limit Exceeded):
s = int(input())
 
ans=0
 
def f(n):
  if (n % 2 == 0):
    return n / 2
  else:
    return 3*n + 1
  
while (True):
  a_n = [s]
  for i in range(len(a_n)):
    if (a_n.count(4) != 2):
      a_i = f(a_n.pop(-1))
      a_n.append(a_i)
    else:
      index = a_n.index(4)
      ans = a_n[index+3]
      break
    
print(ans)

Fixed submission:
s = int(input())
 
ans = 0
 
if (s == 1 or s == 2 or s == 4):
  print(4)
else:
  while (s != 4):
    if (s % 2 == 0):
      s  =  int(s/2)
    else:
      s = 3*s + 1
    ans += 1
  
 
  print(ans+4)

Buggy python submission (verdict: Runtime Error):
s = int(input())
 
ans=0
 
def f(n):
  if (n % 2 == 0):
    return n / 2
  else:
    return 3*n + 1
  
while (True):
  a_n = [s]
  for i in len(a_n):
    if (a_n.count(4) != 2):
      a_i = f(a_n.pop(-1))
      a_n.append(a_i)
    else:
      index = a_n.index(4)
      ans = a_n[index+3]
      break
    
print(ans)

Fixed submission:
s = int(input())
 
ans = 0
 
if (s == 1 or s == 2 or s == 4):
  print(4)
else:
  while (s != 4):
    if (s % 2 == 0):
      s  =  int(s/2)
    else:
      s = 3*s + 1
    ans += 1
  
 
  print(ans+4)

Buggy python submission (verdict: Runtime Error):
s = int(input())

ans=0

def f(n):
  if (n % 2 == 0):
    return f(n /2)
  else:
    return f(3*n + 1)
  
while (True):
  a_n = [s]
  if (a_n.count(4) != 2):
    a_n.append(f(s))
  else:
    index = a_n.index(4)
    ans = a_n[index+3]
    break
    
print(ans)
  
  
  



Fixed submission:
s = int(input())
 
ans = 0
 
if (s == 1 or s == 2 or s == 4):
  print(4)
else:
  while (s != 4):
    if (s % 2 == 0):
      s  =  int(s/2)
    else:
      s = 3*s + 1
    ans += 1
  
 
  print(ans+4)
Buggy python submission (verdict: Runtime Error):
N = int(input())


# N以下の753数を全列挙
def dfs(s):
  if int(s) > N:
    return 0
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0
  for c in '753':
    ret += dfs(s + c)
    
print(dfs('0'))

Fixed submission:
N = int(input())


# N以下の753数を全列挙
def dfs(s):
  if int(s) > N:
    return 0
  ret = 1 if all(s.count(c) > 0 for c in '753') else 0
  for c in '753':
    ret += dfs(s + c)
  return ret
    
print(dfs('0'))
Buggy python submission (verdict: Runtime Error):
c1 = input()
c2 = input()
c3 = inpnt()

print(c1[0]+c2[1]+c3[2])

Fixed submission:
c1 = input()
c2 = input()
c3 = input()

print(c1[0]+c2[1]+c3[2])
Buggy python submission (verdict: Runtime Error):
N = int(input())
 
S = list(map(int, input().split()))
 
color = [0, 0, 0, 0]
 
for s in S:
  if (color.count(0) == 0):
    print("Four")
    break
  
  if (s == "P"):
    color[0] += 1
  elif (s == "G"):
    color[1] += 1
  elif (s == "W"):
    color[2] += 1
  else:
    color[3] += 1
  
if (color.count(0) == 1):
  print(Three)

Fixed submission:
N = int(input())

ans = N / 3
print(int(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())

S = list(map(int, input().split()))

color = [0, 0, 0, 0]

for s in S:
  if (s == "P"):
    color[0] += 1
  elif (s == "G"):
    color[1] += 1
  elif (s == "W"):
    color[2] += 1
  else:
    color[3] += 1
  
if (color.count(0) == 3):
  print(Three)
else:
  print(Four)

Fixed submission:
N = int(input())
 
S = list(map(str, input().split()))
 
color = [0, 0, 0, 0]
 
for s in S:
  if (color.count(0) == 0):
    print("Four")
    break
  
  if (s == "P"):
    color[0] += 1
  elif (s == "G"):
    color[1] += 1
  elif (s == "W"):
    color[2] += 1
  else:
    color[3] += 1
  
if (color.count(0) == 1):
  print("Three")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 0

while len(A) == N:
  A = [a for a in A if a % 2 == 0]
  if len(A) == N:
    ans += 1
    
print(ans)
    

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

ans = 0

while True:
  exist_odd = False
  for a in A:
    if a % 2 != 0:
      exist_odd = True
  if exist_odd:
    break
  for i in range(N):
    A[i] /= 2
  ans += 1
  
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split()))

if A == B:
    print(C)
elif B == C:
    print(A)
else:
    print(B)

Fixed submission:
A, B, C = map(int, input().split())

if A == B:
    print(C)
elif B == C:
    print(A)
else:
    print(B)
Buggy python submission (verdict: Runtime Error):
x, a, b = map(int, input().split())

if abs(x-a) > abs(x-b):
  print(B)
else:
  print(A)

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

if abs(x-a) > abs(x-b):
  print('B')
else:
  print('A')
Buggy python submission (verdict: Runtime Error):
n, m = input().split()

print((n-1)*(m-1))

Fixed submission:
n, m = map(int, input().split())

print((n-1)*(m-1))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = list(map(int, input().split()))

sorted_a = sorted(a)

aa = []
for i in range(n):
    sorted_a.pop(-1)
    sorted_a.pop(0)
    aa.append(sorted_a.pop(-1))

print(sum(aa))

Fixed submission:
import sys 
n = int(input())

a = list(map(int, sys.stdin.readline().split()))

sorted_a = sorted(a)
reversed_a = sorted(a, reverse=True)

aa = []
for i in range(n):
    sorted_a.pop(-1)
    reversed_a.pop(-1)
    aa.append(sorted_a.pop(-1))

print(sum(aa))

Buggy python submission (verdict: Runtime Error):
n = int(input())

a = list(map(int, input().split()))

sorted_a = sorted(a)
reversed_a = reversed(a)

aa = []
for i in range(3*n):
    sorted_a.pop(-1)
    reversed_a.pop(-1)
    aa.append(sorted_a.pop(-1))

print(sum(aa))

Fixed submission:
import sys 
n = int(input())

a = list(map(int, sys.stdin.readline().split()))

sorted_a = sorted(a)
reversed_a = sorted(a, reverse=True)

aa = []
for i in range(n):
    sorted_a.pop(-1)
    reversed_a.pop(-1)
    aa.append(sorted_a.pop(-1))

print(sum(aa))
Buggy python submission (verdict: Runtime Error):
from fractions import *
n = int(input())
s = input()

x = 0
ans = 0
for i in range(N):
    if s[i] == 'I':
        x += 1
    else:
        x -= 1
    ans = max(x, ans)

print(ans)

Fixed submission:
from fractions import *
n = int(input())
s = input()

x = 0
ans = 0
for i in range(n):
    if s[i] == 'I':
        x += 1
    else:
        x -= 1
    ans = max(x, ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
import copy
n = int(input())

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

for i in range(M):
    copy_t = copy.copy(t)
    p, x  = map(int, input().split())
    copy_t[p-1] = x
    print(sum(copy_t))

Fixed submission:
import copy
n = int(input())

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

for i in range(m):
    copy_t = copy.copy(t)
    p, x  = map(int, input().split())
    copy_t[p-1] = x
    print(sum(copy_t))