Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02639 (python)

Fixed submission:
x = list(map(int, input().split()))
print(15 - sum(x))

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())

for i in range(1, X+1):
    for j in range(1, X-i):
        if 2*i + 4*j == Y:
            print('Yes')
            exit(0)
print('No')
Problem p03434 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
a = sorted(a)[::-1]
Alice = 0
Bob = 0
for i in range(N):
  if i % 2 == 0:
    Alice += a[i]
  else:
    Bob += a[i]
print(Alice - Bob)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted(list(map(int, input().split())))[]
print(sum(A[-1::-2])-sum(A[-2::-2]))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [map(int, input().split()) for _ in range(N)]
a = sorted(a)[::-1]
Alice = 0
Bob = 0
for i in range(N):
  if i % 2 == 0:
    Alice += a[i]
  else:
    Bob += a[i]
print(Alice - Bob)
Problem p03471 (python)

Fixed submission:
N, Y = map(int, input().split())
res_x = -1
res_y = -1
res_z = -1
for x in range(N+1):
  for y in range(N-x+1):
    z = N - x - y
    if 10000 * x + 5000 * y + 1000 * z == Y:
      res_x = x
      res_y = y
      res_z = z
print('{} {} {}'.format(res_x, res_y, res_z))

Buggy submission (verdict: Runtime Error):
N, Y = map(int, input().split())
res_x = -1, res_y = -1, res_z = -1
for x in range(N):
  for j in range(N-x):
    z = N - x - y
    if 10000 * x + 5000 * y + 1000 * z == Y:
      res_x = x
      res_y = y
      res_z = z
print('{} {} {}'.format(res_x, res_y, res_z))
Problem p03693 (python)

Fixed submission:
r, g, b = map(int, input().split())
if (r*100 + g*10 + b) % 4 == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
rgb = int(''.join(input()))
if rgb % 4 == 0:
    print('Yes')
else:
    print('No')
Problem p03694 (python)

Fixed submission:
N = int(input())
A = sorted(map(int, input().split()))
d = 0
for i in range(1, N):
    d += A[i] - A[i-1]
print(d)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = sorted(map(int, input().split()))
A[0] = 0
d = 0
for i in range(1, N+1):
    d += A[i] - A[i-1]
print(d)
Problem p02584 (python)

Fixed submission:
import sys

# x = abs(int(input()))
# k = int(input())
# d = int(input())

array = list(map(int, input().strip().split()))
x = abs(array[0])
k = array[1]
d = array[2]
if (d == 0):
    amari = abs(x)

else:
    move_cnt = int(x / d)
    if (move_cnt <= k):
        k -= move_cnt
        amari = x - move_cnt * d

    else:
        amari = x - k * d
        k = 0

    if (k > 0):
        if (k % 2 == 1):
            if (amari > 0):
                amari -= d
            else:
                amari += d

print(abs(amari))

Buggy submission (verdict: Runtime Error):
import sys

x = abs(int(input()))
k = int(input())
d = int(input())

move_cnt = int(x / d)
if (move_cnt <= k):
    k -= move_cnt
    amari = x - move_cnt * d

else:
    amari = x - k * d
    k = 0

if (k > 0):
    if (k % 2 == 1):
        if (amari > 0):
            amari -= d
        else:
            amari += d

print(abs(amari))

Buggy submission (verdict: Runtime Error):
import sys

x = abs(int(input()))
k = int(input())
d = int(input())

move_cnt = float(x / d)
if (move_cnt <= k):
    k -= move_cnt
    amari = x - move_cnt * d

else:
    k = 0
    amari = x - move_cnt * d

if (k > 0):
    if (k % 2 == 1):
        if (amari > 0):
            amari -= d
        else:
            amari += d

print(int(abs(amari)))
Problem p02639 (python)

Fixed submission:
lst = list(map(int, input().split()))
for i in range(5):
    if lst[i] == 0:
        print(i + 1)
        exit()

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

for i in lst:
  i == 0:
    print(i)
    exit()
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = int(input().split())
print(a * b)
Problem p02720 (python)

Fixed submission:
k = int(input()) 
 
lunlun = [i for i in range(1, 10)]
 
p = 0 

def generate_lunlun(p):
    last = p % 10
    if last - 1 >= 0:
        yield p * 10 + last - 1
    yield p * 10 + last
    if last + 1 <= 9:
        yield p * 10 + last + 1 

