Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())

rtn = int(math.sqrt(N))

used = [[0]*3]*N

count = [0] * N


if N <= 5:
    for x in range(N):
        print(count[x])
else:
    for n in range(6,N):
        #print(n)
        for x in range(1,rtn):
            #print(x)
            xx = x**2
            if xx <= n - 5:
                #print("xpath")
                for y in range(1,rtn):
                    #print(x,y)
                    xy = x*y
                    yy = y**2
                    ysum = xx+yy+xy
                    if ysum <= n-3:
                        #print("ypath")
                        for z in range(1,rtn):
                            #print(x,y,z)
                            zz = z**2
                            xz = x*z
                            yz = y*z
                            result = ysum+zz+xz+yz
                            if result > n:
                                break
                            if result == n:
                                count[n-1] += 1
                                #print("zpath")
                                used.append
    for x in range(N):
        print(count[x])


Fixed submission:
L, R, d = [int(x) for x in input().split()]

count = 0

for x in range(L,R+1):
    if x % d == 0:
        count += 1

print(count)

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

N = int(input())

rtn = int(math.sqrt(N)) + 1 

used = []

count = [0] * N


if N <= 5:
    for x in range(N):
        print(count(x))
else:
    for n in range(6,N):
        print(n)
        for x in range(1,rtn):
            #print(x)
            xx = x**2
            if xx <= n - 5:
                #print("xpath")
                for y in range(1,rtn):
                    #print(x,y)
                    xy = x*y
                    yy = y**2
                    ysum = xx+yy+xy
                    if ysum <= n-3:
                        #print("ypath")
                        for z in range(1,rtn):
                            #print(x,y,z)
                            zz = z**2
                            xz = x*z
                            yz = y*z
                            result = ysum+zz+xz+yz
                            if result > n:
                                break
                            if result == n:
                                count[n-1] += 1
                                #print("zpath")
    for x in range(N):
        print(count[x])

Fixed submission:
L, R, d = [int(x) for x in input().split()]

count = 0

for x in range(L,R+1):
    if x % d == 0:
        count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
c = [0] * 4
for i in range(N):
    X = input()
    if X == "AC":
        c[0] += 1
    elif X == "WA":
        c[1] += 1
    elif X == "TLE":
        c[2] += 1
    else:
        c[3] += 1
print("""AC x {}
WA x {}
TLE x {}
RE x {}""".format(c[0],c[1],c[2],c[3]))

Fixed submission:
x = int(input())

while 1:
    x = x - 1000
    if x <= 0:
        break

print(abs(x))
Buggy python submission (verdict: Runtime Error):
nums=input()
nums=nums.split()
M,N,K = int(nums[0]),int(nums[1]),int(nums[2])

al=input()
al2=al.split()
for n in range(M):
    al2[n] = int(al2[n])

bl=input()
bl2=bl.split()
for n in range(N):
    bl2[n] = int(bl2[n])

count=0

ai=0
bi=0

while 1:
    if al2[ai] <= bl2[bi] and al2[ai] <= K:
        K = K-al2[ai]
        ai+=1
        count+=1
        

    elif al2[ai] > bl2[bi] and bl2[bi] <= K:
        K = K-bl2[bi]
        bi+=1
        count+=1
    else:
        break

print(count)

Fixed submission:
a = input()
a = int(a)
print(a+a*a+a*a*a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(x) for x in input().split()]

result = 1

for x in range(N):
    result = result * A[x]
if result >= 10**18 + 1:
    print(-1)
else:
    print(result)

Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]

result = 1

if A.count(0) == 0:
    for x in range(N):
        result = result * A[x]
        if result >= 10**18 + 1:
            print(-1)
            exit()
    print(result)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

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

ans = 0
for pair in itertools.combinations(A, 2):
    ans += pair[0] * pair[1]
    ans = ans % (10**9+7)

print(ans)


Fixed submission:
'''
（公式解説参照）
A[i]*A[i+1]+A[i]*A[i+2]+…+A[i]*A[N]=A[i]*(A[i+1]+A[i+2]+…+A[N])
リストAに対する累積和を求めておく
'''
N = int(input())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

# 累積和
total = []
total.append(A[0])
for i in range(1, N):
    total.append(total[i-1] + A[i])
# print(total)

