Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

l=list(input().split() for _ in range(m))

w=[0]*n
a=[0]*n
seitou=0
pena=0

for i in l:
    k=int(i[0])-1
    if a[k]==0:
        if i[1]=="AC":
            a[k]+=1
        else:
            w[k]+=1

seitou=sum(a)
for j in range(n):
    if a[i]==1:
        pena+=w[i]
        
print(seitou,pena)

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

l=list(input().split() for _ in range(m))

w=[0]*n
a=[0]*n
seitou=0
pena=0

for i in l:
    k=int(i[0])-1
    if a[k]==0:
        if i[1]=="AC":
            a[k]+=1
        else:
            w[k]+=1

seitou=sum(a)
for j in range(n):
    if int(a[j])==1:
        pena+=w[j]
        
print(seitou,pena)
Buggy python submission (verdict: Runtime Error):
import itertools
import math
import numpy as np

n=int(input())
l=[]
for i in range(n):
    array=list(map(int,input().split()))
    l.append(array)

ll=[]
for v in itertools.permutations(range(n)):
    ll.append(list(v))
a=0
for j in ll:
    for k in range(len(j)-1):
        x=j[k]
        y=j[k+1]
        dis=math.sqrt((l[x][0]-l[y][0])**2+(l[x][1]-l[y][1])**2)
        a+=dis

print(a/len(ll))

Fixed submission:
import itertools
import math
import numpy as np

n=int(input())
l=[]
for i in range(n):
    array=list(map(int,input().split()))
    l.append(array)

ll=[]
for v in itertools.permutations(range(n)):
    ll.append(list(v))
a=0
for j in ll:
    for k in range(len(j)-1):
        x=j[k]
        y=j[k+1]
        dis=math.sqrt((l[x][0]-l[y][0])**2+(l[x][1]-l[y][1])**2)
        a+=dis

print(a/len(ll))

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

n=int(input())
l=[]
for i in range(n):
    array=list(map(int,input().split()))
    l.append(array)

ll=[]
for v in itertools.permutations(range(n)):
    ll.append(list(v))
a=0
for j in ll:
    for k in range(len(j)-1):
        x=j[k]
        y=j[k+1]
        dis=math.sqrt((l[x][0]-l[y][0])**2+(l[x][1]-l[y][1])**2)
        a+=dis

print(a/len(ll))

Fixed submission:
import itertools
import math
import numpy as np

n=int(input())
l=[]
for i in range(n):
    array=list(map(int,input().split()))
    l.append(array)

ll=[]
for v in itertools.permutations(range(n)):
    ll.append(list(v))
a=0
for j in ll:
    for k in range(len(j)-1):
        x=j[k]
        y=j[k+1]
        dis=math.sqrt((l[x][0]-l[y][0])**2+(l[x][1]-l[y][1])**2)
        a+=dis

print(a/len(ll))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline

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

ans=[]

for i in range(n):
    ans.append(a.index(i+1)+1)
print(*ans)

Fixed submission:
n=int(input())
l=list(map(int,input().split()))
ll=[]
for i in range(n):
    ll.append([l[i],i+1])
    
ll=sorted(ll)
ans=[]
for j in range(n):
    ans.append(ll[j][1])

print(*ans)

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

ans=[]

for i in range(n):
    ans.append(a.index(i+1)+1)
print(*ans)




Fixed submission:
n=int(input())
l=list(map(int,input().split()))
ll=[]
for i in range(n):
    ll.append([l[i],i+1])
    
ll=sorted(ll)
ans=[]
for j in range(n):
    ans.append(ll[j][1])

print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input=sys.stdin.readline

n,k,q=map(int,input().split())

a=[]

for i in range(q):
    a.append(int(input()))
    
b=[k]*n

def calc(n):
    return n-1

for j in a:
    b=list(map(calc,b))
    b[j-1]+=1

for k in b:
    if k<=0:
        print("No")
    else:
        print("Yes")
        


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

n,k,q=map(int,input().split())

a=[]

for i in range(q):
    a.append(int(input()))
    
b=[k]*n
c=[-q]*n

for j in a:
    c[j-1]+=1

for l in range(n):
    if b[l]+c[l]<=0:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
a=list(map(int,input().split()))

ans=1
c=a[:]
if a[1]==1:
    print(0)
    exit()