while len(lunlun) < k:
    for new_lunlun in generate_lunlun(lunlun[p]):
        lunlun.append(new_lunlun)
    p += 1

print(lunlun[k-1])

Buggy submission (verdict: Runtime Error):
k = int(input()) 
 
 lunlun = [i for i in range(1, 10)]
 
 p = 0 

 def generate_lunlun(p):
     last = p % 10
     if last - 1 >= 0:
         yield p * 10 + last - 1
    yield p * 10 + last
    if last + 1 <= 9:
        yield p * 10 + last + 1 

while len(lunlun) < k:
    for new_lunlun in generate_lunlun(lunlun[p]):
        lunlun.append(new_lunlun)
    p += 1

print(lunlun[k-1])
Problem p02730 (python)

Fixed submission:
s = list(input())
n = len(s)
s_0 = s[:(n-1)//2]
s_1 = s[(n+1)//2:]
if s_0 == s_0[::-1] and s_1 == s_1[::-1] and s == s[::-1]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = list(input())
n = len(s)
s_0 = s[:(n-1)//2]
s_1 = s[(n+1)//2:]
if s_0 == s_0[::-1] and s_1 == s_1[::-1] and s == s[::-1]
    print("Yes")
else:
    print("No")
Problem p02761 (python)

Fixed submission:
n, m = map(int, input().split())
lst = [list(map(int, input().split())) for _ in range(m)]
for i in range(1000):
    i = str(i)
    if len(i) != n:
        continue
    for [x, y] in lst:
        if i[x-1] != str(y):
            break
    else: 
        print(i)
        exit()

print(-1)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split()) 
ans = ['', '', '']
if M == 0:
    print(0)
    exit()
for i in range(M):
    s, c = input().split()
    s = int(s)-1
    if ans[s] in ['', c]:
        ans[s] = c
    else:
        print(-1)
        exit()

if ans[0] == '0' and n >1:
    ans = -1
 
elif ans[0] == '' and ans[1] == '0' and n == 3:
    ans = -1

if ans == -1:
    print(ans)
    exit()

if ans[1] == '':
    ans[1] = '0'
if ans[2] == '':
    ans[2] = '0'

if N == 2:
    ans.pop()
if N == 1:
    ans = ans[0]

print(''.join(ans))
Problem p02780 (python)

Fixed submission:
from itertools import accumulate
N, K = map(int, input().split())
P = list(map(int, input().split()))
P = [0]+[(p+1)/2 for p in P]
S = list(accumulate(P))
B = []
for j in range(N-K+1):
    B.append(S[j+K]-S[j])
ans = max(B)
print(ans)

Buggy submission (verdict: Runtime Error):
    N, K = map(int, input().split())
P = list(map(int, input().split()))
P = [(p+1)/2 for p in P]
def s(i):
    return sum(P[:i-1])

S = []
for i in range(N+1):
    S.append(s(i))
B = []
for j in range(N-K+1):
    B.append(S[j+K]-S[j])
ans = max(B)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
a = [(a[i]+1)/2 for i in range(n)]
acc = [0]+list(sum(a))
ans = 0
for i in range(n-k+1):
  ans = max(ans,acc[i+k]-acc[i])
print(ans)
Problem p02801 (python)

Fixed submission:
a = "abcdefghijklmnopqrstuvwxyz"
a = list(a)

c = input()
n = a.index(c)
print(a[n+1])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
lst = [[0, 0] for _ in range(n)]
for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        lst[p-1][0] = 1
    elif lst[p-1][0] == 0:
        lst[p-1][1] += 1

correct = 0
wrong = 0
for i in range(n):
    correct += lst[i][0]
    if lst[i][0] == 1:
        wrong += lst[i][1]
print(correct, wrong)
Problem p02802 (python)

Fixed submission:
n, m = map(int, input().split())
lst = []
for _ in range(n):
    lst.append([0, 0])

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        lst[p-1][0] = 1
    elif lst[p-1][0] == 0:
        lst[p-1][1] += 1

correct = 0
wrong = 0
for i in range(n):
    correct += lst[i][0]
    if lst[i][0] == 1:
        wrong += lst[i][1]
print(correct, wrong)

Buggy submission (verdict: Runtime Error):
import numpy as np
n, m = map(int, input().split())
lst = []
for _ in range(n):
    lst.append([0, 0])

for _ in range(m):
    p, s = input().split()
    p = int(p)
    if s == 'AC':
        lst[p-1][0] = 1
    elif lst[p-1][0] == 0:
        lst[p-1][1] += 1

correct = 0
wrong = 0
for i in range(n):
    correct += lst[i][0]
    wrong += lst[i][1]
print(correct, wrong)
Problem p02817 (python)

Fixed submission:
s, t = input().split()
print(t+s)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
if k <= a:
    a1 = a - k
    b1 = b
elif a < k and k < a + b:
    a1 = 0
    b1 = b - (k-a)
else:
    a1 = 0
    b1 = 0

print(a1, b1)
Problem p02818 (python)

Fixed submission:
a, b, k = map(int, input().split())
if k <= a:
    a1 = a - k
    b1 = b
elif a < k and k < a + b:
    a1 = 0
    b1 = b - (k-a)
else:
    a1 = 0
    b1 = 0

print(a1, b1)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
if k <= a:
    a1 = a - k
elif a < k and k < a + b:
    a1 = 0
    b1 = b - (k-a)
else:
    a1 = 0
    b1 = 0

print(a1, b1)
Problem p02582 (python)

Fixed submission:
import re

x = input()
pattern = "R+"
pat = re.search(pattern, x)
if pat:
  print(len(pat.group()))
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import re

x = input()
pattern = "R+"
pat = re.match(pattern, x)
print(len(pat.group()))
Problem p02608 (python)

Fixed submission:
n=int(input())

max_n=10**4+5
ans=[0]*(max_n+1)
for x in range(1,105):
    for y in range(1,105):
        for z in range(1,105):
            total=x**2+y**2+z**2+x*y+y*z+z*x
            if total<=max_n:
                ans[total]+=1

for i in range(1,n+1):
    print(ans[i])

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

ans=[0]*(1001)
for x in range(1,34):
    for y in range(1,34):
        for z in range(1,34):
            total=x**2+y**2+z**2+x*y+y*z+z*x
            if total<=1000:
                ans[total]+=1

for i in range(1,n+1):
    print(ans[i])
Problem p02642 (python)

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

from collections import Counter
c=Counter(a)

max_a=max(a)
bls=[0]*(max_a+1)
for a_i in a:
    for j in range(a_i, max_a+1, a_i):
        bls[j]+=1
ans=0
for a_i in a:
    if bls[a_i]==1 and c[a_i]==1:
        ans+=1
print(ans)

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

a.sort()
if a[0]==a[1]:
    flag=True
else:
    flag=False
for i in range(n-1):
    if a[i]==0:
        continue
    else:
        for j in range(i+1,n):
            # print(a[j],a[i])
            if a[j]%a[i]==0:
                a[j]=0
            # print(a)

print(n-a.count(0)-1 if flag else n-a.count(0))
Problem p02646 (python)

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

if v<=w:
    print('NO')
elif a<b:
    if (a+v*t)>=(b+w*t):
        print('YES')
    else:
        print('NO')
else:
    if (a-v*t)<=(b-w*t):
        print('YES')
    else:
        print('NO')

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

if (a+v*t)>=(b+w*t) and (b-a)%(v-w)==0:
    print('YES')
else:
    print('NO')
Problem p02684 (python)

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

for i in range(n):
    a[i]-=1

rec=[-1]*n
turn=0
current=0

while True:
    if k<=0:
        print(current+1)
        break
    if rec[current]==-1:
        rec[current]=turn
        turn+=1
        current=a[current]
        k-=1
    else:
        loop=turn-rec[current]
        k%=loop
        rec=[-1]*n

Buggy submission (verdict: Runtime Error):
n, k_in=map(int, input().split())
a_l=list(map(int, input().split()))

def f(s):
    a = s
    b = s
    i=1
    while True:
        a = a_l[a-1]
        a = a_l[a-1]
        b = a_l[b-1]
        if a == b:
            break
        i+=1

    j=1
    a = a_l[0]
    while True:
        a = a_l[a-1]
        b = a_l[b-1]
        if a == b:
            break
        j+=1

    k=1
    while True:
        a = a_l[a-1]
        a = a_l[a-1]
        b = a_l[b-1]
        if a == b:
            break
        k+=1

    return j, k

lam, myu = f(a_l[0])

pos=[]
pos.append(a_l[0])
for i in range(n):
    pos.append(a_l[pos[i]])

if k_in<=lam:
    print(pos[k_in-1])
else:
    k_in=(k_in-lam)%myu
    print(pos[lam+k_in-1])
Problem p02690 (python)

Fixed submission:
x=int(input())
for a in range(-200,200):
    for b in range(-200,200):
        if (a**5-b**5)==x:
            a_ans=a
            b_ans=b
            break

print(a_ans,b_ans)

Buggy submission (verdict: Runtime Error):
x=int(input())
for a in range(-100,100):
    for b in range(-100,100):
        if (a**5-b**5)==x:
            a_ans=a
            b_ans=b
            break

print(a_ans,b_ans)
Problem p02741 (python)

Fixed submission:
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1])

Buggy submission (verdict: Runtime Error):
a=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])
Problem p02784 (python)

