Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from copy import deepcopy

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

index = [i for i in range(N)]
index = sorted(index, key=lambda i: A[i], reverse=True)


def LorR(index, res):
    i = index[0]
    dist = max(i, N - 1 - i)
    end = False
    cand1 = cand2 = 0
    while not end:
        j = i + dist
        if 0 <= j and j < N and not res[j]:
            r = deepcopy(res)
            r[j] = True
            cand1 = A[i] * dist + loop(index[1:], r)
            end = True

        j = i - dist
        if 0 <= j and j < N and not res[j]:
            r = deepcopy(res)
            r[j] = True
            cand2 = A[i] * dist + loop(index[1:], r)
            end = True

        dist -= 1
    return max(cand1, cand2)


def loop(index, res):
    if not index:
        return 0

    return LorR(index, res)


print(loop(index, [False] * N))


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

A = sorted([(val, pos) for pos, val in enumerate(A)], reverse=True)

dp = [0]
for i, (val, pos) in enumerate(A):
    ldp = [e + val * abs(pos - (i - r)) for r, e in enumerate(dp)]
    rdp = [e + val * abs(N - 1 - r - pos) for r, e in enumerate(dp)]
    dp = [max(L, R) for L, R in zip(ldp + [0], [0] + rdp)]

print(max(dp))

Buggy python submission (verdict: Runtime Error):
from copy import deepcopy

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

index = [i for i in range(N)]
index = sorted(index, key=lambda i: A[i], reverse=True)

print(A)
print(index)


def LorR(index, res):
    i = index[0]
    dist = max(i, N - 1 - i)
    end = False
    cand1 = cand2 = 0
    while not end:
        j = i + dist
        if 0 <= j and j < N and not res[j]:
            r = deepcopy(res)
            r[j] = True
            cand1 = A[i] * dist + loop(index[1:], r)
            end = True

        j = i - dist
        if 0 <= j and j < N and not res[j]:
            r = deepcopy(res)
            r[j] = True
            cand2 = A[i] * dist + loop(index[1:], r)
            end = True

        dist -= 1
    return max(cand1, cand2)


def loop(index, res):
    if not index:
        return 0

    num = 0
    a = A[index[0]]
    while num < len(index) and A[index[num]] == a:
        num += 1

    cand = [0] * num
    for i in range(num):
        ind = deepcopy(index)
        head = ind.pop(i)
        ind.insert(0, head)
        cand[i] = LorR(ind, res)

    return max(cand)


print(loop(index, [False] * N))


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

A = sorted([(val, pos) for pos, val in enumerate(A)], reverse=True)

dp = [0]
for i, (val, pos) in enumerate(A):
    ldp = [e + val * abs(pos - (i - r)) for r, e in enumerate(dp)]
    rdp = [e + val * abs(N - 1 - r - pos) for r, e in enumerate(dp)]
    dp = [max(L, R) for L, R in zip(ldp + [0], [0] + rdp)]

print(max(dp))
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(p, q):
    if p % q == 0:
        return q
    return gcd(q, p % q)


N = int(input())

ans = 0
for a in range(1, N + 1):
    for b in range(1, N + 1):
        for c in range(1, N + 1):
            ans += gcd(gcd(a, b), c)

print(ans)


Fixed submission:
from math import gcd

N = int(input())

ans = 0
for a in range(1, N + 1):
    for b in range(1, N + 1):
        for c in range(1, N + 1):
            ans += gcd(gcd(a, b), c)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

N = int(input())
S = input()

R = [i for i, s in enumerate(S) if s == 'R']
G = [i for i, s in enumerate(S) if s == 'G']
B = [i for i, s in enumerate(S) if s == 'B']

#aa = list()
ans = len(R) * len(G) * len(B)
for (i, j) in combinations(range(N - 1), 2):
    k = j*2 - i
    if k < N and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
        ans -= 1
#        aa.append((i, j, k))

print(ans)
#print(aa)


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

RGB = [list()] * 3
color = ['R', 'G', 'B']
RGB[0] = [i for i, s in enumerate(S) if s == color[0]]
RGB[1] = [i for i, s in enumerate(S) if s == color[1]]
RGB[2] = [i for i, s in enumerate(S) if s == color[2]]