# iの値について全探索
ans = 0
for i in range(N):
    tmp = (total[-1] - total[i])
    ans += A[i] * tmp
    ans %= MOD

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
'''
参考
https://marco-note.net/abc-175-work-log/
'''
N, K = map(int, input().split())        # コマ数、最大移動可能回数
P = list(map(int, input().split()))     # 移動先のコマ番号
C = list(map(int, input().split()))     # そのコマに立ち寄った時に加算される得点

ans = -float('inf')             # 解を-∞で初期化

for piece in range(N):          # 各コマについて、スタート地点とした場合の得点を調べる
    S = []                      # 累積和
    mov = P[piece] - 1          # 1回目の移動：移動先（indexなので-1する）
    S.append(C[mov])            # 1回目の移動：得点

    while mov != piece:             # 2回目以降の移動（スタート地点に戻ったらループ終了）
        mov = P[mov] - 1            # 2回目以降：移動先
        S.append(S[-1] + C[mov])    # 2回目以降：得点（最終要素に加算した値をリストに追加）
    
    if K <= len(S):             # 【パターン1】与えられた移動可能回数では一巡できない
        score = max(S[:K])      # 得点=移動可能回数までの最大得点
    elif S[-1] <= 0:            # 【パターン2】一巡できるが一巡してしまうと得点が減る
        score = max(S)          # 得点=一巡するまでの最大得点
    else:
        score_a = S[-1] * (K // len(S))     # 【パターン3-1】与えられた移動可能回数で廻れるだけ廻る
        rem = K % len(S)
        if rem != 0:
            score_a += max(0, max(S[:rem]))
        score_b = S[-1] * (K // len(S) - 1) # 【パターン3-2】1周少なく廻りあとは最高得点のところで止める
        score_b += max(S)
        score = max(score_a, score_b)
    
    ans = max(ans, score)

print(ans)

Fixed submission:
'''
参考
https://marco-note.net/abc-175-work-log/
'''
N, K = map(int, input().split())        # コマ数、最大移動可能回数
P = list(map(int, input().split()))     # 移動先のコマ番号
C = list(map(int, input().split()))     # そのコマに立ち寄った時に加算される得点

ans = -float('inf')             # 解を-∞で初期化

for piece in range(N):          # 各コマについて、スタート地点とした場合の得点を調べる
    S = []                      # 累積和
    mov = P[piece] - 1          # 1回目の移動：移動先（indexなので-1する）
    S.append(C[mov])            # 1回目の移動：得点

    while mov != piece:             # 2回目以降の移動（スタート地点に戻ったらループ終了）
        mov = P[mov] - 1            # 2回目以降：移動先
        S.append(S[-1] + C[mov])    # 2回目以降：得点（最終要素に加算した値をリストに追加）
    
    if K <= len(S):             # 【パターン1】与えられた移動可能回数では一巡できない
        score = max(S[:K])      # 得点=移動可能回数までの最大得点
    elif S[-1] <= 0:            # 【パターン2】一巡できるが一巡してしまうと得点が減る
        score = max(S)          # 得点=一巡するまでの最大得点
    else:
        score_a = S[-1] * (K // len(S))     # 【パターン3-1】与えられた移動可能回数で廻れるだけ廻る
        rem = K % len(S)
        if rem != 0:
            score_a += max(0, max(S[:rem]))
        score_b = S[-1] * (K // len(S) - 1) # 【パターン3-2】1周少なく廻りあとは最高得点のところで止める
        score_b += max(S)
        score = max(score_a, score_b)
    
    ans = max(ans, score)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

for n in range(1, N+1):
    ans = 0
    for x in range(1, N+1):
        for y in range(1, N-x+1):
            for z in range(1, N-x-y+1):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                    ans += 1
    print(ans)


Fixed submission:
N = int(input())
ans = [0] * N

for x in range(1, int(N**0.5)+1):
    for y in range(1, int(N**0.5)+1):
        for z in range(1, int(N**0.5)+1):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n <= N:
                ans[n-1] += 1

for n in range(N):
    print(ans[n])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

for n in range(1, N+1):
    ans = 0
    for x in range(1, N+1):
        for y in range(1, N+1):
            for z in range(1, N+1):
                if x**2 + y**2 + z**2 + x*y + y*z + z*x == n:
                    ans += 1
    print(ans)


Fixed submission:
N = int(input())
ans = [0] * N

for x in range(1, int(N**0.5)+1):
    for y in range(1, int(N**0.5)+1):
        for z in range(1, int(N**0.5)+1):
            n = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if n <= N:
                ans[n-1] += 1

for n in range(N):
    print(ans[n])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

N, M, K = map(int, input().split())
A = deque(list(map(int, input().split())))
B = deque(list(map(int, input().split())))

if sum(A) + sum(B) < K:
    print(N + M)
    exit()

ans = 0

while K > 0:
    if len(A) != 0:
        # if len(B) == 0 or A[0] <= B[0]:
        if len(B) == 0 or sum(A) <= sum(B):
            if A[0] <= K:
                K -= A.popleft()
                ans += 1
                continue
    if len(B) != 0:
        # if len(A) == 0 or A[0] >= B[0]:
        if len(A) == 0 or sum(A) >= sum(B):
            if B[0] <= K:
                K -= B.popleft()
                ans += 1
                continue

print(ans)


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

# 累積和の算出
A_sum, B_sum = [0], [0]
for i, a in enumerate(A):
    A_sum.append(A_sum[i] + a)
for i, b in enumerate(B):
    B_sum.append(B_sum[i] + b)

ans = 0
j = M

# 机Aの本を読む所要時間:A_sum[i] … iの値を0から増やしていく
# 机Bの本を読む所要時間:B_sum[j] … iの値を固定し、Mから減らしていく
# A_sum[i]+B_sum[j]がKに収まるiとjの値を見つけ出し、i+jの値を出す
# iの値を増やしながら上記を繰り返し、i+jの最大値が解となる
for i in range(N+1):
    if A_sum[i] > K:
        break
    while B_sum[j] > K - A_sum[i]:
        j -= 1
    ans = max(ans, i+j)

print(ans)
Buggy python submission (verdict: Runtime Error):
'''
参考
https://drken1215.hatenablog.com/entry/2020/06/21/224900
'''
N = int(input())
A = list(map(int, input().split()))

INF = 10 ** 5
cnt = [0] * INF
total = 0

for a in A:
    cnt[a] += 1
    total += a

Q = int(input())
BC = []

for _ in range(Q):
    BC.append(list(map(int, input().split())))

for b, c in BC:
    cnt[c] += cnt[b]
    total += (c-b) * cnt[b]
    cnt[b] = 0
    print(total)


Fixed submission:
'''
参考
https://drken1215.hatenablog.com/entry/2020/06/21/224900
'''
N = int(input())
A = list(map(int, input().split()))

INF = 10 ** 5
cnt = [0] * (INF+1)

Q = int(input())
BC = []

for _ in range(Q):
    BC.append(list(map(int, input().split())))

for a in A:
    cnt[a] += 1

total = sum(A)

for b, c in BC:
    total += (c-b) * cnt[b]
    cnt[c] += cnt[b]
    cnt[b] = 0
    print(total)

Buggy python submission (verdict: Runtime Error):
'''
参考
https://drken1215.hatenablog.com/entry/2020/06/21/224900
'''
N = int(input())
A = list(map(int, input().split()))

INF = 10 ** 5
cnt = [0] * INF
total = 0

for a in A:
    cnt[a] += 1
    total += a

Q = int(input())

for _ in range(Q):
    B, C = map(int, input().split())
    cnt[C] += cnt[B]
    total += (C-B) * cnt[B]
    cnt[B] = 0
    print(total)


Fixed submission:
'''
参考
https://drken1215.hatenablog.com/entry/2020/06/21/224900
'''
N = int(input())
A = list(map(int, input().split()))

INF = 10 ** 5
cnt = [0] * (INF+1)

Q = int(input())
BC = []

for _ in range(Q):
    BC.append(list(map(int, input().split())))

for a in A:
    cnt[a] += 1

total = sum(A)

for b, c in BC:
    total += (c-b) * cnt[b]
    cnt[c] += cnt[b]
    cnt[b] = 0
    print(total)
Buggy python submission (verdict: Runtime Error):
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()
else:
    P = list(map(int, input().split()))

n_P = []

for i in range(1, 100):
    if i not in P:
        n_P.append(i)

n_P.sort()
INF = 10 ** 9
diff = INF
ans = INF

for p in n_P:
    if abs(X-p) < diff:
        diff = abs(X-p)
        ans = p

if abs(X-ans) > abs(X-n_P[-1]+1):
    ans = n_P[-1] + 1
if abs(X-ans) > abs(X-n_P[0]-1):
    ans = n_P[0] - 1

print(ans)


Fixed submission:
X, N = map(int, input().split())
if N == 0:
    print(X)
    exit()
else:
    P = list(map(int, input().split()))

n_P = []

for i in range(1, 100):
    if i not in P:
        n_P.append(i)

n_P.append(0)
n_P.append(101)

n_P.sort()
INF = 10 ** 9
diff = INF
ans = INF

for p in n_P:
    if abs(X-p) < diff:
        diff = abs(X-p)
        ans = p

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
INF = 10 ** 18

ans = A[0]

for i in range(1, N):
    if A[i] == 0:
        print(0)
        exit()
    ans = ans * A[i]

if ans > INF:
    print(-1)
else:
    print(ans)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
INF = 10 ** 18

if 0 in A:
    print(0)
    exit()

A.sort(reverse=True)
ans = A[0]

for i in range(1, N):
    if A[i] > INF:
        print(-1)
        exit()
    if A[i] == 1:
        break
    ans = ans * A[i]
    if ans > INF:
        print(-1)
        exit()

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator

N = int(input())
A = list(map(int, input().split()))
INF = 10 ** 18

prod = functools.partial(functools.reduce, operator.mul)

if prod(A) > INF:
    print(-1)
else:
    print(prod(A))


Fixed submission:
N = int(input())
A = list(map(int, input().split()))
INF = 10 ** 18

if 0 in A:
    print(0)
    exit()

A.sort(reverse=True)
ans = A[0]

for i in range(1, N):
    if A[i] > INF:
        print(-1)
        exit()
    if A[i] == 1:
        break
    ans = ans * A[i]
    if ans > INF:
        print(-1)
        exit()

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, A, B = map(int, input().split())
ball = 0
cnt = 0

while N > 0:
  if cnt % 2 == 0:	# 青
    i = min(A, N)
    ball += i
  else:				# 赤
    i = min(B, N)
  N -= i
  cnt += 1

print(ball)


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

if N == 0:
  print(0)
  exit()

cnt = N // (A + B)
rem = N % (A + B)

ans = 0

if rem >= A:
  ans = A * (cnt + 1)
else:
  ans = A * cnt + rem

print(ans)

Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
ball = ''
cnt = 0

while N > 0:
  if cnt % 2 == 0:	# 青
    i = min(A, N)
    ball = ball + 'b' * i
  else:				# 赤
    i = min(B, N)
    ball = ball + 'r' * i
  N -= i
  cnt += 1

print(ball.count('b'))


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

if N == 0:
  print(0)
  exit()

cnt = N // (A + B)
rem = N % (A + B)

ans = 0

if rem >= A:
  ans = A * (cnt + 1)
else:
  ans = A * cnt + rem

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []

for _ in range(N):
  S.append(input())

S_dict = sorted(list(set(S)))
#print(S_dict)
cnt = [0] * len(S_dict)

for i, item in enumerate(S_dict):
  cnt[i] = S.count(item)
#print(cnt)

m_cnt = max(cnt)

for i, item in enumerate(cnt):
  if m_cnt == item:
    print(S_dict[i])


Fixed submission:
import collections

# input
N = int(input())
S = []

for _ in range(N):
  S.append(input())

cnt = collections.Counter(S)
cnt_sorted = sorted(cnt.items(), key=lambda x:x[1], reverse=True)
#print(cnt_sorted)

max = 0
pre = 0
ans = []
for v in cnt_sorted:
  max = v[1]
  if max >= pre:
    ans.append(v[0])
    pre = max
  else:
    break

ans.sort()
for a in ans:
  print(a)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
ans = 1

for i in range(1, N):
    if P[i] <= min(P[:i]):
        ans += 1

print(ans)


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

'''
参考
https://cocoinit23.com/abc152/
すべての(i, j)を調べていると制限時間を超過してしまう。
listの2つ目の要素(index=1)から順に見ていって、最小値が更新されたら解をカウントアップする。
ただし、解の最小値は常に1となるので、解の初期値は1にしておくこと。
'''
ans = 1
min_p = P[0]

for i in range(1, N):
    if P[i] <= min_p:
        min_p = P[i]
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 0

for i in reversed(range(len(P))):
  for j in reversed(range(i)):
    if P[i] <= P[j]:
      if j == 0:
        cnt += 1
      pass
    else:
      break

cnt += 1
print(cnt)


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

'''
参考
https://cocoinit23.com/abc152/
すべての(i, j)を調べていると制限時間を超過してしまう。
listの2つ目の要素(index=1)から順に見ていって、最小値が更新されたら解をカウントアップする。
ただし、解の最小値は常に1となるので、解の初期値は1にしておくこと。
'''
ans = 1
min_p = P[0]

for i in range(1, N):
    if P[i] <= min_p:
        min_p = P[i]
        ans += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
cnt = 0

for i in range(len(P)):
  if P[i] == min(P[:i+1]):
    cnt += 1

print(cnt)


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

'''
参考
https://cocoinit23.com/abc152/
すべての(i, j)を調べていると制限時間を超過してしまう。
listの2つ目の要素(index=1)から順に見ていって、最小値が更新されたら解をカウントアップする。
ただし、解の最小値は常に1となるので、解の初期値は1にしておくこと。
'''
ans = 1
min_p = P[0]

for i in range(1, N):
    if P[i] <= min_p:
        min_p = P[i]
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ac = []
wa = 0

for _ in range(M):
  p_str, s = map(str, input().split())
  p = int(p_str)
  if p in ac:
    continue
  if s == 'AC':
    ac.append(p)
    p.sort
  if s == 'WA':
    wa += 1

print(len(ac), wa)


Fixed submission:
N, M = map(int, input().split())
ac = [0] * N
wa = [0] * N

for _ in range(M):
  p_str, s = map(str, input().split())
  p = int(p_str)
  if ac[p-1] == 1:
    continue
  if s == 'AC':
    ac[p-1] = 1
  if s == 'WA':
    wa[p-1] += 1

result = [x * y for (x, y) in zip(ac, wa)]
AC = sum(ac)
WA = sum(result)

print(AC, WA)
Buggy python submission (verdict: Runtime Error):
N, K, Q = map(int, input().split())
N_list = [0] * N

for _ in range(Q):
  A = int(input())
  A -= 1
  N_list[A] += 1

for i in N_list:
  if N_list[i] - Q + K > 0:
    print('Yes')
  else:
    print('No')


Fixed submission:
N, K, Q = map(int, input().split())
N_list = [0] * N

for _ in range(Q):
  A = int(input())
  A -= 1
  N_list[A] += 1

for n in N_list:
  if n + K - Q > 0:
    print('Yes')
  else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int, input().split()))
 
count = 0
flg = True
tmp = H
 
for i in range(N):
  if H[i] != min(tmp):
    H[i] -= 1
  if i!=0 and H[i-1] > H[i]:
    flg = False
    break
  tmp = H[i:]

if flg==True:
  print('Yes')
else:
  print('No')

Fixed submission:
N = int(input())
H = list(map(int, input().split()))
 
hmax = H[-1]
 
for h in reversed(H):
  if h <= hmax:
    hmax = h
    continue
  if h-1 <= hmax:
    hmax = h-1
    continue
  print('No')
  quit()

print('Yes')

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

count = 0
flg = True

for i in range(len(H)):
  if i!=len(H) and H[i] > H[i+1]:
    H[i] -= 1
  if i!=0 and H[i-1] > H[i]:
    flg = False
    break

if flg==True:
  print('Yes')
else:
  print('No')


Fixed submission:
N = int(input())
H = list(map(int, input().split()))
 
hmax = H[-1]
 
for h in reversed(H):
  if h <= hmax:
    hmax = h
    continue
  if h-1 <= hmax:
    hmax = h-1
    continue
  print('No')
  quit()

print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int, input().split()))

