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

Fixed submission:
N,K = map(int,input().split())
x=list(map(int,input().split()))
flag=0

ans=10**11
for i in range(0,len(x)-K+1):
    if x[i]*x[K-1+i] <0:
        anss=abs(x[i])+ abs(x[K-1+i])
        anss += min(abs(x[i]),abs(x[K-1+i]))
    else:
        anss=max(abs(x[i]), abs(x[K-1+i]))
    ans=min( ans, anss)

print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
x=list(map(int,input().split()))
flag=0
for i in range(len(x)):
    if x[i]>=0:
        zp=i
        if 0 not in x:
            x.insert(i,0)
            flag=1
        break

for i in range(len(x)):
        x[i]=abs(x[i])

ans=10**11

if flag==1:
    for k in range(zp+K-len(x)+1,min(zp,K)+1):
        ans=min( ans, x[zp-k]+ x[zp+K-k]+ min(x[zp-k],x[zp+K-k]) )
else:
    for k in range(zp+K-len(x),min(zp,K)+1):
        ans=min( ans, x[zp-k]+ x[zp+K-k-1]+ min(x[zp-k],x[zp+K-k-1]) )

print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
x=list(map(int,input().split()))
for i in range(len(x)):
    if x[i]>=0:
        zp=i
        if 0 not in x:
            x.insert(i,0)
        break
for i in range(len(x)):
    if x[i]<=0:
        x[i]=abs(x[i])

ans=10**11
for k in range(zp+K-len(x)+1,min(zp,K)+1):
    ans=min( ans, x[zp-k]+ x[zp+K-k]+ min(x[zp-k],x[zp+K-k]) )

print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
x=list(map(int,input().split()))
for i in range(len(x)):
    if x[i]>=0:
        zp=i
        x.insert(i,0)
        break
for i in range(len(x)):
    if x[i]<=0:
        x[i]=abs(x[i])

ans=10**11
for k in range(zp+K-len(x)+1,min(zp,K)+1):
    ans=min( ans, x[zp-k]+ x[zp+K-k]+ min(x[zp-k],x[zp+K-k]) )

print(ans)
Problem p03597 (python)

Fixed submission:
N=int (raw_input())
A=int(raw_input())
print N*N-A

Buggy submission (verdict: Runtime Error):
 N=int(raw_input())
A=int(raw_input())
prom N*N-A
Problem p03262 (python)

Fixed submission:
#import math
import fractions

N,X=input().split()
N=int(N)
X=int(X)
x = [int(i) for i in input().split()]
x.append(X)
x.sort()
de=[]#deference 差
for i in range( 0, len(x)-1 ):
    dei=x[i+1]-x[i]
    if(dei>0):
        de.append(dei)

#最大公約数だった
#その数を作る素因数をすべて抜き出し、
#一致するものをすべて抜き出せばできる
gcddd=de[0]#最大公約数
for i in range(1,len(de)):
    gcddd=fractions.gcd(gcddd,de[i])
print(gcddd)

Buggy submission (verdict: Runtime Error):
import math

N,X=input().split()
N=int(N)
X=int(X)
x = [int(i) for i in input().split()]
x.append(X)
x.sort()
de=[]#deference 差
for i in range( 0, len(x)-1 ):
    dei=x[i+1]-x[i]
    if(dei>0):
        de.append(dei)

#最大公約数だった
#その数を作る素因数をすべて抜き出し、
#一致するものをすべて抜き出せばできる
gcd=de[0]#最大公約数
for i in range(1,len(de)):
    gcd=math.gcd(gcd,de[i])
print(gcd)

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

x = [int(i) for i in input().split()]
x.append(X)
x.sort()

de=[]#deference 差
for i in range( 0, len(x)-1 ):
    dei=x[i+1]-x[i]
    if(dei>0):
        de.append(dei)

#最大公約数だった
#その数を作る素因数をすべて抜き出し、
#一致するものをすべて抜き出せばできる
import math
gcd=de[0]#最大公約数
for i in range(1,len(de)):
    gcd=math.gcd(gcd,de[i])

