Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))


for i in range(N):
    ans = 0
    pos = 0
    for j in range(len(A)):
        if j == i:
            continue
        ans += abs(A[j]-pos)
        #print('ans', ans)#debug
        pos = A[j]
        #print('pos:', pos)#debug
    ans += abs(pos)
    print(ans)

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

Astr = input().split()

for i in Astr:
    A.append(int(i))

A.append(0)

ans = 0
pos = 0
for i in range(len(A)):
    if i == 0:
        continue
    ans += abs(A[i]-pos)
    pos = A[i]

for i in range(len(A)):
    if i == 0 or i == len(A)-1:
        continue
    print(ans-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1]))

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

for i in range(N):
    temp = []
    for j in range(len(A)):
        if j == i:
            continue
        temp.append(A[j])
        ans = 0
        pos = 0
    for j in temp:
        ans += abs(j-pos)
        pos = j
    ans += abs(temp[-1])
    print(ans)

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

Astr = input().split()

for i in Astr:
    A.append(int(i))

A.append(0)

ans = 0
pos = 0
for i in range(len(A)):
    if i == 0:
        continue
    ans += abs(A[i]-pos)
    pos = A[i]

for i in range(len(A)):
    if i == 0 or i == len(A)-1:
        continue
    print(ans-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1]))
Buggy python submission (verdict: Runtime Error):
abstr = input().split()
ab = int(abstr[0]+abstr[1])

for i in range(400):
    if i**==ab:
        print('Yes')

else:
    print('No')


Fixed submission:
abstr = input().split()
ab = abstr[0]+abstr[1]

for i in range(400):
    if i**2==int(ab):
        print('Yes')
        break

else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Astr = input().split()
An = []
for A in Astr:
    An.append(int(A))
count = 0
end = 0
while end == 0:
    for A in An:
        if A%2==1:
            print(count)
            end = 1
            break
        else:
            A /= 2
    count += 1
        

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

candidate = 0
end = 0
while end == 0:
    for A_i in A:
        if (A_i/2**(candidate))%2 != 0:
            end = 1
            break
    else:
        candidate += 1
print(candidate)
Buggy python submission (verdict: Runtime Error):
X, Y, Z = map(int, input().split())
ans = 1
length = Y+2Z
while True:
    if length > X:
        print(ans)
        break
    ans += 1
    length += Y+Z


Fixed submission:
X, Y, Z = map(int, input().split())
ans = 1
length = Y+2*Z
while True:
    if length+Y+Z > X:
        print(ans)
        break
    ans += 1
    length += Y+Z

Buggy python submission (verdict: Runtime Error):
X, Y, Z = map(int, input().split())
ans = 1
length = Y+2Z
while True:
    if length > X:
        print(ans)
        break
    count += 1
    length += Y+Z


Fixed submission:
X, Y, Z = map(int, input().split())
ans = 1
length = Y+2*Z
while True:
    if length+Y+Z > X:
        print(ans)
        break
    ans += 1
    length += Y+Z
Buggy python submission (verdict: Runtime Error):
S = input()
abc = [chr(i) for i in range(97,97+26)]
for i in S:
    if i in abc:
        abc.remove(i)
if S == []:
    print('None')
else:
    print(abc[0])

Fixed submission:
S = input()
abc = [chr(i) for i in range(97,97+26)]
for i in S:
    if i in abc:
        abc.remove(i)
if abc == []:
    print('None')
else:
    print(abc[0])
Buggy python submission (verdict: Runtime Error):
s = input()
print(a[0]+str(len(s)-2)+a[-1])