count = 0
flg = True

for i in range(len(H)-1):
  if H[i] > min(H[i:]):
    H[i] -= 1
  if i!=0 and H[i-1] > H[i]:
    flg = False
    break

if flg==True:
  print('Yes')
else:
  print('No')


Fixed submission:
N = int(input())
H = list(map(int, input().split()))
 
hmax = H[-1]
 
for h in reversed(H):
  if h <= hmax:
    hmax = h
    continue
  if h-1 <= hmax:
    hmax = h-1
    continue
  print('No')
  quit()

print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []

for _ in range(n):
  a.append(int(input()))

tmp = []

for i in range(len(a)):
  tmp = a[:]
  del tmp[i]
  print(max(tmp))
  tmp.clear


Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
#print(a)
a_sort = sorted(a)
#print(a_sort)

max_number = a_sort[-1]
sub_max_number = a_sort[-2]

for i in range(n):
  if a[i] == max_number:
    print(sub_max_number)
  else:
    print(max_number)

Buggy python submission (verdict: Time Limit Exceeded):
import copy

n = int(input())
a = []

for _ in range(n):
  a.append(int(input()))

tmp = []

for i in range(len(a)):
  tmp = copy.deepcopy(a)
  del tmp[i]
  print(max(tmp))
  tmp.clear