print(gcd)
Problem p02772 (python)

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

for ni in range(rangeNum):
    if n[ni]%2 == 0:
        if n[ni]%3 == 0:
            continue
        elif n[ni]%5 == 0:
            continue
        else:
            print("DENIED")
            exit()
    else:
        continue
print("APPROVED")

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

ans = True
for ni in range(rangeNum+1):
    if n[ni] % 2 == 0:
        if n[ni] % 3 == 0:
            break
        elif n[ni] % 5 == 0:
            break
        else:
            ans = False
    else:
        ans = False
if ans==True:
    print("APPROVED")
else:
    print("DENIED")
Problem p02969 (python)

Fixed submission:
a = int(input())
print(3*a**2)

Buggy submission (verdict: Runtime Error):
a = int(input())
print(3a**2)
Problem p02993 (python)

Fixed submission:
s = input()
if s[0]==s[1] or s[1]==s[2] or s[2] == s[3]:
    print("Bad")
else:
    print("Good")

Buggy submission (verdict: Runtime Error):
s = input().split()
if s[0]==s[1] or s[1]==s[2] or s[2] == s[3]:
    print("Bad")
else:
    print("Good")
Problem p02804 (python)

Fixed submission:
n,k=map(int,input().split())
def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)
def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

mod=10**9+7
f=[1]
for i in range(n):f+=[f[-1]*(i+1)%mod]
def comb(a,b):
    return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod

a=list(map(int,input().split()))
a.sort()
b=a[::-1]
#print(a,b)
ans=0
for i in range(k-1,n):
    ans+=((a[i]-b[i])*(comb(i,k-1)))%(10**9+7)
print(ans%(10**9+7))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
mod=10**9+7
f=[1]
for i in range(n):
    f+=[f[-1]*(i+1)%mod]
print(f)
def combination(a,b):
    return f[a]*pow(f[b],mod-2,mod)*pow(f[a-b],mod-2,mod)%mod

a=list(map(int,input().split()))
a.sort()
b=a[::-1]
ans=0
for i in range(k-1,n):
    ans+=((a[i]-b[i])*(comb(i,k-1)))%(10**9+7)
print(ans%(10**9+7))
Problem p02814 (python)

Fixed submission:
import fractions
from functools import reduce
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
    a[i]=a[i]//2
def lcm_base(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base,numbers,1)
f2=lcm_list(a)

ans=0
for i in range(n):
    if f2//a[i]%2!=1:
        print(ans)
        break