order = sorted([0, 1, 2], key=lambda i: len(RGB[i]))
color = [color[i] for i in order]
RGB = [RGB[i] for i in order]

# b = list()
ans = len(RGB[0]) * len(RGB[1]) * len(RGB[2])
for c1 in RGB[0]:
    for c2 in RGB[1]:
        p = c1 * 2 - c2
        if 0 <= p and p < N and S[p] == color[2]:
            # b.append((c1, c2, p))
            ans -= 1

        p = c2 * 2 - c1
        if 0 <= p and p < N and S[p] == color[2]:
            # b.append((c1, c2, p))
            ans -= 1

        if (c1 + c2) % 2 == 0 and S[(c1 + c2) // 2] == color[2]:
            # b.append(c1, c2, c1 + c2 / 2)
            ans -= 1

print(ans)

# b = [sorted(t) for t in b]
# print(sorted(b))
Buggy python submission (verdict: Time Limit Exceeded):
import sys

sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7

N, M = LIST()

A = [[] for _ in range(10**4+1)]
for _ in range(N):
    a, b = LIST()
    if a <= M:
        A[b].append(a)

for a in A:
    a.sort(reverse=True)

off = [False] * M
ans = 0

i = 10**4
while i > 0:
    for a in A[i]:
        j = M - a
        while j >= 0:
            if off[j] == False:
                off[j] = True
                ans += i
                break;
            else:
                j -= 1

    if off == [True] * M:
        break;
    else:
        i -= 1

print(ans)


Fixed submission:
import sys
import bisect

sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7

N, M = LIST()

A = [[] for _ in range(10**4+1)]
for _ in range(N):
    a, b = LIST()
    if a <= M:
        A[b].append(a)

for a in A:
    a.sort(reverse=True)

off = list(range(1, M+1))
ans = 0

i = 10**4
while i > 0:
    for a in A[i]:
        attempt = bisect.bisect_left(off, a)

        if attempt < len(off):
            off.pop(attempt)
            ans += i

    if off == []:
        break;
    else:
        i -= 1

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

A, B, C, D = map(int, input().split())

U = B - A + 1

def number(R):
        return ((B // R) - ((A - 1) // R))

possible_C = number(C)
possible_D = number(D)
possible_CD = number((C * D) // math.gcd(C, D))

print(U)
print(possible_C)
print(possible_D)
print(possible_CD)

print(U - (possible_C + possible_D) + possible_CD)


Fixed submission:
import fractions

A, B, C, D = map(int, input().split())

U = B - A + 1

def number(R):
        return ((B // R) - ((A - 1) // R))

possible_C = number(C)
possible_D = number(D)
possible_CD = number((C * D) // fractions.gcd(C, D))

print(U - (possible_C + possible_D) + possible_CD)
Buggy python submission (verdict: Runtime Error):
import sys, fractions
sys.setrecursionlimit(5 * 10**5)
input = sys.stdin.readline

N = int(input())

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

gcds = []

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        gcds.append(fractions.gcd(A[i], A[j]))

print(min(gcds))


Fixed submission:
import sys
import fractions

sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7

N = INT()

A = LIST()

def gcd_all(n):
    if len(n) == 1:
        return n[0]

    tail = n.pop(-1)
    return fractions.gcd(tail, gcd_all(n))

print(gcd_all(A))

Buggy python submission (verdict: Runtime Error):
import sys
import fractions

sys.setrecursionlimit(10**5+1)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7

N = INT()

A = LIST()

def gcd_all(n):
    if len(n) == 1:
        return n[0]

    tail = n.pop(-1)
    return fractions.gcd(tail, gcd_all(n))

print(gcd_all(A))


Fixed submission:
import sys
import fractions

sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7

N = INT()

A = LIST()

def gcd_all(n):
    if len(n) == 1:
        return n[0]

    tail = n.pop(-1)
    return fractions.gcd(tail, gcd_all(n))

print(gcd_all(A))

Buggy python submission (verdict: Runtime Error):
import sys
import fractions

sys.setrecursionlimit(10**5)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7

N = INT()

A = LIST()

def gcd_all(n):
    if len(n) == 1:
        return n[0]

    tail = n.pop(-1)
    return fractions.gcd(tail, gcd_all(n))

print(gcd_all(A))


Fixed submission:
import sys
import fractions

sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7

N = INT()

A = LIST()

def gcd_all(n):
    if len(n) == 1:
        return n[0]

    tail = n.pop(-1)
    return fractions.gcd(tail, gcd_all(n))

print(gcd_all(A))

Buggy python submission (verdict: Runtime Error):
import sys
import fractions

sys.setrecursionlimit(1000)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7

N = INT()

A = LIST()

def gcd_all(n):
    if len(n) == 1:
        return n[0]

    tail = n.pop(-1)
    return fractions.gcd(tail, gcd_all(n))

print(gcd_all(A))


Fixed submission:
import sys
import fractions

sys.setrecursionlimit(10**9)
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def LIST(): return [int(x) for x in input().split()]
MOD = 10**9 + 7

N = INT()

A = LIST()

def gcd_all(n):
    if len(n) == 1:
        return n[0]

    tail = n.pop(-1)
    return fractions.gcd(tail, gcd_all(n))

print(gcd_all(A))
Buggy python submission (verdict: Runtime Error):
import numpy as np

d = int(input())    # Day
C = list(map(int, input().split()))  # 満足度の減少係数
S = []  # 各日にち、各タイプの満足度
T = []  # d日目の開催タイプ
L = [0] * 26    # 各コンテストが開催された最後の日付

for _ in range(d):
    S.append(list(map(int, input().split())))  # Si,d type_iをdayDに開いた時の満足度 [5, 26]

for _ in range(d):
    T.append(int(input()))

print("S:", S)
print("T:",T)

sat = 0
S = np.array(S)
print("S_shape:", S.shape)

for i in range(d):
    con_type = T[i]
    print(i)
    print("開催するコンテストタイプ：", con_type)
    complain = 0
    for j in range(26):
        complain = complain + C[j] * (d - L[j])
    L[con_type] = d     # 最終開催日の更新

    sat = sat + S[d][con_type] - complain
    sat = max(10^6 + sat, 0)

    print(sat)



Fixed submission:
import numpy as np

d = int(input())    # Day
C = list(map(int, input().split()))  # 満足度の減少係数
S = []  # 各日にち、各タイプの満足度
T = []  # d日目の開催タイプ
L = [0] * 26    # 各コンテストが開催された最後の日付

for _ in range(d):
    S.append(list(map(int, input().split())))  # Si,d type_iをdayDに開いた時の満足度 [5, 26]

for _ in range(d):
    T.append(int(input()))

# print("d:", d)
# print("C:", C)
# print("S:", S)
# print("T:", T)

sat = 0
S = np.array(S)

for i in range(d):
    con_type = T[i]
    # print("開催するコンテストタイプ：", con_type)
    complain = 0
    L[con_type - 1] = i + 1     # 最終開催日の更新
    for j in range(26):
        # print("{} + {} * ({} - {})".format(complain, C[j], i+1, L[j]))
        complain = complain + C[j] * (i + 1 - L[j])

    # print("complain:", complain)
    # print("S:", S[i][con_type - 1])
    # print("satの計算: {} + {} - {}".format(sat, S[i][con_type - 1], complain ))

    sat = sat + S[i][con_type - 1] - complain

    print(sat)
Buggy python submission (verdict: Runtime Error):
def main():
    a,v = map(int,input().split())
    b,w = map(int,input().split())
    t = int(input())

    if b == 
    a += 10**9
    b += 10**9
    if v == w:
        print('NO')
        return 0
#    if a > b:
#        print('NO')
#        return 0
    if (b-a)%(v-w) != 0:
        print('NO')
    elif 0 <= (b-a)/(v-w) <= t:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    a,v = map(int,input().split())
    b,w = map(int,input().split())
    t = int(input())

    if v == w:
        print('NO')
        return 0
    if v-w < 0:
        print('NO')
        return 0
    if abs(b-a)/(v-w) <= t:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a = list(map(int,input().split()))

    inf = 10**18
    res = a[0]
    for i in range(1,n):
        res *= a[i]
    if res > inf:
        print(-1)
        return 0
    else:
        print(res)

if __name__ == '__main__':
    main()



Fixed submission:
def main():
    n = int(input())
    a = sorted(list(map(int,input().split())),reverse=True)

    inf = 10**18
    res = a[0]
    if 0 in a:
        print(0)
        return 0
    for i in range(1,n):
        res *= a[i]
        if res > inf:
            print(-1)
            return 0

    if res > inf:
        print(-1)
        return 0
    else:
        print(res)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    from collections import deque
    q = deque()
    p = deque()
    q.append(1)
    buf = 0
    flg = True
    idx = 1
    cnt = 0
    while flg:
        buf = idx
        idx = a[idx-1]
        cnt += 1
        if cnt == k:
            print(idx)
            return 0
        if idx in q:
            flg = False
        else:
            q.append(idx)
    for i in range(len(q)):
        tmp = q.pop()
        p.appendleft(tmp)
        if tmp == idx:
            break
    if k < len(q):
        print(list(q)[k%len(q)])
    else:
        k -= len(q)
        print(list(p)[k%len(p)])
    return 0

if __name__ == '__main__':
    main()



Fixed submission:
def main():
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    # k<=10**18 < 2**60
    r = 60
    import math
    r = math.ceil(math.log2(k))
    idx = 0
    a = [a[i]-1 for i in range(n)]
    for i in range(r):
        if (k>>i)&1 == 1:
            idx = a[idx]
        a = [a[a[j]] for j in range(n)]
    print(idx+1)    

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    from collections import deque
    q = deque()
    p = deque()
    q.append(1)
    buf = 0
    flg = True
    idx = 1
    while flg:
        buf = idx
        idx = a[idx-1]
        if idx in q:
            flg = False
        else:
            q.append(idx)
    for i in range(len(q)):
        tmp = q.pop()
        p.appendleft(tmp)
        if tmp == idx:
            break
    if k < len(q):
        print(list(q)[k%len(q)])
    else:
        k -= len(q)
        print(list(p)[k%len(p)])
    return 0

if __name__ == '__main__':
    main()



Fixed submission:
def main():
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    # k<=10**18 < 2**60
    r = 60
    import math
    r = math.ceil(math.log2(k))
    idx = 0
    a = [a[i]-1 for i in range(n)]
    for i in range(r):
        if (k>>i)&1 == 1:
            idx = a[idx]
        a = [a[a[j]] for j in range(n)]
    print(idx+1)    

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    x = int(input())
    a = int(x**(1/5))
    while True:
        b = a**5 - x
        if b < 0:
            b = abs(b-0)**(1/5)
            b = b * (-1)
        else:
            b = b**(1/5)
        b = int(b)
        if a**5 - b**5 == x:
            print(a,b)
            return 0
        else:
            a+=1
    
if __name__ == '__main__':
    main()


Fixed submission:
def main():
    x = int(input())
    a = 0
    while True:
        b = a**5 - x
        if b < 0:
            b = abs(b-0)**(1/5)
            b = b * (-1)
        else:
            b = b**(1/5)
        b = int(b)

        if a**5 - b**5 == x:
            print(a,b)
            return 0
        else:
            a+=1
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s=input()
    cnt=0
    n=len(s)
    for i in range(n):
        for j in range(i+1,n+1):
            if int(s[i:j])%2019 == 0:
                cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    s=list(input())[::-1]
    ans,tot,x,m=0,0,1,2019
    cnt=[0]*m
    n=len(s)
    for i in range(n):
        cnt[tot] += 1
        tot += int(s[i])*x
        tot %= m
        ans += cnt[tot]
        x = x*10%m
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    s=input()
    cnt=0
    for i in range(len(s)+1):
        for j in range(i+1,len(s)+1):
            if int(s[i:j])%2019 == 0:
                cnt += 1
    print(cnt)

if __name__ == '__main__':
    main()


Fixed submission:
def main():
    s=list(input())[::-1]
    ans,tot,x,m=0,0,1,2019
    cnt=[0]*m
    n=len(s)
    for i in range(n):
        cnt[tot] += 1
        tot += int(s[i])*x
        tot %= m
        ans += cnt[tot]
        x = x*10%m
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from collections import deque
k=int(input())
q=deque(list(range(1, 10)))
ans,x,y=0,0,0
for i in range(k):
  ans=q.popleft()
  y=ans%10
  x=ans*10+y
  if y != 0:
    q.append(tmp-1)
  q.append(tmp)
  if y != 9:
    q.append(tmp+1)
print(ans)


Fixed submission:
from collections import deque
k=int(input())
q=deque(list(range(1, 10)))
ans,x,y=0,0,0
for i in range(k):
  ans=q.popleft()
  y=ans%10
  x=ans*10+y
  if y != 0:
    q.append(x-1)
  q.append(x)
  if y != 9:
    q.append(x+1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = [int(input()) for i in range(n)]
    #a = list(map(int, input().split()))
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    s = input()
    q = int(input())
    r = [input().split() for i in range(q)]
    cnt = 0

    for i in range(q):
        tmp = r[i]
        if tmp[0] == "1":
            cnt += 1
        else:
            if tmp[1] == "1" and cnt % 2 == 0 or tmp[1] != "1" and cnt % 2 != 0:
                s = tmp[2] + s
            else:
                s = s + tmp[2]
    if cnt % 2 == 0:
        print(s)
    else:
        print(*(list(s)[::-1]), sep="")

if __name__ == '__main__':
    main()



Fixed submission:
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = [int(input()) for i in range(n)]
    #a = list(map(int, input().split()))
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    from collections import deque
    deq = deque(input())
    q = int(input())
    r = [input().split() for i in range(q)]
    cnt = 0
    for i in range(q):
        tmp = r[i]
        if tmp[0] == "1":
            cnt += 1
        else:
            if tmp[1] == "1" and cnt % 2 == 0 or tmp[1] != "1" and cnt % 2 != 0:
                deq.appendleft(tmp[2])
            else:
                deq.append(tmp[2])
    if cnt % 2 == 0:
        print(*(deq), sep="")
    else:
        print(*(deque(reversed(deq))), sep="")

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
def main():
    from sys import stdin, setrecursionlimit
    setrecursionlimit(10**10)
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #r = [int(stdin.readline()) for i in range(3)]
    
    a = list(map(int, r.split()))
    n = a[0]
    k = a[1]
    s = a[2]

    res = [s+1]*n
    for i in range(k):
        res[i] = s
    print(*res)

    #'Yes', 'No', 'YES', 'NO', ':(', 'Yay!'
    #res = 0
    #a, b = map(int, r.split())
    #print()

if __name__ == '__main__':
    main()



Fixed submission:
def main():
    from sys import stdin, setrecursionlimit
    setrecursionlimit(10**9)
    r = stdin.readline()[:-1]
    #n = int(stdin.readline()[:-1])   
    #r = [stdin.readline() for i in range(n)]
    #t = [int(stdin.readline()) for i in range(n)]
    #r = [int(stdin.readline()) for i in range(3)]
    
    a = list(map(int, r.split()))
    n = a[0]
    k = a[1]
    s = a[2]

    tmp = 0
    if s == 10**9:
        tmp = 1
    else:
        tmp = 10**9
    res = [tmp]*n
    for i in range(k):
        res[i] = s
    print(*res)

    #'Yes', 'No', 'YES', 'NO', ':(', 'Yay!'
    #res = 0
    #a, b = map(int, r.split())
    #print()

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
  s = input()
  res = 0
  for i in range(len(s)//2):
    if s[i] != s[-(i+1)]:
      res += 1
  print(res)

Fixed submission:
s = input()
res = 0
for i in range(len(s)//2):
  if s[i] != s[-(i+1)]:
    res += 1
print(res)
Buggy python submission (verdict: Runtime Error):
m1,d1=map(int,input().split())
m2,d2=map(int,input().split())
if d2 = 1:
    print(1)
else:
    print(0)

Fixed submission:
m1,d1=map(int,input().split())
m2,d2=map(int,input().split())
if d2 == 1:
    print(1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
cn=0
buf=s
for i in range(n):
  cn+=a[i]
  buf=min(bug,abs(s-2+cn))
print(buf)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
cn=0
buf=s
for i in range(n):
  cn+=a[i]
  buf=min(buf,abs(s-2*cn))
print(buf)
Buggy python submission (verdict: Runtime Error):
r = input()
print(pow(r,2))

Fixed submission:
r = int(input())
print(pow(r, 2))