Fixed submission:
n = int(input())
a = [int(input()) for _ in range(n)]
#print(a)
a_sort = sorted(a)
#print(a_sort)

max_number = a_sort[-1]
sub_max_number = a_sort[-2]

for i in range(n):
  if a[i] == max_number:
    print(sub_max_number)
  else:
    print(max_number)
Buggy python submission (verdict: Runtime Error):
import os
from sys import stdin

seq = list(map(int, stdin.readline().split()))
for i in range(len(seq)):
    if seq[i]==0:
        print(i+1)
        return

Fixed submission:
from sys import stdin

seq = list(map(int, stdin.readline().split()))
for i in range(5):
  if seq[i]==0:
    print(i+1)
    break

Buggy python submission (verdict: Runtime Error):
import os
from sys import stdin

seq = list(map(int, stdin.readline().split()))
for i in range(len(seq)):
  if seq[i]==0:
    print(i+1)
    return


Fixed submission:
from sys import stdin

seq = list(map(int, stdin.readline().split()))
for i in range(5):
  if seq[i]==0:
    print(i+1)
    break
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
from sys import stdin


def solve(tc):
    n = int(stdin.readline().strip())
    ai = list(map(int, stdin.readline().split()))

    adj = [[] for i in range(n)]
    for i in range(n - 1):
        adj[ai[i] - 1].append(i + 1)

    for children in adj:
        print(len(children))