Fixed submission:
s = input()
print(s[0]+str(len(s)-2)+s[-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
if len(s)%2==1:
    s += '0'
s = s[:-2]
while True:
    if s[:len(s)//2] == s[len(s)//2:]:
        print(len(s[:len(s)//2]))
    s = s[:-2]

Fixed submission:
s = input()
if len(s)%2==1:
    s += '0'
s = s[:-2]
while True:
    if s[:len(s)//2] == s[len(s)//2:]:
        print(len(s))
        break
    s = s[:-2]
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
f, r = [], []
for i in range(n):
    if i%2==0:
        f.append(a[i])
    else:
        r.append(a[i])
        
if n%2==0:
    print(*r[::-1], *f)
else:
    print(*f[::-1], *r)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
f, r = [], []
for i in range(n):
    if i%2==0:
        f.append(a[i])
    else:
        r.append(a[i])
ans = r[::-1] + f      
if n%2==0:
    print(*ans)
else:
    print(*ans[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
hist = []
for i in range(n):
    a.append(int(input()))
pos = 1
count = 0
while True:
    if pos == 2:
        print(count)
        break
    if pos in hist:
        print(-1)
        break
    hist.append(pos)
    pos = a[pos-1]
    count += 1

Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
ans = 0
turn = 1
while True:
    if a[turn-1] == 2:
        ans += 1
        break
    if a[turn-1] == 0:
        ans = -1
        break
    next_turn = a[turn-1]
    a[turn-1] = 0
    ans += 1
    turn = next_turn

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
hist = []
for i in range(N):
    a.append(int(input()))
pos = 1
count = 0
while True:
    if pos == 2:
        print(count)
        break
    if pos in hist:
        print(-1)
        break
    hist.append(pos)
    pos = a[pos-1]
    count += 1

Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
ans = 0
turn = 1
while True:
    if a[turn-1] == 2:
        ans += 1
        break
    if a[turn-1] == 0:
        ans = -1
        break
    next_turn = a[turn-1]
    a[turn-1] = 0
    ans += 1
    turn = next_turn

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
hist = []
for i in range(N):
    a.appnd(int(input()))
pos = 0
count = 0
while True:
    if pos+1 in hist:
        print(-1)
        break
    hist.append(a[pos])
    pos = a[pos]-1
    count += 1
    if pos == 1:
        print(count)
        break


Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
ans = 0
turn = 1
while True:
    if a[turn-1] == 2:
        ans += 1
        break
    if a[turn-1] == 0:
        ans = -1
        break
    next_turn = a[turn-1]
    a[turn-1] = 0
    ans += 1
    turn = next_turn

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
hist = []
for i in range(N):
    a.appnd(int(input()))
pos = 0
count = 0
while True:
    if pos+1 in hist:
        print(-1)
        break
    hist.append(a[pos])
    pos = a[pos]-1
    count += 1
    if pos = 1:
        print(count)
        break

Fixed submission:
N = int(input())
a = [int(input()) for i in range(N)]
ans = 0
turn = 1
while True:
    if a[turn-1] == 2:
        ans += 1
        break
    if a[turn-1] == 0:
        ans = -1
        break
    next_turn = a[turn-1]
    a[turn-1] = 0
    ans += 1
    turn = next_turn

print(ans)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
src = [int(input()) for i in range(N)]

def enough(n):
    bomb = 0
    for h in src:
        if h <= B*n: continue
            h -= B*n
            bomb -= (h+1)//(A-B) + 1
            if bomb > n: return False
        return True

#ok/ng: 中点が十分かどうか
ng = 0
ok = 10**9
while ok - ng > 1:
    m = (ok+ng) // 2
    if enough(m):
        ok = m
    else:
        ng = m
print(ok)

Fixed submission:
N, A, B = map(int, input().split())
src = [int(input()) for i in range(N)]

def enough(n):
    bomb = 0
    for h in src:
        if h <= B*n: continue
        h -= B*n
        bomb += (h-1)//(A-B) + 1
        if bomb > n: return False
    return True

#ok/ng: 中点が十分に大きいかどうか
ng = 0
ok = 10**9
while ok - ng > 1:
    m = (ok+ng) // 2
    if enough(m):
        ok = m
    else:
        ng = m
print(ok)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())
if A > B:
    print(0)
elif N = 1:
    if A = B:
        print(1)
    else:
        print(0)
else:
    print((A+(N-1)*B)-((N-1)*A+B)+1)


Fixed submission:
N, A, B = map(int, input().split())
if A > B:
    print(0)
elif N == 1:
    if A == B:
        print(1)
    else:
        print(0)
else:
    print((A+(N-1)*B)-((N-1)*A+B)+1)
Buggy python submission (verdict: Runtime Error):
a = set([1, 3, 5, 7, 8, 10, 12])
b = set([4, 6, 9, 11])
c = set([2])
xy = list(map(int, input().split()))
if xy in a or xy in b or xy in c:
    print('Yes')
else:
    print('No')

Fixed submission:
a = [0,2,0,1,0,1,0,0,1,0,1,0]
x, y = map(int, input().split())

if a[x-1]==a[y-1]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")

Fixed submission:
A, B, C = map(str, input().split())
if A[-1]==B[0] and B[-1]==C[0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a, b c = map(int, input().split())
if a-b == b-c:
    print('YES')
else:
    print('NO')

Fixed submission:
a, b, c = map(int, input().split())
if a-b == b-c:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input())
if A == 1:
    A = 14
if B == 1:
    B = 14

if A == B:
    print('Draw')
elif A > B:
    print('Alice')
else:
    print ('Bob')


Fixed submission:
A, B = map(int, input().split())
if A == 1:
    A = 14
if B == 1:
    B = 14

if A == B:
    print('Draw')
elif A > B:
    print('Alice')
else:
    print ('Bob')
Buggy python submission (verdict: Runtime Error):
a = input().split()
if s[1] == '+':
    print(int(a[0])+int(a[2]))
else:
    print(int(a[0])-int(a[2]))

Fixed submission:
a = input().split()
if a[1] == '+':
    print(int(a[0])+int(a[2]))
else:
    print(int(a[0])-int(a[2]))

Buggy python submission (verdict: Runtime Error):
a = input().split()
if s[1] = '+':
    print(int(a[0])+int(a[2]))
else:
    print(int(a[0])-int(a[2]))

Fixed submission:
a = input().split()
if a[1] == '+':
    print(int(a[0])+int(a[2]))
else:
    print(int(a[0])-int(a[2]))
Buggy python submission (verdict: Runtime Error):
a, b, x = map(init, input().split())
print(b//x-(a-1)//x)

Fixed submission:
a, b, x = map(int, input().split())
print(b//x-(a-1)//x)
Buggy python submission (verdict: Runtime Error):
import string
def inpl(): return list(map(int, input().split()))
H, W = inpl()
a = []
for i in range(H):
    a.append(inpl())

for i in range(H):
    for j in range(W):
        if a[i][j] == 'snuke':
            print(string.ascii_lowercase[j]+str(i+1))
            break

Fixed submission:
import string
H, W = map(int, input().split())
a = []
for i in range(H):
    a.append(input().split())

for i in range(H):
    for j in range(W):
        if a[i][j] == 'snuke':
            print(string.ascii_uppercase[j]+str(i+1))
            break
Buggy python submission (verdict: Runtime Error):
def inpl(): return list(map(int, input().split()))
K, T = inpl()
a = inpl()
print(max(max(a)*2-n-1, 0))

Fixed submission:
def inpl(): return list(map(int, input().split()))
K, T = inpl()
a = inpl()
print(max(max(a)*2-K-1, 0))
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
ans = 2
tp, ap = 0, 0
for i in range(N):#ans以上での比からの最小値でans更新,
    #A+Tのn倍、ただしn>=ans/(t+a)
    t, a = map(int, input().split())
    k = max(math.ceil(tp/t), math.ceil(ap/a))
    t, a = t*k, a*k
    c = math.ceil(ans/(t+a))
    while True:#ansが前回のans以上になるようにする
        if (t+a)*c >= ans:
            ans = (t+a)*c
            break
        c += 1
    tp, ap = t*c, a*c
print(ans)

Fixed submission:
n = int(input())
t = []
a = []
for i in range(n):
    c = list(map(int,input().split()))
    t.append(c[0])
    a.append(c[1])
for i in range(n-1):
    d = max(1,-(-t[i]//t[i+1]),-(-a[i]//a[i+1]))
    t[i+1] =t[i+1]*d
    a[i+1] =a[i+1]*d
print(t[-1]+a[-1])

Buggy python submission (verdict: Time Limit Exceeded):
import math
N = int(input())
ans = 2
tp, ap = 0, 0
for i in range(N):#ans以上での比からの最小値でans更新,
    #A+Tのn倍、ただしn>=ans/(t+a)
    t, a = map(int, input().split())
    k = 1
    while True:
        if t*k>=tp and a*k>=ap:
            t, a = t*k, a*k
            break
        k += 1
    c = math.ceil(ans/(t+a))
    while True:#ansが前回のans以上になるようにする
        if (t+a)*c >= ans:
            ans = (t+a)*c
            break
        c += 1
    tp, ap = t*c, a*c
print(ans)

Fixed submission:
n = int(input())
t = []
a = []
for i in range(n):
    c = list(map(int,input().split()))
    t.append(c[0])
    a.append(c[1])
for i in range(n-1):
    d = max(1,-(-t[i]//t[i+1]),-(-a[i]//a[i+1]))
    t[i+1] =t[i+1]*d
    a[i+1] =a[i+1]*d
print(t[-1]+a[-1])
Buggy python submission (verdict: Runtime Error):
d = {a:input(), b:input(), c:input()}
temp = 'a'
while True:
    if d[temp] == '':
        break
    d[temp] = d[temp][1:]
    temp = d[temp][0]
print(temp)

Fixed submission:
card = ["a","b","c"]
S = dict()
for i in card:
    S[i] = input()

turn = "a"
while True:
    if len(S[turn])==0:
        print(turn.upper())
        break
    else:
        next_turn = S[turn][0]
        S[turn] = S[turn][1:]
        turn = next_turn
Buggy python submission (verdict: Runtime Error):
def pt(s: list):
    if len(s) = 1:
        return eval(s[0])
    return pt([s[0]+s[1]]+s[2:]) + pt([s[0]+'+'+s[1]]+s[2:])
print(pt(list((input()))))

Fixed submission:
def plus_or_through(s):
    if len(s) <= 1:
        return eval(s[0])
    return plus_or_through([s[0]+s[1]]+s[2:]) + plus_or_through([s[0]+'+'+s[1]]+s[2:])
print(plus_or_through(list(input())))

Buggy python submission (verdict: Runtime Error):
def search(s):
    if len(s) <= 1:
        return eval(s[0])
    return search([s[0]+s[1]]+s[2:]) + search([s[0]+'+'+s[1]]+s[2:])
print(search(input()))

Fixed submission:
def plus_or_through(s):
    if len(s) <= 1:
        return eval(s[0])
    return plus_or_through([s[0]+s[1]]+s[2:]) + plus_or_through([s[0]+'+'+s[1]]+s[2:])
print(plus_or_through(list(input())))
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
a = list(map(int, input().split()))
cost = math.inf
for i in range(-100, 101):
    temp = 0
    for a_i in a:
        temp += (a_i-i)**2
    cost = min(cost, temp)
print(cost)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
cost = 100000000
for i in range(-100, 101):
    temp = 0
    for a_i in a:
        temp += (a_i-i)**2
    cost = min(cost, temp)
print(cost)
Buggy python submission (verdict: Runtime Error):
C = list(map(int, input().split()))

s = O
for i in range(N) :
    if V[i] > C[i]:
        s +=V[i] - C[i]
    
print(s)

Fixed submission:
A, B, T = map(int, input().split())
X = T // A * B
print(X)

Buggy python submission (verdict: Runtime Error):
A, B, T = input()
ans = ((T + 0.5) // A) * B
print(ans)

Fixed submission:
A, B, T  =  (int(_) for _ in input().split())
ans = (T + 0.5) // A
ans = int(ans * B )
print(ans)

Buggy python submission (verdict: Runtime Error):
Main.py
A, B, T = input()
n = (T + 0.5) // A
tot_biscuits = B * n
print(int(tot_biscuits))

Fixed submission:
A, B, T  =  (int(_) for _ in input().split())
ans = (T + 0.5) // A
ans = int(ans * B )
print(ans)

Buggy python submission (verdict: Runtime Error):
Main.py
A, B, T = input()
n = (T + 0.5) // A
tot_biscuits = B * n
print(tot_biscuits)

Fixed submission:
A, B, T  =  (int(_) for _ in input().split())
ans = (T + 0.5) // A
ans = int(ans * B )
print(ans)
Buggy python submission (verdict: Runtime Error):
import math as mt

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


def solve(n: int, a: list):
    lgcd = [0] * (n - 1)
    lgcd[0] = a[0]
    for i in range(1, n - 1):
        lgcd[i] = mt.gcd(a[i], lgcd[i - 1])
    a.reverse()

    rgcd = [0] * (n - 1)
    rgcd[0] = a[0]
    for i in range(1, n - 1):
        rgcd[i] = mt.gcd(a[i], rgcd[i - 1])
    a.reverse()

    ans = [0] * n
    ans[0] = rgcd[n - 2]
    ans[n - 1] = lgcd[n - 2]
    for i in range(1, n):
        ans[i] = mt.gcd(lgcd[i - 1], rgcd[n - 2 - i])

    return max(ans)


print(solve(N, A))


Fixed submission:
from fractions import *

n, *a = map(int, open(0).read().split())
b = [0]
for i in a:
    b += gcd(b[-1], i),
w = m = 0
for i in range(n):
    m = max(m, gcd(w, b[-i - 2]))
    w = gcd(w, a[~i])
print(m)
Buggy python submission (verdict: Runtime Error):
def make_divisor_list(num):
    if num < 1:
        return []
    elif num == 1:
        return [1]
    else:
        divisor_list = []
        divisor_list.append(1)
        for i in range(2, num // 2 + 1):
            if num % i == 0:
                divisor_list.append(i)
        divisor_list.append(num)

        return divisor_list

N,M=list(map(int,input().split()))
LIST=[]
divide_list = make_divisor_list(M)
if M%N==0:
    print(M//N)
else:
    x = M/N
    for i in divide_list:
       if i <= x:
          LIST.append(i)
    print(max(LIST))

Fixed submission:
N = int(input())
if N==1:
    print("Hello World")
else:
    A=int(input())
    B=int(input())
    print(A+B)
Buggy python submission (verdict: Runtime Error):
x_1,y_1,x_2,y_2 = list(map(int,input().split()))

A = x_2 - x_1 
B = y_2 - y_1

print(x_2-B,y_2+A,x_1-B,y_1+A)

Fixed submission:
N = int(input())
print(int((N/2)**2))
Buggy python submission (verdict: Runtime Error):
S = input()
K = input()
count = 0
for i in range(len(S)):
    if S[i]=="1":
        count+=1
    else:
        break
        
print(1) if K <= count else print(S[count])


Fixed submission:
S = input()
K = input()
count = 0
for i in range(len(S)):
    if S[i]=="1":
        count+=1
    else:
        break
        
print(1) if int(K) <= count else print(S[count])
Buggy python submission (verdict: Runtime Error):
import collections
from collections import defaultdict
import numpy as np

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

A = np.array(A,dtype='int64')
C = np.append([0],np.cumsum(A))
#累積和を算出して最初に０をつける。
L = [i%M for i in C]
#Ｍで割ったあまりを求めてリスト化
d = defaultdict(int)
for i in L:
    d[i] +=1
#各余りに対して、その数が何個あるかを求める。

ans = 0
for i in d.values():
    S = i * (i-1) / 2
    ans+=S
    
print(int(ans))

Fixed submission:
A,B = list(map(int,input().split()))
print(1) if A%B!=0 else print(0)
Buggy python submission (verdict: Runtime Error):
A,B = list(map(int,input().split()))
_ =input()
print(math.ceil((A-B)/(B-1))+1)

Fixed submission:
import math
A,B = list(map(int,input().split()))
_ =input()
print(math.ceil((A-B)/(B-1))+1)

Buggy python submission (verdict: Runtime Error):
A,B = list(map(int,input().split()))
print(math.ceil((A-B)/(B-1))+1)

Fixed submission:
import math
A,B = list(map(int,input().split()))
_ =input()
print(math.ceil((A-B)/(B-1))+1)

Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())
print(math.ceil((A-B)/(B-1))+1)

Fixed submission:
import math
A,B = list(map(int,input().split()))
_ =input()
print(math.ceil((A-B)/(B-1))+1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A = input()

L = [0]*(N)
for i in range(N):
    SUM = A[:i].count("W")+A[i+1:].count("E")
    L[i] =SUM
print(min(L))

Fixed submission:
N = int(input())
A = input()

SUM=[0]*(N+1)#iより西のWの数
SUM2=[0]*(N+1)#iより西のEの数
for i in range(N):
    if A[i]=="W":
        SUM[i+1] = SUM[i]+1
        SUM2[i+1] = SUM2[i]
    else:
        SUM2[i+1] = SUM2[i]+1
        SUM[i+1] = SUM[i]
    
SUM3 = [SUM[i]+(SUM2[-1]-SUM2[i+1]) for i in range(N)]
print(min(SUM3))
Buggy python submission (verdict: Time Limit Exceeded):
K,S = list(map(int,input().split()))
count = 0

for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if S == x+y+z:
                count+=1

print(count)           

Fixed submission:
K,S = list(map(int,input().split()))
count = 0
countb=0

for x in range(K+1):
    for y in range(K+1):
        countb+=1
        if 0 <= S - (x+y) <= K:
            count+=1
                
print(count)
Buggy python submission (verdict: Runtime Error):
from typing import List

def problem():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
 
    print(algorithm(N, V, C))
 
 
def algorithm(N: int, V: List[int], C: List[int]):
    indices = list(filter(lambda i: V[i] - C[i] > 0, list(range(0, N))))
 
    sum = 0
    for i in indices:
        sum += V[i] - C[i]
    return sum
 
problem()

Fixed submission:

def problem():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))

    print(algorithm(N, V, C))


def algorithm(N, V, C):
    indices = list(filter(lambda i: V[i] - C[i] > 0, list(range(0, N))))

    sum = 0
    for i in indices:
        sum += V[i] - C[i]
    return sum

problem()

Buggy python submission (verdict: Runtime Error):

def problem():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))

    print(algorithm(N, V, C))


def algorithm(N: int, V: List[int], C: List[int]):
    indices = list(filter(lambda i: V[i] - C[i] > 0, list(range(0, N))))

    sum = 0
    for i in indices:
        sum += V[i] - C[i]
    return sum
 
problem()


Fixed submission:

def problem():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))

    print(algorithm(N, V, C))


def algorithm(N, V, C):
    indices = list(filter(lambda i: V[i] - C[i] > 0, list(range(0, N))))

    sum = 0
    for i in indices:
        sum += V[i] - C[i]
    return sum

problem()
Buggy python submission (verdict: Runtime Error):

def problem():
    N = int(input())
    H = map(int, input().split())
    print(algorithm(N,H))

def algorithm(N: int, H):
  currentMax = H[0]
  counter = 1
  for i in range(1, N):
    if currentMax <= H[i]:
      counter += 1
      currentMax = H[i]
    
  return counter

problem()

Fixed submission:


def problem():
    N = int(input())
    H = list(map(int, input().split()))
    print(algorithm(N,H))


def algorithm(N: int, H):
  currentMax = H[0]
  counter = 1
  for i in range(1, N):
    if currentMax <= H[i]:
      counter += 1
      currentMax = H[i]
    
  return counter

problem()
Buggy python submission (verdict: Runtime Error):

import sys

intMaxValue = sys.maxsize


def problem():
    N = int(input.split())
    activityList = []
    for i in range(N):
      row = list(map(int, input().split()))
      activityList.append(row)

    print(algorithm(N,activityList))

def algorithm(N, activityList):
  dp = [[0, 0, 0] for i in range(N+ 1)]

  for index in range(1, N + 1):
    for j in range(3):
      for k in range(3):
        if j == k:
          continue
        if dp[index][j] < dp[index - 1][k] + activityList[index-1][j]:
          dp[index][j] = dp[index - 1][k] + activityList[index-1][j]
      
  return max(dp[N])


problem()

Fixed submission:

import sys


def problem():
    N = int(input())
    activityList = []
    for i in range(N):
      row = list(map(int, input().split()))
      activityList.append(row)

    print(algorithm(N,activityList))

def algorithm(N, activityList):
  dp = [[0, 0, 0] for i in range(N+ 1)]

  for index in range(1, N + 1):
    for j in range(3):
      for k in range(3):
        if j == k:
          continue
        if dp[index][j] < dp[index - 1][k] + activityList[index-1][j]:
          dp[index][j] = dp[index - 1][k] + activityList[index-1][j]
      
  return max(dp[N])

problem()
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
a = 10*A + B
b = 10*B + C
c = 10*C + A
d = 10*A + C
e = 10*B + A
f = 10*C +B
print(max([a+C ,b+A, c+B, d+B, e+C, f+A]))


Fixed submission:
suuji = list(map(int, input().split()))
saidai = max(suuji)
suuji.remove(saidai)
print(saidai*10+suuji[0]+suuji[1])

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
a = 10*A + B
b = 10*B + C
print(max([a+C ,A+b]))

Fixed submission:
suuji = list(map(int, input().split()))
saidai = max(suuji)
suuji.remove(saidai)
print(saidai*10+suuji[0]+suuji[1])