while c[0]<a[1]:
    c-=1
    c+=a[0]
    ans+=1
print(ans)

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

ans=1
c=a
if b==1:
    print(0)
    exit()
while c<b:
    c-=1
    c+=a
    ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
ans=0
for i in range(1,n):
    ans+=i
print(ans)

Fixed submission:
n=int(input())
print(int((n-1)*n)//2)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))

m=max(a)
b=a[:]
b.remove(m)
m2=max(b)

for j in a:
    if j==m and a.count(m)>1:
        print(m)
    elif j==m and a.count(m)==1:
        print(m2)
    else:
        print(m)

Fixed submission:
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
m=sorted(l)
m1=m[-1]
m2=m[-2]
c=l.count(m1)

for j in l:
    if j==m1:
        if c>1:
            print(m1)
        else:
            print(m2)
    else:
        print(m1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
ll=l[:]
for j in range(len(l)):
    l=ll[:]
    l.pop(j)
    print(max(l))


Fixed submission:
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
m=sorted(l)
m1=m[-1]
m2=m[-2]
c=l.count(m1)

for j in l:
    if j==m1:
        if c>1:
            print(m1)
        else:
            print(m2)
    else:
        print(m1)
Buggy python submission (verdict: Runtime Error):
import numpy as np

a=int(input())
b=list(map(int,input().split()))
b=2*np.array(b)
c=[[0 for s in range(a)] for _ in range(a)]
aa=0
for i in c:
    if aa==a-1:
        i[0]=1
        i[aa]=1
    else:
        i[aa+1]=1
        i[aa]=1
    aa+=1
c=np.array(c)

x=np.linalg.solve(c,b)
x=list(x)
for j in range(len(x)):
    x[j]=int(x[j])
print(" ".join(repr(e) for e in x))


Fixed submission:
a=int(input())
b=list(map(int,input().split()))
c=sum(b[::2])-sum(b[1::2])
d=[c]
for i in b:
    d.append(2*i-c)
    c=2*i-c

d.pop()
print(*d)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

a=int(input())
b=list(map(int,input().split()))
b=2*np.array(b)
c=[[0 for s in range(a)] for _ in range(a)]
aa=0
for i in c:
    if aa==a-1:
        i[0]=1
        i[aa]=1
    else:
        i[aa+1]=1
        i[aa]=1
    aa+=1
c=np.array(c)

x=np.linalg.solve(c,b)
x=list(x)
for j in range(len(x)):
    x[j]=int(x[j])
print(" ".join(repr(e) for e in x))


Fixed submission:
a=int(input())
b=list(map(int,input().split()))
c=sum(b[::2])-sum(b[1::2])
d=[c]
for i in b:
    d.append(2*i-c)
    c=2*i-c

d.pop()
print(*d)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

a=int(input())
b=list(map(int,input().split()))
b=np.array(b)

c=[[0 for s in range(a)] for _ in range(a)]
aa=0
for i in c:
    if aa==a-1:
        i[0]=1/2
        i[aa]=1/2
    else:
        i[aa+1]=1/2
        i[aa]=1/2
    aa+=1
c=np.array(c)

x=np.linalg.solve(c,b)
x=list(x)
for j in range(len(x)):
    x[j]=int(x[j])
print(" ".join(repr(e) for e in x))


Fixed submission:
a=int(input())
b=list(map(int,input().split()))
c=sum(b[::2])-sum(b[1::2])
d=[c]
for i in b:
    d.append(2*i-c)
    c=2*i-c

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

e=math.floor(b/c)
f=math.ceil(a/c)

ans=e-f+1

g=math.floor(b/d)
h=math.ceil(a/d)

ans=ans+g-h+1

i=(c*d)//math.gcd(c,d)

j=math.floor(b/i)
k=math.ceil(a/i)

ans=ans-(j-k+1)

print(b-a+1-ans)

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

e=b//c
f=-(-a//c)

ans=e-f+1

g=b//d
h=-(-a//d)

ans=ans+g-h+1

i=(c*d)//fractions.gcd(c,d)

j=b//i
k=-(-a//i)

ans=ans-(j-k+1)

print(b-a+1-ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n,m=map(int,input().split())
c=[]
for i in range(m):
    c.append(int(input()))

d=[0]*(n+1)
d[0]=1
d[1]=1 if 1 not in c else 0
for j in range(2,n+1):
    if j in c:
        pass
    else:
        d[j]=(d[j-1]+d[j-2])%1000000007

print(d[n])

Fixed submission:
import sys

n,m=map(int,input().split())
c=set(map(int,sys.stdin))

d=[0]*(n+1)
d[0]=1
d[1]=1 if 1 not in c else 0
for j in range(2,n+1):
    if j in c:
        pass
    else:
        d[j]=(d[j-1]+d[j-2])%1000000007

print(d[n])

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

a,b=map(int,input().split())
c=[]
for i in range(b):
    c.append(int(input()))
c.append(a+1)    
def Fib(n):
    fib=1/np.sqrt(5)*(((1+np.sqrt(5))/2)**(n)-((1-np.sqrt(5))/2)**(n))
    return(int(fib))

d=[]
z=-1
for j in c:
    di=j-z-1
    if j-z==1:
        print(0)
        exit()
    else:
        d.append(Fib(di))
        z=j
ans=1
for k in d:
    ans=ans*k
print(ans%1000000007)

Fixed submission:
import sys

n,m=map(int,input().split())
c=set(map(int,sys.stdin))

d=[0]*(n+1)
d[0]=1
d[1]=1 if 1 not in c else 0
for j in range(2,n+1):
    if j in c:
        pass
    else:
        d[j]=(d[j-1]+d[j-2])%1000000007

print(d[n])

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

a,b=map(int,input().split())
c=[]
for i in range(b):
    c.append(int(input()))
c.append(a+1)    
def Fib(n):
    fib=1/np.sqrt(5)*(((1+np.sqrt(5))/2)**(n-1)-((1-np.sqrt(5))/2)**(n-1))
    return(int(fib))

d=[]
z=-1
for j in c:
    di=j-z
    if j-z==1:
        print(0)
        exit()
    else:
        d.append(Fib(di))
        z=j
ans=1
for k in d:
    ans=ans*k
print(ans%1000000007)



Fixed submission:
import sys

n,m=map(int,input().split())
c=set(map(int,sys.stdin))

d=[0]*(n+1)
d[0]=1
d[1]=1 if 1 not in c else 0
for j in range(2,n+1):
    if j in c:
        pass
    else:
        d[j]=(d[j-1]+d[j-2])%1000000007

print(d[n])

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

a,b=map(int,input().split())
c=[]
for i in range(b):
    c.append(int(input()))
c.append(a+1)    
def Fib(n):
    fib=1/np.sqrt(5)*(((1+np.sqrt(5))/2)**(n-1)-((1-np.sqrt(5))/2)**(n-1))
    return(int(fib))

d=[]
z=-1
for j in c:
    d.append(Fib(j-z))
    z=j
ans=1
for k in d:
    ans=ans*k
print(ans%1000000007)

Fixed submission:
import sys

n,m=map(int,input().split())
c=set(map(int,sys.stdin))

d=[0]*(n+1)
d[0]=1
d[1]=1 if 1 not in c else 0
for j in range(2,n+1):
    if j in c:
        pass
    else:
        d[j]=(d[j-1]+d[j-2])%1000000007

print(d[n])
Buggy python submission (verdict: Time Limit Exceeded):
import sys,copy

n=int(input())
l=[]
for i in range(5):
    l.append(int(input()))
m=[n]
for i in range(5):
    m.append(0)
mm=[0]*6
t=0


while m[5]!=n:
    for j in range(5):
        if m[j]>0:
            mm[j+1]=min(m[j],l[j])
            m[j]-=min(m[j],l[j])
    for k in range(6):
        m[k]+=mm[k]
        mm[k]=0
    t+=1
print(t)

Fixed submission:
import math

n=int(input())
l=[]
for i in range(5):
    l.append(int(input()))
    
m=math.ceil(n/min(l))

print(m-1+5)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

n,q=map(int,input().split())
s=input()
l = [stdin.readline().rstrip().split() for _ in range(q)]

t=[0]*(n)
for i in range(n):
    t[i]=(1 if s[i:i+2]=="AC" else 0)

for j,k in l:
    ans=0
    for x in range(int(j)-1,int(k)-1):
        ans+=t[x]
    print(ans)

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin

n,q=map(int,input().split())
s=list(input())
l = [stdin.readline().rstrip().split() for _ in range(q)]

for i,j in l:
    ans=0
    for k in range(int(i)-1,int(j)-1):
        if s[k]=="A" and s[k+1]=="C":
            ans+=1
    print(ans)

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q=map(int,input().split())
s=list(input())
l=[]
for _ in range(q):
    l.append(map(int,input().split()))

for i,j in l:
    ans=0
    for k in range(i-1,j-1):
        if s[k]=="A" and s[k+1]=="C":
            ans+=1
    print(ans)

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

Buggy python submission (verdict: Runtime Error):
n,q=map(int,input().split())
s=list(input())
l=[]
for _ in range(q):
    [a,b]=map(int,input().split())
    l.append([a,b])

for i,j in l:
    ans=0
    tmp=0
    for k in range(i-1,j):
        if s[k]=="A" and s[k+1]=="C" and k!=j-1:
            ans+=1
    print(ans)

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
Buggy python submission (verdict: Runtime Error):
s=int(input())
l=[]
def func(a):
    if a%2==0:
        return a/2
    else:
        return 3*a+1

while (s not in l):
    l.append(s)
    s=func(s)

print(len(l)+1)

Fixed submission:
s=list(input())
a=s.count("0")
b=s.count("1")

print(2*min(a,b))
Buggy python submission (verdict: Runtime Error):
import sys

n,A,B,C=map(int,input().split())
x=list(set(map(int,sys.stdin)))

inf=10**9

def dfs(cur,a,b,c):
    if cur==n:
        #print("abs",abs(a-A),abs(b-B),abs(c-C))
        #print("abs...",abs(a-A)+abs(b-B)+abs(c-C)-30)
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else inf
    ret0 = dfs(cur+1,a,b,c)
    ret1 = dfs(cur+1,a+x[cur],b,c) + 10
    ret2 = dfs(cur+1,a,b+x[cur],c) + 10
    ret3 = dfs(cur+1,a,b,c+x[cur]) + 10
    #print(ret0,ret1,ret2,ret3)
    return min(ret0, ret1, ret2, ret3)

print(dfs(0,0,0,0))

Fixed submission:
import sys

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

x=[int(input()) for _ in range(n)]
inf=10**9

def dfs(cur,a,b,c):
    if cur==n:
        #print("abs",abs(a-A),abs(b-B),abs(c-C))
        #print("abs...",abs(a-A)+abs(b-B)+abs(c-C)-30)
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c)>0 else inf
    ret0 = dfs(cur+1,a,b,c)
    ret1 = dfs(cur+1,a+x[cur],b,c) + 10
    ret2 = dfs(cur+1,a,b+x[cur],c) + 10
    ret3 = dfs(cur+1,a,b,c+x[cur]) + 10
    #print(ret0,ret1,ret2,ret3)
    return min(ret0, ret1, ret2, ret3)

print(dfs(0,0,0,0))
Buggy python submission (verdict: Runtime Error):
n=int(input())

a=[0]*n
aa=0
for i in range(n):
    b=set(list(str(i)))
    if len(b)==3:
        if "3" in b and "5" in b and "7" in b:
            aa+=1
    a[i]+=aa

print(a[n-1])

Fixed submission:
from itertools import product
n = int(input())
cnt = 0
for i in range(3,10):
    for m in product(["3","5","7"],repeat = i):
        if "3" in m and "5" in m and "7" in m and int("".join(m))<=n:
            cnt += 1
print(cnt)

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

a=[0]*n
aa=0
for i in range(n):
    b=set(list(str(i)))
    if len(b)==3:
        if b.count("7")>0 and b.count("5")>0 and b.count("3")>0:
            aa+=1
    a[i]+=aa


print(a[n-1])

Fixed submission:
from itertools import product
n = int(input())
cnt = 0
for i in range(3,10):
    for m in product(["3","5","7"],repeat = i):
        if "3" in m and "5" in m and "7" in m and int("".join(m))<=n:
            cnt += 1
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
a,b = list(map(int,input().split()))

input_lines = [list(map(int,input().split())) for i in range(b)]
input_lines = sorted(input_lines,key=lambda x: x[1]) #各要素において[1]に基づきソートする

c=[0]
for i in input_lines:
    p=0
    for j in c:
        if j > i[0]:
            p=1
    if p==0:
        c.append(i[1])
        
print(len(c)-1)




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

input_lines = [list(map(int,input().split())) for i in range(b)]
input_lines = sorted(input_lines,key=lambda x: x[1]) #各要素において[1]に基づきソートする

c=[0]
for i in input_lines:
    #for j in c:
    #   if j > i[0]:
    #        p=1
    if max(c)<=i[0]:
        c.append(i[1])
        
print(len(c)-1)
Buggy python submission (verdict: Runtime Error):
n=input()
a=0
for i in n:
    a+=int(i)

if n%a==0:
    print("Yes")
else:
    print("No")
   

Fixed submission:
n=input()
a=0
for i in n:
    a+=int(i)

if int(n)%a==0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a,b=input().split()
test = lambda x:int(x)
a=test(a)
b=test(b)

w=[int(input()) for i in range(a)]
w.sort()
sum=0
num=len(w)
for i in w:
    sum=sum+i
while b-sum>=w[0]:
    sum=sum+w[0]
    num=num+1
    
print(num)

Fixed submission:
print(700+100*(input().count('o')))
Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
ans=0
f=b//10000
for i in range(f+1):
    for j in range(a-i+1):
        if 10000*i+5000*j+1000*(a-i-j)==b and ans==0:
            z=a-i-j
            print(i,j,z)
            ans+=1
if ans==0:
    print(f'-1 -1 -1')

Fixed submission:
a,b=map(int, input().split())
ans=0
for i in range(a+1):
    for j in range(a-i+1):
        z=a-i-j
        if 10000*i+5000*j+1000*z==b and ans==0:
            print(i,j,z)
            ans+=1
if ans==0:
    print(-1,-1,-1)

Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
ans=0
for i in range(a+1):
    for j in range(a-i+1):
        if 10000*i+5000*j+1000*(a-i-j)==b and ans==0:
            print(f'{i} {j} {(a-i-j)}')
            ans+=1
if ans==0:
    print(f'-1 -1 -1')

Fixed submission:
a,b=map(int, input().split())
ans=0
for i in range(a+1):
    for j in range(a-i+1):
        z=a-i-j
        if 10000*i+5000*j+1000*z==b and ans==0:
            print(i,j,z)
            ans+=1
if ans==0:
    print(-1,-1,-1)

Buggy python submission (verdict: Runtime Error):
a,b=map(int, input().split())
ans=0
for i in range(a+1):
    for j in range(a-i+1):
        if 10000*i+5000*j+1000*(a-i-j)==b and ans==0:
            print(f'{i} {j} {(a-i-j)}')
            ans+=1
if ans==0:
    print(f'-1 -1 -1')

Fixed submission:
a,b=map(int, input().split())
ans=0
for i in range(a+1):
    for j in range(a-i+1):
        z=a-i-j
        if 10000*i+5000*j+1000*z==b and ans==0:
            print(i,j,z)
            ans+=1
if ans==0:
    print(-1,-1,-1)
Buggy python submission (verdict: Runtime Error):
import bisect
import sys
input=sys.stdin.readline

n=int(input())
a=[]
for i in range(3):
   a.append(list(map(int,input().split())))

for j in range(3):
    a[j].sort()

q=[0]*n
b=0

for k in range(n):
    b+=n-bisect.bisect_right(a[2],a[1][-k-1])
    q[-k-1]=b

ans=0
max1=max(a[1])

for l in a[0]:
    if l<=max1:
        ans+=q[bisect.bisect_right(a[1],l)]
print(ans)

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

n=int(input())
a=[]
for i in range(3):
   a.append(list(map(int,input().split())))

for j in range(3):
    a[j].sort()
ans=0
for l in a[1]:
    aa=bisect.bisect_left(a[0],l)
    bb=(n-bisect.bisect_right(a[2],l))
    ans+=aa*bb
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K,S=input().split()
K=int(K)
S=int(S)
ans=0
for l in range(K+1):
    for m in range(K+1):
        for n in range(K+1):
            if l+m+n==S:
                ans=ans+1
print(ans)

Fixed submission:
K,S=input().split()
K=int(K)
S=int(S)
ans=0
for l in range(K+1):
    for m in range(K+1):
        if l+m<=S and l+m+K>=S:
            ans=ans+1
print(ans)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
cost=999999
for i in range(-100,1,101):
    c=0
    for j in b:
        c=c+(i-j)**2
    if c<cost:
        cost=c
print(cost)

Fixed submission:
a=int(input())
ans=0
for i in range(a+1):
  ans+=i
print(ans)

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=list(map(int,input().split()))
cost=999999
for i in range(-100,101):
    c=0
    for j in b:
        c=c+(i-j)**2
    if c<cost:
        cost=c
print(cost)

Fixed submission:
a=int(input())
ans=0
for i in range(a+1):
  ans+=i
print(ans)
Buggy python submission (verdict: Runtime Error):
yha

Fixed submission:
x = int(input())
if (x >= 30):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
aaa

Fixed submission:
x = int(input())
if (x >= 30):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
aaa

Fixed submission:
x = int(input())
if (x >= 30):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
aaa

Fixed submission:
x = int(input())
if (x >= 30):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
aaa

Fixed submission:
x = int(input())
if (x >= 30):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
aaaa

Fixed submission:
x = int(input())
if (x >= 30):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
x, y  = map(int, input().split)
print(x * y)

Fixed submission:
x, y  = map(int, input().split())
print(x * y)
Buggy python submission (verdict: Runtime Error):
temp=int(input())
if temp >= 30 :
    answer = Yes
else:
    answer = No
print(answer)

Fixed submission:
temp=int(input())
if temp >= 30 :
    answer = "Yes"
else:
    answer = "No"
print(answer)
Buggy python submission (verdict: Runtime Error):
import sys

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

for a in A:
	if a == 0:
		print("0")
		sys.exit()

num = 1
for a in A:
	num *= a
	if num > 1000000000000000000:
		print(-1)
		sys.exit()

print(num)
		

Fixed submission:
import heapq
from collections import deque
from enum import Enum
import sys
import math
from _heapq import heappush, heappop
import copy
from test.support import _MemoryWatchdog

BIG_NUM = 2000000000
HUGE_NUM = 99999999999999999
MOD = 1000000007
EPS = 0.000000001
sys.setrecursionlimit(100000)


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


for a in A:
    if a == 0:
        print("0")
        sys.exit()

num = 1
for a in A:
    num *= a
    if num > 1000000000000000000:
        print(-1)
        sys.exit()

print(num)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

def gcd_(a, b):
    if a < b:
        a, b = b, a
    while not a % b == 0:
        a, b = b, a % b
    return b

def gcd(a, b, c):
    length = len({a, b, c})
    if length == 1:
        return a
    elif length == 2:
        x, y = {a, b, c}
        return gcd_(x, y)
    else:
        x, y, z = {a, b, c}
        w = gcd_(x, y)
        return gcd_(w, z)

s = 0
for i in range(1, k + 1):
    for j in range(1, k + 1):
        for h in range(1, k + 1):
            p = gcd(i, j, h)
            s += p
            
print(s)

Fixed submission:
k = int(input())

def gcd_(a, b):
    if a < b:
        a, b = b, a
    while not a % b == 0:
        a, b = b, a % b
    return b

s = 0
for i in range(1, k + 1):
    for j in range(1, k + 1):
        p = gcd_(i, j)
        if p == 1:
            s += k
        else:
            for h in range(1, k + 1):
                s += gcd_(p, h)
            
print(s)
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal

h, w = input().split()
h_d = Decimal(h)
w_d = Decimal(w)
d_05 = Decimal('0.5')

if int(h) % 2 == 0:
    print(int(h_d*w_d*d_05))
else:
    if int(w) % 2 == 0:
        c = h_d * w * d_05
    else:
        c = d_05 * (h_d * w_d + Decimal('1'))
    print(int(c))

Fixed submission:
from math import ceil
h,w = map(int,input().split())
ans = h * (w // 2)
if w % 2 != 0 :
    ans += ceil(h/2)
if h == 1 or w == 1:
    ans = 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

h, n = map(int, input().split())
ab = np.array([list(map(int, input().split())) for _ in range(n)])

a = ab[:, 0]
b = ab[:, 1]

dp = np.zeros(10, dtype=np.int)

for i in range(1, h+1):
    dp[i] = min(dp[i-a]+b)

print(dp[h])

Fixed submission:
import numpy as np

h, n = map(int, input().split())
ab = np.array([list(map(int, input().split())) for _ in range(n)])

a = ab[:, 0]
b = ab[:, 1]

dp = np.zeros(10**5, dtype=np.int)

for i in range(1, h+1):
    dp[i] = min(dp[i-a]+b)

print(dp[h])