LOCAL_TEST = not __debug__
if LOCAL_TEST:
    infile = __file__.split('.')[0] + "-test.in"
    stdin = open(infile, 'r')

tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
    solve(tc)
    tc += 1

Fixed submission:
#!/usr/bin/env python3
from sys import stdin


def solve(tc):
    n = int(stdin.readline().strip())
    ai = list(map(int, stdin.readline().split()))

    adj = [[] for i in range(n)]
    for i in range(n - 1):
        adj[ai[i] - 1].append(i + 1)

    for children in adj:
        print(len(children))



LOCAL_TEST = not __debug__
if LOCAL_TEST:
    infile = __file__.split('.')[0] + "-test.in"
    stdin = open(infile, 'r')

tcs = 1
tc = 1
while tc <= tcs:
    solve(tc)
    tc += 1
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys

a1, a2, a3 = map(int, sys.stdin.readline().split())
if a1+a2+a3>=22:
  print('bust')
  return
print('win')

Fixed submission:
#!/usr/bin/env python3
import sys

a1, a2, a3 = map(int, sys.stdin.readline().split())
if a1+a2+a3>=22:
  print('bust')
else:
  print('win')

Buggy python submission (verdict: Runtime Error):
a1, a2, a3 = map(int, stdin.readline().split())
if a1+a2+a3>=22:
  print('bust')
  return
