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

Fixed submission:
s = input()
count = 0 
if s[0] == '1':
    count += 1
if s[1] == '1':
    count += 1
if s[2] == '1':
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
s=input()
count = 0 
if s[0] == '1':
    count += 1
if s[1] == '1':
    count += 1
if s[2] == '1':
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
s=input()
count = 0 
if s[0] == 1:
    count += '1'
elif s[1] == 1:
    count += '1'
elif s[2] == 1:
    count += '1'
else:
    count = 0
    print(count('1'))

Buggy submission (verdict: Runtime Error):
s=input()
 
count = 0 
if s[0] == 1:
    count += '1'
elif s[1] == 1:
    count += '1'
elif s[2] == 1:
    count += '1'
else:
    count = 0
    print(count('1')

Buggy submission (verdict: Runtime Error):
s=input()
 
count = 0 
if s[0] = 1:
    count + = 1
elif s[1] = 1:
    count + = 1
elif s[2] = 1:
    count + = 1
else:
    count = 0
    print(s.count('1')

Buggy submission (verdict: Runtime Error):
s=input()
 
count = 0 
if s[0] = 1:
    count + = 1
elif s[1] = 1:
    count + = 1
elif s[2] = 1:
    count + = 1
else:
    count = 0
    print(s.count('1')

Buggy submission (verdict: Runtime Error):
s=input()
 
if s[0] = 1:
    con + = 1
elif s[1] = 1:
    con + = 1
elif s[2] = 1:
    con + = 1
    print(1)

Buggy submission (verdict: Runtime Error):
s = int(input())
print(s.count('1'))

Buggy submission (verdict: Runtime Error):
s=int(input())
 
if s[0] == 1:
    print(1)
elif s[1] == 1:
    print(1)
elif s[2] == 1:
    print(1)
else:
    print(0)
s.count(1)

Buggy submission (verdict: Runtime Error):
s1=int(input())
s2=int(input())
s3=int(input())

S=[s1,s2,s3]
S.count(1)

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

if s[0] == 1:
    print(a)
elif s[1] == 1:
    print(a)
elif s[2] == 1:
    print(a)
else:
    print(b)
print(count(a))
Problem p03262 (python)

Fixed submission:
from functools import reduce
import fractions
N, X = [int(i) for i in input().split()]
x = [int(x) for x in input().split()]
x.append(X)
x.sort()

distance = []
for i,xe in enumerate(x):
    if i is not 0:
        distance.append(xe - x[i-1])

print(reduce(fractions.gcd, distance))

Buggy submission (verdict: Runtime Error):
import fraction
N, X = [int(i) for i in input().split()]
x = [int(x) for x in input().split()]
x.append(X)
x.sort()

distance = []
for i,xe in enumerate(x):
    if i is not 0:
        distance.append(xe - x[i-1])

print(fraction.gcd(distance))
Problem p02885 (python)

Fixed submission:
A,B=raw_input().split()

a = int(A)
b = int(B)

c = a - 2 * b

print 0 if c < 0 else c

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(raw_input())
AN=map(int, raw_input().split())
BN=[0 for i in xrange(N)]
for i in AN:
    BN[i-1] += 1
BN=[i for i in BN if i > 0]
BN.sort(reverse=True)

for K in xrange(1, N+1):
    x = np.zeros(K)
    for i in BN:
        x[x.argmin()] += i

    print (int(x.min()))
Problem p02890 (python)

Fixed submission:
N=int(raw_input())
AN=map(int, raw_input().split())

BN=[0 for i in xrange(N)]
for i in AN:
    BN[i-1] += 1
BN.sort()

LN = [0 for i in xrange(N)]
s = 0
j = 0
try:
    for X in xrange(1, N+1):
        while j<N and  BN[j] < X:
            s += BN[j]
            j += 1
        LN[X-1] = (s + X*(N - j)) / X
except IndexError:
    pass

KN = [0 for i in xrange(N)]
for i in xrange(len(LN)):
    KN[LN[i]-1] = i+1

for i in xrange(len(KN)-2, -1, -1):
    if KN[i] == 0:
        KN[i] = KN[i+1]

for i in KN:
    print (str(i))

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(raw_input())
AN=map(int, raw_input().split())
BN=[0 for i in xrange(N)]
for i in AN:
    BN[i-1] += 1
BN=[i for i in BN if i > 0]
BN.sort(reverse=True)

for K in xrange(1, N+1):
    x = np.zeros(K)
    for i in BN:
        x[x.argmin()] += i

    print (int(x.min()))

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
AN=map(int, input().split())
BN=[0 for i in range(N)]
for i in AN:
    BN[i-1] += 1
BN=[i for i in BN if i > 0]
BN.sort(reverse=True)

for K in range(1, N+1):
    x = np.zeros(K)
    for i in BN:
        x[x.argmin()] += i

    print (int(x.min()))
Problem p03219 (python)

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

print(int(x + y/2))

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

y = int(input())

sum = x + y/2 

print(sum)

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

y = int(input())/2

sum = x + y

print(sum)
Problem p02983 (python)

Fixed submission:
L,R = map(int,input().split())
amr =[]
if R-L > 2019:
  amari = sorted([i%2019 for i in range(L,L+2019)])
  if 0 in amari:
    print(0)
  else:
    for i,j in enumerate(amari):
      for k in amari[i+1::]:
        amr.append(j*k%2019)
    print(min(amr))
else:
  amari = sorted([i%2019 for i in range(L,R+1)])
  if 0 in amari:
    print(0)
  else:
    for i,j in enumerate(amari):
      for k in amari[i+1::]:
        amr.append(j*k%2019)
    print(min(amr))

Buggy submission (verdict: Runtime Error):
L,R = map(int,input().split())
amr =[]
if R-L > 2019:
  amari = sorted([i%2019 for i in range(L,L+2019)])
  if 0 in amari:
    print(0)
  else:
    for i,j in enumerate(amari):
      for k in amari[i+1::]:
        amr.append(j*k%2019)
else:
  amari = sorted([i%2019 for i in range(L,R+1)])
  if 0 in amari:
    print(0)
  else:
    for i,j in enumerate(amari):
      for k in amari[i+1::]:
        amr.append(j*k%2019)
        
print(min(amr))
Problem p03076 (python)

Fixed submission:
times = [int(input()) for i in range(5)]

time = []

for i in range(5):
  time.append(0)
  while (times[i] + time[i]) % 10 != 0:
    time[i] += 1

print(sum(times)+sum(time)-max(time))

Buggy submission (verdict: Runtime Error):
times = [int(input()) for i in range(5)]
summ = sum(times)

time = times[:]

for i in range(5):
  while time[i] - 10 >= 0:
    time[i] -= 10

unko = [10-i for i in time]

while 10 in unko:
  unko.remove(10)

unko.remove(max(unko))

print(summ+sum(unko))
Problem p03086 (python)

Fixed submission:
word = input()
num = [0]
index = 0
for i in word:
  if i.strip("ATCG") == "":
    num[index] += 1
  else:
    index += 1
    num.append(0)
print(max(num))

Buggy submission (verdict: Runtime Error):
word = input()
print(len(word.("QWERYUIOPSDFHJKLZXVBNM")))
Problem p03417 (python)

Fixed submission:
n,m = map(int,input().split())
if n == 1:
  if m == 1:
    print(1)
  elif m == 2:
    print(0)
  else:
    print(m-2)
elif m == 1:
  if n == 2:
    print(0)
  else:
    print(n-2)
else:
  print(n*m-(n*2+m*2-4))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
if n == 1:
  if m == 1:
    print(1)
  elif m == 2:
    print(0)
  else:
    print(m-2)
elif m == 1:
  elif n == 2:
    print(0)
  else:
    print(n-2)
else:
  print(n*m-(n*2+m*2-4))
Problem p03435 (python)

Fixed submission:
ar = [[int(i) for i in input().split()] for j in range(3)]

if ar[0][0] + ar[1][1] + ar[2][2] == ar[0][1] + ar[1][2] + ar[2][0] == ar[0][2] + ar[1][0] + ar[2][1]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
ar = [[int(i) for i in input().split()] for j in range(3)]

if ar[0][0] + ar[1][1] + ar[2][2] == ar[0][1] + ar[1][2] + ar[2][0] == ar[0][3] + ar[1][0] + ar[2][1]:
  print("Yes")
else:
  print("No")
Problem p02999 (python)

Fixed submission:
List = list(map(int,input().split()))
if List[0] >= List[1]:
  print(10)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
List = list(map(int,inport().split()))
if List[0] >= List[1]:
  print(10)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
List = list(map(int,inport().split()))
if List[0] >= List[1]:
  print('10')
else:
  print('0')
Problem p03030 (python)

Fixed submission:
n=int(input())
List=[[input().split() , i+1] for i in range(n)]

List=sorted(List,key=lambda x : (x[0][0],-int(x[0][1])))

for i in range(n):
    print(List[i][1])

Buggy submission (verdict: Runtime Error):
n=int(input())
List=[[input().split() , i+1] for i in range(n)]

List=sorted(List,key=lambda x : (x[0],-int(x[1])))

for i in range(n):
    print(List[i][2])
Problem p03031 (python)

Fixed submission:
n,m=map(int,input().split())
List=[list(map(int,input().split())) for i in range(m)]
P=list(map(int,input().split()))

ans=0

for i in range(2**n):
    flug=True
    for l in range(m):
        count=0
        for j in range(List[l][0]):
            if ((i >> (List[l][j+1]-1))&1)==1:
                count += 1
        if count%2 != P[l]:
            flug=False
    if flug==True:
        ans += 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
List=[list(map(int,input().split())) for i in range(m)]
P=list(map(int,input().split()))

k=0
ans=0
flug=True

for i in range(n):
    k=bin(i)
    for l in range(m):
        count=0
        for j in range(List[l][0]):
            if ((k>>List[l][j+1])&1)==1:
                count += 1
        if count%2 != P[l]:
            flug=False
    if flug==True:
        ans += 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
List=[list(map(int,input().sprit())) for i in range(m)]
P=list(map(int,input().split()))

k=0
ans=0
flug=True

for i in range(n):
    k=bin(i)
    for l in range(m):
        count=0
        for j in range(List[l][0]):
            if ((k>>List[l][j+1])&1)==1:
                count += 1
        if count%2 != P[l]:
            flug=False
    if flug==True:
        ans += 1
        
print(ans)
Problem p03797 (python)

Fixed submission:
List=[int(j) for j in input().split()]
a=List[0]
b=List[1]

if b>2*a:
    c=b-2*a
    d=c//4
    print(a+d)
else:
    print(b//2)

Buggy submission (verdict: Runtime Error):
List=[int(j) for j in input().split()]
a=List[1]
b=List[2]

if b>2*a:
    c=b-2*a
    d=c//4
    print(a+d)
else:
    print(b//2)

Buggy submission (verdict: Runtime Error):
List=input().split()
a=int(List[1])
b=int(List[2])

if b>2*a:
    c=b-2*a
    d=c//4
    print(a+d)
else:
    print(b//2)

Buggy submission (verdict: Runtime Error):
a,b=input().split()

if b>2*a:
    c=b-2*a
    d=c//4
    print(a+d)
else:
    print(b//2)

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

if b>2*a:
    c=b-2*a
    d=c//4
    print(a+d)
else:
    print(b//2)

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


    c=b-2*a
    d=c//4
    print(a+d)

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

if b>2*a:
    c=b-2*a
    d=c//4
    print(a+d)
else:
    print(b//2)
Problem p02861 (python)

Fixed submission:
n = int(input())

xy = [list(map(int, input().split())) for i in range(n)]
s = 0
for i in range(n):
    for j in range(i+1, n):
        s += ((xy[i][0]-xy[j][0])**2 + (xy[i][1]-xy[j][1])**2)**0.5
print(s*2/n)

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

xy = [input().split() for i in range(n)]
s = 0
for i in range(n):
    for j in range(i+1, n):
        s += ((xy[i][0]-xy[j][0])**2 + (xy[i][1]-xy[j][1])**2)**0.5
print(s*2/n)

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

x,y = [input().split() for i in range(n)]
x = list(map(int, x))
y = list(map(int, y))
s = 0
for i in range(n):
    for j in range(i+1, n):
        s += ((x[i]-x[j])**2 + (y[i]-y[j])**2)**0.5
print(s*2/n)
Problem p03238 (python)

Fixed submission:
n=int(input())
if n==1:
  print('Hello World')
else:
    print(int(input())+int(input()))

Buggy submission (verdict: Runtime Error):
n=int(input())
if n == 1:
  print("Hello World")
  
else:
	a=int(input())
	b=int(input())
    print(a+b)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==1:
  print("Hello World")
a=int(input())
b=int(input())
else:
  print(a+b)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
if n==1:
  print("Hello World")
else:
  print(a+b)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
if n==1:
  print("Hello World")
else:
  print(a+b)
Problem p03377 (python)

Fixed submission:
a,b,x=map(int,input().split())
if a<=x<=a+b:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a,b,x=map(int,input().split())
if a>c or a+b<x:
  print("No")
else:
  print("Yes")
Problem p03543 (python)

Fixed submission:
a,b,c,d=input()
if a==b==c or b==c==d:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a==b==c or b==c==d:
  print("Yes")
else:
  print("No")
Problem p03547 (python)

Fixed submission:
x,y=map(str,input().split())
if ord(x)>ord(y):
  print(">")
elif ord(x)<ord(y):
  print("<")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
if x>y:
  print(">")
elif x<y:
  print("<")
else:
  print("=")
Problem p03563 (python)

Fixed submission:
r=int(input())
g=int(input())
print(2*g-r)

Buggy submission (verdict: Runtime Error):
r=int(input())
g=int(input())
print(2*b-a)
Problem p03737 (python)

Fixed submission:
a,b,c=map(str,input().split())
print(a[0].upper()+b[0].upper()+c[0].upper())

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(a[0].upper()+b[0].upper()+c[0].upper())
Problem p03773 (python)

Fixed submission:
a,b=map(int,input().split())
print((a+b)%24)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
  print(a+b%24)
Problem p03777 (python)

Fixed submission:
a,b=map(str,input().split())
if a==b:
  print("H")
else:
  print("D")

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
if a=="H" and b="H" or a=="D" and b="D":
  print("H")
elif a=="H" and b="D" or a=="D" and b="H":
  print("D")

Buggy submission (verdict: Runtime Error):
a,b=map(str,input().split())
if a=="H" and b="H" or a=="D" and b="D":
  print("H")
else:
  print("D")
Problem p03943 (python)

Fixed submission:
a,b,c = map(int, input().split())
if max(a,b,c)*2==a+b+c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int.input().split())
total=a+b+c
if total%2==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
total=a+b+c
if total%2=0:
  print("Yes")
else:
  print("No")
Problem p03962 (python)

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

print(len(set(abc)))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if a==b==c:
  print(1)
elif a=!b=!=!c:
  print(3)
else:
  print(2)
Problem p02882 (python)

Fixed submission:
import math


a, b, x = map(int, input().split())
r = 180 / math.pi
h = x / a ** 2
c = h * 2 - b
d = 2 * x / (a * b)
if h >= b / 2:
    th = math.atan((h - c) / (a / 2)) * r
else:
    th = ((math.pi / 2) - math.atan((d / b))) * r
print(th)

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
r = 180 / math.pi
h = x / a ** 2
c = h * 2 - b
d = 2 * x / (a * b)
if h >= b / 2:
    th = math.atan((h - c) / (a / 2)) * r
else:
    th = ((math.pi / 2) - math.atan((d / b))) * r
print(th)
Problem p02952 (python)

Fixed submission:
N = int(input())
n = len(list(str(N)))
if n >= 6:
  ans = 90909
elif n >= 5:
  ans = 909 + (N - 9999)
elif n >= 4:
  ans = 909
elif n >= 3:
  ans = 9 + (N - 99)
elif n >= 2:
  ans = 9
else:
  ans = N
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
n = len(list(N))
d_list = [9, 900, 90000]
if n >= 5:
  ans = 90909
elif n >= 4:
  ans = 909
elif n >= 3:
  ans = 9 + N % 1000
elif n >= 2:
  ans = 9
else:
  ans = N % 10
print(ans)

Buggy submission (verdict: Runtime Error):
N = input()
n = len(list(n))
d_list = [9, 900, 90000]
if n >= 5:
  ans = 90909
elif n >= 4:
  ans = 909
elif n >= 3:
  ans = 9 + N % 1000
elif n >= 2:
  ans = 9
else:
  ans = N % 10
print(ans)
Problem p02981 (python)

Fixed submission:
N, A, B = map(int, input().split())
ans = min(N * A, B)
print(ans)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
l = L % 2019
r = R % 2019
ans = 10 ** 12
if l > r:
    ans = 0
else:
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            ans = min(ans, i * j % 2019)
print(ans)
Problem p02995 (python)

Fixed submission:
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A, B, C, D = map(int, input().split())
AC = (A - 1) // C
AD = (A - 1) // D
BC = B // C
BD = B // D
BCD = B // lcm(C, D)
ACD = (A - 1) // lcm(C, D)
tmp = (BC + BD) - (AC + AD) - (BCD - ACD)
ans = (B - A + 1) - tmp
print(ans)

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int, input().split())
AC = (A - 1) // C
AD = (A - 1) // D
BC = B // C
BD = B // D
BCD = B // lcm(C, D)
ACD = (A - 1) // lcm(C, D)
tmp = (BC + BD) - (AC + AD) - (BCD - ACD)
ans = (B - A + 1) - tmp
print(ans)
Problem p03005 (python)

Fixed submission:
N, K = map(int, input().split())
ans = N % K
print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
ans = N - K
ans += 1 if k == 1 else 0
print(ans)
Problem p03006 (python)

Fixed submission:
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
x, y = [], []
for i, j in xy:
    x += [i]
    y += [j]
ans = 0
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        p = x[j] - x[i]
        q = y[j] - y[i]
        c = 0
        for k in range(N):
            for l in range(N):
                if k == l:
                    continue
                if (x[k] - x[l]) == p and (y[k] - y[l]) == q:
                    c += 1
        ans = max(ans, c)
if N != 1:
    print(N-ans)
else:
    print('1')

Buggy submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
memo = {}
pq = []
for i in range(N-1):
    for j in range(i+1,N):
        pq.append([xy[j][0]-xy[i][0], xy[j][1]-xy[i][1]])
for p, q in pq:
    index = str(p) + str(q)
    if index in memo:
        memo[index] += 1
    else:
        memo[index] = 1
print(N-max(memo.values()))

Buggy submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
xy.sort()
deff_xy = []
memo = {}
for i in range(N-1):
    x = str(xy[i+1][0]-xy[i][0])
    y = str(xy[i+1][1]-xy[i][1])
    deff_xy = ('').join([x, y])
    if deff_xy in memo:
        memo[deff_xy] += 1
    else:
        memo[deff_xy] = 1
print(N-max(memo.values()))

Buggy submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
xy.sort()
deff_xy = []
memo = {}
for i in range(N-1):
    x = str(xy[i+1][0]-xy[i][0])
    y = str(xy[i+1][1]-xy[i][1])
    deff_xy = ('').join([x, y])
    if deff_xy in memo:
        memo[deff_xy] += 1
    else:
        memo[deff_xy] = 1
print(max(memo.values()))
Problem p03007 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
AM = A.pop(0)
xy = []
if AM > 0 and A[-1] >= 0:
    p = 1
elif AM <= 0 and A[-1] < 0:
    p = 2
else:
    p = 3
if p == 1:
    while(len(A)>1):
        x = A.pop(-1)
        y = A.pop(0)
        xy.append([x, y])
        A.append(x-y)
    xy.append([AM, A[0]])
    ans = AM - A[0]
if p == 2:
    while(len(A)>1):
        x = AM
        y = A.pop(-1)
        xy.append([x, y])
        AM -= y
    xy.append([AM, A[0]])
    ans = AM - A[0]
if p == 3:
    while(len(A)>1):
        y = A.pop(0)
        if y >= 0:
            x = A.pop(-1)
            xy.append([x, y])
            A.append(x-y)
        else:
            x = AM
            xy.append([x, y])
            AM -= y
    xy.append([AM, A[0]])
    ans = AM - A[0]
print(ans)
for out in xy:
    print(*out)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
AM = A.pop(0)
xy = []
if AM > 0 and A[-1] >= 0:
    p = 1
elif AM <= 0 and A[-1] < 0:
    p = 2
else:
    p = 3
if p == 1:
    while(len(A)>1):
        x = A.pop(-1)
        y = A.pop(0)
        xy.append([x, y])
        A.append(x-y)
    xy.append([AM, A[0]])
    ans = AM - A[0]
if p == 2:
    while(len(A)>1):
        x = AM
        y = A.pop(-1)
        xy.append([x, y])
        AM -= y
    xy.append([AM, A[0]])
    ans = AM - A[0]
if p == 3:
    while(len(A)>1):
        y = A.pop(0)
        if y >= 0:
            x = A.pop(-1)
            xy.append([x, y])
            xy.append([x, y])
            A.append(x-y)
        else:
            x = AM
            xy.append([x, y])
            AM -= y
            xy.append([AM, A[0]])
            ans = AM - A[0]
print(ans)
for out in xy:
    print(*out)
Problem p03061 (python)

Fixed submission:
import fractions


n = int(input())
a = list(map(int, input().split()))
nl = set(range(n))
l = [0]
r = [0]
m = []
for i in nl:
    l.append(fractions.gcd(l[i], a[i]))
    r.append(fractions.gcd(r[i], a[-i-1]))
r.reverse()
for i in nl:
    m.append(fractions.gcd(l[i], r[i+1]))
ans = max(m)
print(ans)

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


def gcd(*numbers):
    return functools.reduce(fraction.gcd, numbers)


n = int(input())
a = list(map(int, input().split()))
nl = set(range(n))
gcd_list = [0]
for i in nl:
    tmp = copy.deepcopy(a)
    tmp.pop(i)
    tmp2 = gcd(*tmp)
    gcd_list.append(tmp2)
ans = max(gcd_list)
print(ans)

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


def gcd(*numbers):
    return reduce(math.gcd, numbers)


n = int(input())
a = list(map(int, input().split()))
nl = set(range(n))
gcd_list = [0]
for i in nl:
    tmp = copy.deepcopy(a)
    tmp.pop(i)
    gcd_list.append(gcd(*tmp))
ans = max(gcd_list)
print(ans)

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


def gcd(*numbers):
    return reduce(math.gcd, numbers)


n = int(input())
a = list(map(int, input().split()))
nl = set(range(n))
gcd_list = []
for i in nl:
    tmp = copy.deepcopy(a)
    tmp.pop(i)
    gcd_list.append(gcd(*tmp))
ans = max(gcd_list)
print(ans)
Problem p03062 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
a_min = 0
minus_count = 0
for i in a:
    if i < 0:
        minus_count += 1
a = [abs(e) for e in a]
if minus_count % 2 != 0:
    a_min = a.pop(a.index(min(a)))
ans = sum(a) - a_min
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
dp = [[0] * (n + 1) for _ in [0, 1]]
dp[0][0] = 0
dp[1][0] = -1 * 10 ** 10
for i in range(n):
    for j in [0, 1]:
        dp[j][i + 1] = max(dp[0][i] + (-1)**j * a[i],
                           dp[1][i] + (-1)**(j + 1) * a[i])
print(dp[n][0])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
minus_count = 0
for i in a:
    if i < 0:
        minus_count += 1
a = [abs(e) for e in a]
if minus_count % 2 != 0:
    a_min = a.pop(a.index(min(a)))
ans = sum(a) - a_min
print(ans)
Problem p03074 (python)

Fixed submission:
import re


n, k = map(int, input().split())
s = input()
s_re = re.split(r'(0+)', s)
srl = len(s_re)
m = [0] * srl
if srl // 2 <= k:
    ans = n
else:
    for i, w in enumerate(s_re):
        m[i] = len(w)
    tmp = sum(m[:k * 2 + 1])
    ans = tmp
    for i in range(0, srl, 2):
        ie = i + k * 2 + 1
        if ie < srl:
            tmp = tmp - m[i] - m[i+1] + m[ie] + m[ie+1]
            ans = max(ans, tmp)
        else:
            break
print(ans)

Buggy submission (verdict: Runtime Error):
import re


n, k = map(int, input().split())
s = input()
s_re = re.split(r'(0+)', s)
srl = len(s_re)
m = [0] * srl
if (srl - 1 // 2) <= k:
    ans = n
else:
    for i, w in enumerate(s_re):
        m[i] = len(w)
    ans = [1]
    for i in range(0, srl, 2):
        ie = i + k * 2 + 1
        if ie <= srl:
            ans += [sum(m[i:ie])]
        else:
            break
print(max(ans))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
s_re = re.split(r'(0+)', s)
srl = len(s_re)
m = [0] * srl
if (srl - 1 // 2) <= k:
    ans = n
else:
    for i, w in enumerate(s_re):
        m[i] = len(w)
    ans = [1]
    for i in range(0, srl, 2):
        ie = i + k * 2 + 1
        if ie <= srl:
            ans += [sum(m[i:ie])]
        else:
            break
print(max(ans))