Fixed submission:
h,n=map(int,input().split())
a=list(map(int, input().split()))
print('Yes' if h<=sum(a) else ('No'))

Buggy submission (verdict: Runtime Error):
h,n=map(int,input().split())
a=list(map(int, input().split()))
print('Yes' if h<=sum(a) else (No))
Problem p02844 (python)

Fixed submission:
n = int(input())

s = input()

ans = set()
for i in range(10):
    a = s.find(str(i))
    if a == -1:
        continue
    for j in range(10):
        b = s.find(str(j), a+1)
        if b == -1:
            continue
        for k in range(10):
            if s.find(str(k), b+1) != -1:
                ans.add(str(i)+str(j)+str(k))
print(len(ans))

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

for i in range(n-1):
    i_set=set(s[i+1:])

    for j in i_set:
        j_ind=s.index(j)
        s_i=s[i+1:]
        j_set=set(s_i[s_i.index(j)+1:])
        [ans.add(s[i]+j+k) for k in j_set]

print(len(ans))
Problem p02947 (python)

Fixed submission:
from collections import Counter
import sys
input = sys.stdin.readline

n = int(input())
s = [''.join(sorted(input())).strip() for _ in range(n)]
c = Counter(s)
ans=sum(map(lambda x: x*(x-1)//2, c.values()))
print(ans)

Buggy submission (verdict: Runtime Error):
import fractions


def P(n, r):
    return fractions.factorial(n)//fractions.factorial(n-r)

def C(n, r):
    return P(n, r)//fractions.factorial(r)

n = int(input())
str_list = []
for i in range(n):
    str_list.append(list(sorted(input())))
str_list=sorted(str_list)
str_list.append("a")

ans=0
cnt=0
for i in range(n):
    if str_list[i]==str_list[i+1]:
        cnt+=1
    else:
        if cnt==1:
            ans+=1
            cnt = 0
        else:
            ans+=C(cnt+1,2)
            cnt=0

print(ans)

Buggy submission (verdict: Runtime Error):
def fact(n):
    if n == 0 or n == 1:
        return 1
    else:
        return n * fact(n-1)

def P(n, r):
    return fact(n)//fact(n-r)

def C(n, r):
    return P(n, r)//fact(r)

n = int(input())
str_list = []
for i in range(n):
    str_list.append(list(sorted(input())))
str_list=sorted(str_list)
str_list.append("a")

ans=0
cnt=0
for i in range(n):
    if str_list[i]==str_list[i+1]:
        cnt+=1
    else:
        if cnt==1:
            ans+=1
            cnt = 0
        else:
            ans+=C(cnt+1,2)
            cnt=0

print(ans)

Buggy submission (verdict: Runtime Error):
import math


def P(n, r):
    return math.factorial(n)//math.factorial(n-r)

def C(n, r):
    return P(n, r)//math.factorial(r)

n = int(input())
str_list = []
for i in range(n):
    str_list.append(list(sorted(input())))
str_list=sorted(str_list)
str_list.append("a")

ans=0
cnt=0
for i in range(n):
    if str_list[i]==str_list[i+1]:
        cnt+=1
    else:
        if cnt==1:
            ans+=1
            cnt = 0
        else:
            ans+=C(cnt+1,2)
            cnt=0

print(ans)
Problem p02982 (python)

Fixed submission:
import numpy as np

n,d=map(int,input().split())
x=[list(map(int,input().split())) for _ in range(n)]

cnt=0
for i in range(n-1):
    for j in range(i+1,n):
        dist=0
        for k in range(d):
            dist+=(x[i][k]-x[j][k])**2
        for dist2 in range(int(np.sqrt(dist))+1):
            if dist2**2==dist:
                cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np

n,d=map(int,input().split())
x=[list(map(int,input().split())) for _ in range(n)]

cnt=0
for i in range(n-1):
    for j in range(i+1,n):
        dist=0
        for k in range(d):
            dist+=(x[i][k]-x[j][k])**2
        for dist2 in range(int(np.sqrt(dist))+1):
            if dist2**2==dist:
                cnt+=1
print(cnt)
Problem p03006 (python)

Fixed submission:
n=int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
diff={}

for i in range(n):
    for j in range(n):
        if i==j:
            continue
        if ((xy[i][0]-xy[j][0]),(xy[i][1]-xy[j][1])) in diff:
            diff[((xy[i][0]-xy[j][0]), (xy[i][1]-xy[j][1]))]+=1
        else:
            diff[((xy[i][0] - xy[j][0]), (xy[i][1] - xy[j][1]))] = 1

print(n-max(diff.values()) if n!=1 else 1)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n=int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
xy=sorted(xy)
xy_diff=[]

for i in range(0,n-1):
    xy_diff.append(xy[i][0]-xy[i+1][0])

c=Counter(xy_diff)
mode = c.most_common(1)
saihin=mode[0][0]

xy1_diff=[]

for i in range(0,n-1):
    if xy[i][0]-xy[i+1][0]==saihin:
        xy1_diff.append(xy[i][1]-xy[i+1][1])

d=Counter(xy1_diff)
mode = d.most_common(1)
kaisu=mode[0][1]


print(n-kaisu)
Problem p03048 (python)

Fixed submission:
r,g,b,n=map(int,input().split())

lst=[r,g,b]
lst.sort()
r=lst[2]
g=lst[1]
b=lst[0]

rlim=n//r
glim=n//g
blim=n//b

"""
blist = [i*b for i in range(blim+1)]

glist = [i*g for i in range(glim+1)]

def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1
    return False
"""

cnt=0

for i in range(rlim+1):
    glim=(n-i*r)//g
    for j in range(glim+1):
        if (n-i*r-j*g)%b==0:
            cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
import numpy as np
r,g,b,n=map(int,input().split())

lst=[r,g,b]
lst.sort()
r=lst[2]
g=lst[1]
b=lst[0]

rlim=n//r
blim=n//b

blist = np.array([i*b for i in range(blim+1)])

def binary_search(list, item):
    low = 0
    high = len(list) - 1

    while low <= high:
        mid = (low + high) //2
        guess = list[mid]
        if guess == item:
            return True
        if guess > item:
            high = mid -1
        else:
            low = mid + 1
    return False


cnt=0

for i in range(rlim+1):
    glim=(n-i*r)//g
    for j in range(glim+1):
        if binary_search(blist,n-i*r-j*g):
            cnt+=1
print(cnt)
Problem p03049 (python)

Fixed submission:
from collections import Counter

n=int(input())
s=[input() for _ in range(n)]

cnt=0
cnt_a=0
cnt_b=0
cnt_ab=0
for i in range(n):
    if s[i][0]=='B' and s[i][-1]=='A':
        cnt_ab+=1
    elif s[i][0]=='B':
        cnt_b+=1
    elif s[i][-1]=='A':
        cnt_a+=1
    cnt+=s[i].count('AB')
if cnt_ab==0:
    ans=cnt+min(cnt_a,cnt_b)
else:
    if cnt_a==0 and cnt_b==0:
        ans=cnt+cnt_ab-1
    else:
        ans=cnt+cnt_ab+min(cnt_a,cnt_b)

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n=int(input())
s=[input() for _ in range(n)]

cnt=0
cnt_a=0
cnt_b=0
cnt_ab=0
for i in range(n):
    if s[i][0]=='B' and s[i][-1]=='A':
        cnt_ab+=1
    elif s[i][0]=='B':
        cnt_b+=1
    elif s[i][-1]=='A':
        cnt_a+=1
    cnt+=s[i].count('AB')
if cnt_ab=0:
    ans=cnt+min(cnt_a,cnt_b)
elif:
    if cnt_a=0 and cnt_b=0:
        ans=cnt+cnt_ab-1
    else:
        ans=cnt+min(cnt_a,cnt_b)

print(ans)
Problem p03061 (python)

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

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    return gcd(b, a % b)


def main():
    n = int(input())
    A = list(map(int, input().split()))
    gcdA = [0]*n
    gcdB = [0]*n
    gcdA[0] = A[0]
    gcdB[n-1] = A[n-1]
    for i in range(1, n):
        gcdA[i] = gcd(A[i], gcdA[i-1])
        gcdB[n-i-1] = gcd(A[n-i-1], gcdB[n-i])
    ans = max(gcdA[n-2], gcdB[1])
    for i in range(1, n-1):
        ans = max(ans, gcd(gcdA[i-1], gcdB[i+1]))
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
#import sys
#input = sys.stdin.readline


def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    return gcd(b, a % b)


def main():
    n = int(input())
    A = list(map(int, input().split()))
    gcdA = [0]*n
    gcdB = [0]*n
    gcdA[0] = A[0]
    gcdB[0] = A[n-1]
    for i in range(1, n):
        gcdA[i] = gcd(A[i], gcdA[i-1])
        gcdB[i] = gcd(A[n-i-1], gcdB[n-1])
    ans = max(gcdA[n-2], gcdB[1])
    for i in range(1, n):
        ans = max(ans, gcd(gcdA[i-1], gcdB[i+1]))
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    return gcd(b, a % b)


def main():
    n = int(input())
    A = list(map(int, input().split()))
    gcdA = [0]*n
    gcdB = [0]*n
    gcdA[0] = A[0]
    gcdB[0] = A[n-1]
    for i in range(1, n):
        gcdA[i] = gcd(A[i], gcdA[i-1])
        gcdB[i] = gcd(A[n-i-1], gcdB[n-1])
    ans = max(gcdA[n-2], gcdB[1])
    for i in range(1, n):
        ans = max(ans, gcd(gcdA[i-1], gcdB[i+1]))
    print(ans)


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import copy
import functools
import math

n=int(input())
lstA=list(map(int,input().split()))
maximum=max(lstA)
gcdlst=[]

for i in range(n):
    cplstA=copy.copy(lstA)
    del cplstA[i]
    gcdlst.append(functools.reduce(math.gcd, cplstA))

print(max(gcdlst))
Problem p03062 (python)

Fixed submission:
#import sys
#input = sys.stdin.read

n=int(input())
lsta=list(map(int, input().split()))

abslsta=[abs(v) for v in lsta]
min_index=abslsta.index(min(abslsta))

for i in range(n-1):
    if lsta[i]<0:
        lsta[i]=lsta[i]*(-1)
        lsta[i+1]=lsta[i+1]*(-1)

if lsta[n-1]<0:
    if min_index==n-1:
        print(sum(lsta))

    else:
        print(sum(lsta)-lsta[n-1]*2-lsta[min_index]*2)

else:
    print(sum(lsta))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.read


n=int(input())
lsta=list(map(int, input().split()))

abslsta=[abs(v) for v in lsta]
min_index=abslsta.index(min(abslsta))

for i in range(n-1):
    if lsta[i]<0:
        lsta[i]=lsta[i]*(-1)
        lsta[i+1]=lsta[i+1]*(-1)

if lsta[n-1]<0:
    if min_index==n-1:
        print(sum(lsta))

    else:
        print(sum(lsta)-lsta[n-1]*2-lsta[min_index]*2)

else:
    print(sum(lsta))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.read

n=int(input())
lsta=list(map(int,input().split()))

abslsta=[abs(v) for v in lsta]
min_index=abslsta.index(min(abslsta))

for i in range(n-1):
    if lsta[i]<0:
        lsta[i]=lsta[i]*(-1)
        lsta[i+1]=lsta[i+1]*(-1)
        print(lsta)


if lsta[n-1]<0:
    if min_index==n-1:
        print(sum(lsta))

    else:
        print(sum(lsta)-lsta[n-1]*2-lsta[min_index]*2)

else:
    print(sum(lsta))
Problem p03076 (python)

Fixed submission:
lst=[int(input()) for _ in range(5)]

c=[]
for i in range(5):
    if lst[i]%10!=0:
        c.append(lst[i]%10)
        lst[i]=(lst[i]//10+1)*10

if not c:
    print(sum(lst))
else:
    print(sum(lst)+min(c)-10)

Buggy submission (verdict: Runtime Error):
lst=[int(input()) for _ in range(5)]

c=[]
for i in range(5):
    if lst[i]%10!=0:
        c.append(lst[i]%10)
        lst[i]=(lst[i]//10+1)*10


print(sum(lst)-10+min(c))