else:
    ans=m//f2
    print((ans+1)//2)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
    a[i]=a[i]//2
def lcm_base(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base,numbers,1)
f2=lcm_list(a)

ans=0
for i in range(n):
    if f2/a[i]%2!=1:
        print(ans)
        break
else:
    ans=m//f2
    print((ans+1)//2)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce
n,m=map(int,input().split())
a=list(map(int,input().split()))
for i in range(n):
    a[i]=a[i]//2
def lcm_base(x,y):
    return (x*y)//fractions.gcd(x,y)
def lcm_list(numbers):
    return reduce(lcm_base,numbers,1)
f2=lcm_list(a)

ans=0
for i in range(n):
    if f2/a[i]%2!=1:
        print(ans)
        break
else:
    ans=m//f2
    print((ans+1)//2)

Buggy submission (verdict: Runtime Error):
import fractions
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=list(set(a))
n=len(a)
#print(a)
for i in range(n):
    a[i]=a[i]//2
f2=1
f=a[0]
for i in range(n):
    f=fractions.gcd(f,a[i])
for i in range(n):
    f2*=a[i]
f2=f2//(f*(n-1))
ans=0
for i in range(n):
    if f2/a[i]%2!=1:
        print(ans)
        break
else:
    ans=m//f2
    print((ans+1)//2)

Buggy submission (verdict: Runtime Error):
import fractions
n,m=map(int,input().split())
a=list(map(int,input().split()))
#print(a)
for i in range(n):
    a[i]=a[i]//2
f2=1
for i in range(n):
    f=fractions.gcd(f2,a[i])
    f2=a[i]*f2//f
#print(f2)
ans=0
for i in range(n):
    if f2/a[i]%2!=1:
        print(ans)
        break
else:
    ans=m//f2
    print((ans+1)//2)
Problem p02850 (python)

Fixed submission:
n = int(input())
l=[list(map(int,input().split()))+[i+1] for i in range(n-1)]
l.sort()
flg = [0 for _ in range(n+1)]
ans = [0 for _ in range(n)]
#print(l)
t=0
count=0
for i in range(n-1):
    a,b,c=l[i]
    if t!=a:
        t=a
        count=1
    if flg[a]==count:
        count+=1
    flg[b]=count
    ans[c]=count
    count+=1
    #print(flg,ans)
print(max(flg))
for i in range(1,n):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[list(map(int,input().split())) for i in range(n-1)]
l.sort()
#print(l)
r=[0]*n
for i in range(n-1):
    r[l[i][0]-1]+=1
    r[l[i][1]-1]+=1
aa=0
c=0

for i in range(n):
    if aa<=r[i]:
        aa=r[i]
        c=i+1

A=1;print(max(r))
p=[0]*(n-1)
w=[[] for _ in range(n)]
for i in range(n-1):
    if l[i][0]==c or l[i][1]==c:
        p[i]=A
        w[l[i][0]-1].append(A)
        w[l[i][1]-1].append(A)
        A+=1

box=set([i for i in range(1,max(r)+1)])
for i in range(n-1):
    if l[i][0]!=c and l[i][1]!=c:
        B=box-set(w[l[i][0]-1]+w[l[i][1]-1])
        #print(B)
        w[l[i][0]-1].append(list(B)[0])
        w[l[i][1]-1].append(list(B)[0])
        p[i]=list(B)[0]

#print(r,c,w)
#print(p)

for i in range(n-1):
    print(p[i])
Problem p02982 (python)

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

ans=0
for i in range(n):
    for k in range(i+1,n):
        t=0
        for j in range(d):
            t=t+(l[i][j]-l[k][j])**(2)
        t=t**(1/2)
        if t==int(t):
            ans=ans+1          
print(ans)

Buggy submission (verdict: Runtime Error):
n,d=map(int,input().split())
a=0
l=[]
for i in range(n):
    l.append(list(map(int,input().split())))
    for j in range(i+1,n):
     b=0
     for k in range(d):
        b+=(l[i][k]-l[j][k])**2
        c=b**(1/2)
        if c%1 == 0:
            a+=1
print(a)
Problem p02993 (python)

Fixed submission:
a=list(input())

ans=0
for i in range(int(len(a))-1):
    if a[i]==a[i+1]:
        ans+=1
    else:
        ans+=0

if ans==0:
    print('Good')
else:
    print('Bad')

Buggy submission (verdict: Runtime Error):
import fractions
a,b,c,d=map(int,input().split())

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
s=b//(c*d//fractions.gcd(c,d))-(a-1)//(c*d//fractions.gcd(c,d))


print((b-(a-1)-(cc+dd-s)))
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
s=b//(c*d//fractions.gcd(c,d))-(a-1)//(c*d//fractions.gcd(c,d))


print((b-(a-1)-(cc+dd-s)))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
s=b//(c*d/math.gcd(c,d))-(a-1)//(c*d/math.gcd(c,d))


print(int((b-(a-1)-(cc+dd-s))))
Problem p03007 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
l=[a[0]]
r=[a[-1]]
for i in range(1,n-1):
    if a[i]<=0:
        r.append(a[i])
    else:
        l.append(a[i])
r.sort()
l.sort()
if len(r)==1:
    X=r[0]
    p=[]
else:
    p=[[r[-1],r[-2]]]
    for i in range(len(r)-3,-1,-1):
        p.append([p[-1][0]-p[-1][1],r[i]])
    X=p[-1][0]-p[-1][1]
if len(l)==1:
    Y=l[0]
    q=[]
else:
    q=[[l[0],l[1]]]
    for i in range(2,len(l)):
        q.append([q[-1][0]-q[-1][1],l[i]])
    Y=q[-1][0]-q[-1][1]
print(X-Y)
if p and q:
    for i in range(len(p)):
        print(*p[i])
    for i in range(len(q)):
        print(*q[i])
    print(X,Y)
elif p:
    for i in range(len(p)):
        print(*p[i])
    print(X,Y)
elif q:
    for i in range(len(q)):
        print(*q[i])
    print(X,Y)
else:
    print(X,Y)

Buggy submission (verdict: Runtime Error):
import bisect
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=0
b1=bisect.bisect_left(a,0)
b2=bisect.bisect_right(a,0)
l=[]
#print(a,b1,b2)
if a[0]>0 or b1==1 or (b1==0 and b2>=1):
    l.append([a[0],a[1]])
    ans=l[0][0]-l[0][1]
    for i in range(1,n-1):
        if i!=n-2:
            l.append([l[-1][0]-l[-1][1],a[i]])
        else:
            l.append([a[-1],l[-1][0]-l[-1][1]])
        ans=l[i][0]-l[i][1]
    print(ans)
elif a[-1]<0 or n-b2==1 or (b2==n and b1<=n-1):
    l.append([a[-1],a[-2]])
    ans=l[0][0]-l[0][1]
    for i in range(n-2,0,-1):
        if i!=1:
            l.append([a[i],l[-1][0]-l[-1][1]])
        else:
            l.append([l[-1][0]-l[-1][1],a[0]])
        ans=l[i][0]-l[i][1]
    print(ans)
else:
    l.append([a[-1],a[1]])
    ans_1=l[0][0]-l[0][1]
    for i in range(b1,2,-1):
        l.append([a[i],l[-1][0]-l[-1][1]])
        ans_1=l[i][0]-l[i][1]
    l.append([a[0],a[-2]])
    ans_2=l[-1][0]-l[-1][1]
    for i in range(b1+1,n-1):
        l.append([l[-1][0]-l[-1][1],a[i]])
        ans_2=l[i][0]-l[i][1]
    l.append([ans_1,ans_2])
    ans=l[i][0]-l[i][1]
    print(ans)
for i in range(n-1):
    print(*l[i])
Problem p03069 (python)

Fixed submission:
n=int(input())
s=str(input())
a=0
b=s.count('.')
l=[b]
for i in range(n):
    if s[i]=='#':
        a+=1
    if s[i]=='.':
        b-=1
    l.append(a+b)
print(min(l))

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


a=s.find('#');b=s.rfind('.')

if a<b:
    c=s[a:b+1].count('#');d=s[a:b+1].count('.')
    ans=min(c,d)
else:
    ans=0

l=[]
for i in range(n):
    if s[i]=='.':
        l.append(i)

y=s[l[0]+1:].count('.')
for i in range(len(l)):
    x=s[:l[i]].count('#')
    ans=min(ans,x+y)
    y-=1
print(ans)
Problem p03074 (python)

Fixed submission:
n,k=map(int,input().split())
s=list(str(input()))
r=[]
l=[]
c=0
d=1
for i in range(n):
	if s[i]=='1' and d==1:
		r.append(i)
		c=1
		d=0
	elif s[i]=='0' and c==1:
		l.append(i-1)
		c=0
		d=1
if c>0:
	l.append(i)
if len(r)<=k+1:
	r=[0]*(k+1-len(r))+r+[n-1]*(k+1-len(r))
	l=[0]*(k+1-len(l))+l+[n-1]*(k+1-len(l))
r=[0]+r+[n-1]
l=[0]+l+[n-1]
ans=0
for i in range(len(r)-k):
	ans=max(ans,l[i+k]-r[i]+1)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(str(input()))
r=[]
l=[]
c=0
d=1
for i in range(n):
	if s[i]=='1' and d==1:
		r.append(i)
		c=1
		d=0
	elif s[i]=='0' and c==1:
		l.append(i-1)
		c=0
		d=1
if c>0:
	l.append(i)
if len(r)<=k+1:
	r=[0]*(k+1-len(r))+r+[n-1]*(k+1-len(r))
	l=[0]*(k+1-len(l))+l+[n-1]*(k+1-len(l))
ans=0
for i in range(k+1):
	ans=max(ans,l[i+k]-r[i]+1)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(str(input()))
l=[]
c=0
for i in range(n):
	if s[i]=='1' and c==0:
		l.append(i)
		c=1
	elif s[i]=='0':
		c=0
for i in range(n-1,-1,-1):
	if s[i]=='1':
		a=i
		break
else:
	a=n-1
l=[0]+l[1:-1]+[a]
#print(l)
m=len(l)
r=[]
for i in range(m-k):
	r.append(l[i+k]-l[i]+1)
print(max(r))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=list(str(input()))
l=[]
c=0
for i in range(n):
	if s[i]=='1' and c==0:
		l.append(i)
		c=1
	elif s[i]=='0':
		c=0
for i in range(n):
	if s[i]=='1':
		a=i
l=[0]+l[1:-1]+[a]
#print(l)
m=len(l)
r=[]
for i in range(m-k):
	r.append(l[i+k]-l[i]+1)
print(max(r))
Problem p03141 (python)

Fixed submission:
n=int(input())
l=[]
c=0
for i in range(n):
    a,b=map(int,input().split())
    c-=b
    l.append(a+b)
l.sort()
l=l[::-1]
for i in range(0,n,2):
    c+=l[i]
print(c)

Buggy submission (verdict: Runtime Error):
import heapq
import numpy as np 
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
    l[i][0],l[i][1]=-l[i][0],-l[i][1]
heapq.heapify(l)
ans=0
for i in range(n):
    ans-=l[0][0]*((-1)**i)
    minimum=heapq.heappop(l)
    for j in range(n-i-1):
        l[j][0],l[j][1]=l[j][1],l[j][0]
    #print(l)
print(ans)
Problem p03164 (python)

Fixed submission:
n,w=map(int,input().split())
l=[list(map(int, input().split())) for i in range(n)]
c=0
d=0
for i in range(n):
    c+=l[i][1];d+=l[i][0]
dp=[[0]*(c+1) for _ in range(n)]
for i in range(1,l[0][1]+1):
    dp[0][i]=l[0][0]
for i in range(l[0][1]+1,c+1):
    dp[0][i]=d
for i in range(1,n):
    for j in range(1,c+1):
        if j<=l[i][1]:
            dp[i][j]=min(dp[i-1][j],l[i][0])
        else:
            dp[i][j]=min(dp[i-1][j],dp[i-1][j-l[i][1]]+l[i][0])
#print(dp)
for i in range(c,0,-1):
    if dp[-1][i]<=w:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
import sys
def input():
    return sys.stdin.readline()[:-1]
n,w=map(int,input().split())
dp=[[0]*(w+1) for _ in range(n)]
l=[0]*n
for i in range(n):
    l[i]=list(map(int,input().split()))
#print(l)
for i in range(w+1):
    if i>=l[0][0]:
        dp[0][i]=l[0][1]
for i in range(w+1):
    for j in range(n-1):
        if i<l[j+1][0]:
            dp[j+1][i]=dp[j][i]
        else:
            dp[j+1][i]=max(dp[j][i-l[j+1][0]]+l[j+1][1],dp[j][i])


print(dp[-1][-1])
Problem p03231 (python)

Fixed submission:
import fractions
n,m=map(int,input().split())
s=str(input())
t=str(input())
f=fractions.gcd(n,m)
f2=n*m//f
#print(f2)
for i in range(f2,n*m+1,f2):
    z2=(i//n)*(i//m)//fractions.gcd(i//n,i//m)
    for j in range(1,i+1,z2):
        #print(i,j)
        if s[-(-j//(i//n))-1]!=t[-(-j//(i//m))-1]:
            break
    else:
        print(i)
        break
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import fractions
n,m=map(int,input().split())
s=str(input())
t=str(input())
f=fractions.gcd(n,m)
f2=n*m//f
#print(f2)
for i in range(f2,n*m+1,f2):
    z2=(i//n)*(i//m)//fractions.gcd(i//n,i//m)
    #print(i,z2)
    for j in range(1,i+1,z2):
        if s[j//(i//n)]!=t[j//(i//m)]:
            break
    else:
        print(i)
        break
else:
    print(-1)
Problem p03240 (python)

Fixed submission:
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
for i in range(101):
    for j in range(101):
        H=[]
        for k in range(n):
            if l[k][2]>0:
                H.append(l[k][2]+abs(l[k][0]-i)+abs(l[k][1]-j))
            else:
                continue
        if len(set(H))==1:
            for k in range(n):
                if l[k][2]==0:
                    if H[0]-abs(l[k][0]-i)-abs(l[k][1]-j)>0:
                        break
            else:
                print(i,j,H[0])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[[0,0,0] for _ in range(n)]
for i in range(n):
    l[i][0],l[i][1],l[i][2]=map(int,input().split())
p=[]
for i in range(n):
    for cx in range(101):
        for cy in range(101):
            if l[i][2]>0:
                H=l[i][2]+abs(l[i][0]-cx)+abs(l[i][1]-cy)
                p.append([cx,cy,H])

p.sort()
ans=0
for i in range(101*101*n-1):
    if p[i]==p[i+1]:
        ans+=1
        if ans==n-1:
            print(' '.join(map(str,p[i])))
            break
    else:
        ans=0
Problem p03244 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
import collections

if len(set(v))==1:
    print(n//2)
else:
    a=[]
    b=[]
    for i in range(n):
        if i%2==0:
            a.append(v[i])
        else:
            b.append(v[i])
    a=collections.Counter(a)
    a0=a.most_common()[0]
    b=collections.Counter(b)
    b0=b.most_common()[0]
    if a0[0]!=b0[0]:
        print(n-a0[1]-b0[1])
    elif a0[0]==b0[0]:
        if a0[1]>b0[1]:
            print(n-a0[1]-b.most_common()[1][1])
        elif a0[1]<b0[1]:
            print(n-b0[1]-a.most_common()[1][1])
        elif a0==b0:
            if b.most_common()[1][1]>=a.most_common()[1][1]:
                print(n-a0[1]-b.most_common()[1][1])
            elif b.most_common()[1][1]<=a.most_common()[1][1]:
                print(n-b0[1]-a.most_common()[1][1])

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


A=[0]*(10**1)
B=[0]*(10**1)


for i in range(n):
    if i%2==0:
        A[v[i]-1]+=1
    else:
        B[v[i]-1]+=1
x=n//2-max(A)
y=n//2-max(B)
AA=''.join(map(str,A))
BB=''.join(map(str,B))
a=AA.find(str(max(A)))
b=BB.rfind(str(max(B)))
if a!=b:
    print(x+y)
Problem p03611 (python)

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

l=[0]*(max(a)+1)
for i in range(n):
    l[a[i]]+=1
#print(l)
ans=0
for i in range(len(l)-2):
    ans=max(ans,l[i]+l[i+1]+l[i+2])
if len(l)==1:
    print(l[0])
elif len(l)==2:
    print(sum(l))
else:
    ans=max(ans,l[0]+l[1],l[-1]+l[-2])
    print(ans)

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

l=[0]*(max(a)+1)
for i in range(n):
    l[a[i]-1]+=1
#print(l)
ans=0
for i in range(len(l)-2):
    ans=max(ans,l[i]+l[i+1]+l[i+2])
ans=max(ans,l[0]+l[1],l[-1]+l[-2])
print(ans)
Problem p03035 (python)

Fixed submission:
a,b = map(int,input().split())
if 0<=a<6:
  b=0
elif 6<=a<13:
  b=b//2
else:
  b=b
print(b)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
a=int(a)
b=int(b)
if 0<=a<6:
  b=0
elif 6<=a<13:
  b=b//2
else:
  b=b
print(b)

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
a=int(a)
if 0<=a<6:
  b=0
elif 6<=a<13:
  b=b/2
else:
  b=b
b=int(b)
print(b)
Problem p02772 (python)

Fixed submission:
A=input().split()
x = input().split()
target ="APPROVED"
for i in x:
  if int(i)%2 == 0:
    if int(i)%3 > 0 and int(i)%5 > 0:
      target = "DENIED"
      break
print(target)

Buggy submission (verdict: Runtime Error):
A=input().split()
#array = [int(input()) for i in range(int(A))]
x = []
print(x[1])
print(A)
target ="DENIED"
for i in x:
  if x.index[i]%2 == 0:
    if x.index[i]%3 == 0 or x.index[i]%5 == 0:
      target = "APPROVED"
      break
print(target)
Problem p02830 (python)

Fixed submission:
N=int(input())
S=input()
print(''.join([S[i]+S[i+N+1] for i in range(N)]))

Buggy submission (verdict: Runtime Error):
input()
print(''.join([s+t for s,t in zip(input(),input())]))
Problem p02993 (python)

Fixed submission:
print("Bad" if [ x[0]==x[1] or x[1]==x[2] or x[2]==x[3] for x in [str(input())] ] == [1] else "Good")

Buggy submission (verdict: Runtime Error):
print("bad" if [ str(x)[0]==str(x)[1] or str(x)[1]==str(x)[2] or str(x)[2]==str(x)[3] for x in [int(input())] ] == [1] else "good")
Problem p03001 (python)

Fixed submission:
import numpy as np
W,H,x,y = map(float, input().split())
print("{0} {1}".format(W*H/2, 1 if (x+x==W)and(y+y==H) else 0) )

Buggy submission (verdict: Runtime Error):
import numpy as np
W,H,x,y = map(float, input().split())
print("{0} {1}".format(W*H/2, 1 (x+x==W)and(y+y==H) else 0) )

Buggy submission (verdict: Runtime Error):
import numpy as np
W,H,x,y = map(float, input().split())
print("{0} {1}".format(W*H/2, 1 (x+x=W)and(y+y=H) else 0) )
Problem p03103 (python)

Fixed submission:
N,M=map(int,input().split())
AB=[[int(x) for x in input().split()] for i in range(N)]
AB.sort(key=lambda x: x[0])
out = 0
count = M
for i in range(N):
    if AB[i][1]<count+1:
        count-=AB[i][1]
        out+=AB[i][0]*AB[i][1]
    else:
        out+=count*AB[i][0]
        break
print(out)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
AB=[[int(x) for x in input().split()] for i in range(N)]
AB.sort(key=lambda x: x[0])
out = 0
count = M
for i in range(M):
    if AB[i][1]<count+1:
        count-=AB[i][1]
        out+=AB[i][0]*AB[i][1]
    else:
        out+=count*AB[i][0]
        break
print(out)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
AB=[[int(x) for x in input().split()] for i in range(N)]
AB.sort(key=lambda x: x[0])
out = 0
count = M
for i in range(M):
    if AB[i][1]<count+1:
        count-=AB[i][1]
        out+=AB[i][0]*AB[i][1]
    else:
        out+=count*AB[i][0]
        break
print(out)
Problem p03161 (python)

Fixed submission:
N,K=map(int,input().split())
dp=[1000000000000000 for i in range(N)]
h=[int(x) for x in input().split()]
dp[0]=0
for i in range(N):
    for j in range(i,i+K+1 if i+K+1 < N else N):
        dp[j] = dp[j] if dp[j]<dp[i]+abs(h[j]-h[i]) else dp[i]+abs(h[j]-h[i])
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
dp=[1000000000000000]*N
h=[int(x) for x in input().split()]
dp[0]=0
for i in range(N):
    dp=dp[:i] + ([x if x<dp[i]+abs(h[i+j]-h[i]) else dp[i]+abs(h[i+j]-h[i]) for j,x in enumerate(dp[i:(i+K+1 if i+K+1<N else N)])]) + (dp[i+K+1:] if i+K+1<N else [])
#    for j in range(i,i+K+1 if i+K+1 < N else N):
#        dp[j] = dp[j] if dp[j]<dp[i]+abs(h[j]-h[i]) else dp[i]+abs(h[j]-h[i])
    print(dp)