print('win')

Fixed submission:
#!/usr/bin/env python3
import sys

a1, a2, a3 = map(int, sys.stdin.readline().split())
if a1+a2+a3>=22:
  print('bust')
else:
  print('win')

Buggy python submission (verdict: Runtime Error):
from sys import stdin

a1, a2, a3 = map(int, stdin.readline().split())
if a1+a2+a3>=22:
  print('bust')
  return
print('win')

Fixed submission:
#!/usr/bin/env python3
import sys

a1, a2, a3 = map(int, sys.stdin.readline().split())
if a1+a2+a3>=22:
  print('bust')
else:
  print('win')
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys

s = stdin.readline().strip()
sl = len(s)

cnt = 0
for i in range(sl//2):
  if s[i]!=s[sl-1-i]:
    cnt += 1

print(cnt)

Fixed submission:
#!/usr/bin/env python3
from sys import stdin

s = stdin.readline().strip()
sl = len(s)

cnt = 0
for i in range(sl//2):
  if s[i]!=s[sl-1-i]:
    cnt += 1

print(cnt)

Buggy python submission (verdict: Runtime Error):
import sys.stdin

s = stdin.readline().strip()
sl = len(s)

cnt = 0
for i in range(sl//2):
  if s[i]!=s[sl-1-i]:
    cnt += 1

print(cnt)

Fixed submission:
#!/usr/bin/env python3
from sys import stdin

s = stdin.readline().strip()
sl = len(s)

cnt = 0
for i in range(sl//2):
  if s[i]!=s[sl-1-i]:
    cnt += 1

print(cnt)