Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
k=input()
sumk=0
for i in range (1,k+1):
    for a in range(1,k+1):
        for b in range(1,k+1):
            for c in range(1,k+1):
                gcd=1
                m=min(a,b,c)
                for x in range(1,m+1):
                    if (a%x==0 and b%x==0 and c%x==0):
                        gcd=x
                    else:
                        gcd=gcd
                        sumk=sumk+gcd
print(sumk)

Fixed submission:
import math
k=int(input())
ans=0
for p in range(1,k+1):
    for q in range(1,k+1):
        gcd=math.gcd(p,q)
        for r in range(1,k+1):
            ans=ans+math.gcd(gcd,r)
print(ans)
Buggy python submission (verdict: Runtime Error):
x,y,z=map(int, input().split)
 print(z, x, y)

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

Buggy python submission (verdict: Runtime Error):
 x,y,z=map(int, input().split)
 print(z,x,y)

Fixed submission:
x,y,z=map(int,input().split())
print(z,x,y)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
sumA=sum(a)
cnt=0
for i in a:
    if i>=sum/(4*m):
        cnt=cnt+1
    else:
        cnt=cnt
if cnt>=m:
    print('Yes')
else:
    print('No')

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
sumA=sum(a)
cnt=0
for i in a:
    if i>=sumA/(4*m):
        cnt=cnt+1
    else:
        cnt=cnt
if cnt>=m:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))
sumA=sum(a)
cnt=0
for i in a:
    if i>=sum/(4*m):
        cnt=cnt+1
if cnt>=m:
    print('Yes')
else:
    print('No')

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
sumA=sum(a)
cnt=0
for i in a:
    if i>=sumA/(4*m):
        cnt=cnt+1
    else:
        cnt=cnt
if cnt>=m:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
sum=0
for i in range(n):
    a=input()
    sum=sum+a
num=0
for i in range(n):
    a=input()
    if a<1/(4*sum):
        num=num
    else:
        num=num+1
if num>=m:
    print('Yes')
else:
    print('No')

Fixed submission:
n,m=map(int,input().split())
a=list(map(int,input().split()))
sumA=sum(a)
cnt=0
for i in a:
    if i>=sumA/(4*m):
        cnt=cnt+1
    else:
        cnt=cnt
if cnt>=m:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
x=input()
a=x//500
b=(x%500)//5
print(1000*a+5*b)

Fixed submission:
x=int(input())
a=x//500
b=(x%500)//5
print(1000*a+5*b)

Buggy python submission (verdict: Runtime Error):
x=input()
a=x//500
b=a//5
print(1000*a+5*b)

Fixed submission:
x=int(input())
a=x//500
b=(x%500)//5
print(1000*a+5*b)
Buggy python submission (verdict: Runtime Error):
k,n=map(input(),int.split())
a=list(map(input(),int.split()))

m=0
for i in range(n-1):
    d=a[i+1]-a[i]
    m=max(d,m)
d_last=a[0]+k-a[n-1]
m=max(d_last,m)

ans=k-m
print(ans)

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

m=0
for i in range(n-1):
    d=a[i+1]-a[i]
    m=max(d,m)
d_last=a[0]+k-a[n-1]
m=max(d_last,m)

ans=k-m
print(ans)

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

m=0
for i in range(n-1):
    d=a[i+1]-a[i]
    m=max(d,m)
d_last=a[0]+k-a[n-1]
m=max(d_last,m)

ans=k-m
print(ans)

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

m=0
for i in range(n-1):
    d=a[i+1]-a[i]
    m=max(d,m)
d_last=a[0]+k-a[n-1]
m=max(d_last,m)

ans=k-m
print(ans)

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

m=0
for i in range(n-1):
    d=a[i+1]-a[i]
    m=max(d,m)
d_last=a[0]+k-a[n-1]
m=max(d_last,m)

ans=k-m
print(ans)

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

m=0
for i in range(n-1):
    d=a[i+1]-a[i]
    m=max(d,m)
d_last=a[0]+k-a[n-1]
m=max(d_last,m)

ans=k-m
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().splt())
ans=((n*(n-1))/2)+(m*(m-1))/2
print(int(ans))

Fixed submission:
n,m=map(int,input().split())
ans=((n*(n-1))/2)+(m*(m-1))/2
print(int(ans))

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().splt())
ans=((n*(n-1))/2)+(m*(m-1))/2
print(ans)

Fixed submission:
n,m=map(int,input().split())
ans=((n*(n-1))/2)+(m*(m-1))/2
print(int(ans))
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
for i in range(n):
    if not s[i]==s[n-1-i]:
        print('No')
        quit()
for i in range(int(n*(n-1)/2)):
    if not s[i]==s[int((n*(n-1))/2)-1-i]:
        print('No')
        quit()
for i in range(int(n*(n-1)/2)):
    if not s[int(n*(n+3)/2)-1+i]==s[n-1-i]:
        print('No')
        quit()
else:
    print('Yes')

Fixed submission:
s=input()
n=len(s)
for i in range(n):
    if not s[i]==s[n-1-i]:
        print('No')
        quit()
for i in range((n-1)//2):
    if not s[i]==s[(n-1)//2-1-i]:
        print('No')
        quit()
for i in range((n-1)//2):
    if not s[(n+3)//2-1+i]==s[n-1-i]:
        print('No')
        quit()
print('Yes')
Buggy python submission (verdict: Runtime Error):
L=input()
x=L/6
y=L/6
z=L/6
print(x*y*z)

Fixed submission:
L=int(input())
x=L/3
y=L/3
z=L/3
print(x*y*z)
Buggy python submission (verdict: Runtime Error):
(A,B)=map(int, input().split())
 
for x in range(10000):
    if (int(x*0.08)==A and int(x*0.1)==B):
        print(x)
        break
    else:
        print('-1')

Fixed submission:
S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
i=(N//(A+B))*A
if N%(A+B)>A:
    i=i+A
else:
    i=i+(N%(A+B))
print(i)

Fixed submission:
S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N, A, B = [int(i) for i in input().split()]
i=(N//(A+B))*A
if N%(A+B)>A:
    i=i+A
else:
    i=i+(N%(A+B))
print(i)

Fixed submission:
S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
i=(N//(A+B))*A
if N%(A+B)>A:
    i=i+A
else:
    i=i+(N%(A+B))
print(i)

Fixed submission:
S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
i=N//(A+B)*A
if N%(A+B)>A:
    i=i+A
else:
    i=i+(N%(A+B))
print(i)

Fixed submission:
S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
i=N//((A+B)*(10**100))*A
if N%((A+B)*(10**100))>A:
    i=i+A
else:
    i=i+(N%(A+B)*(10**100))
print(i)

Fixed submission:
S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
i=N//((A+B)*(10**100))*A
if N%((A+B)*(10**100))>A:
    i=i+A
else:
    i=i+(N%(A+B)*(10**100))
print(i)


Fixed submission:
S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
i=(N//((A+B)*(10**100)))*A
if N%((A+B)*(10**100))>A:
    i=i+A
else:
    i=i+(N%(A+B)*(10**100))
print(i)


Fixed submission:
S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
N,A,B=map(int,input().split())
i=((A+B)*(10**100)//N)*A
if ((A+B)*(10**100))%N>A:
    i=i+A
else:
    i=i+((A+B)*(10**100)%N)
print(i)

Fixed submission:
S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
N=input()
A=input()
B=input()
i=((A+B)*(10**100)//N)*A
if ((A+B)*(10**100))%N>A:
    i=i+A
else:
    i=i+((A+B)*(10**100)%N)
print(i)


Fixed submission:
N,A,B=map(int,input().split())
i=(N//(A+B))*A
if N%(A+B)>A:
    i=i+A
else:
    i=i+(N%(A+B))
print(i)
Buggy python submission (verdict: Runtime Error):
(A,B)=map(int, input().split())
 
for x in range(10000):
    if (int(x*0.08)==A) and (int(x*0.1)==B):
        print"x"
        break
    else:
        print"-1"

Fixed submission:
(A,B)=map(int, input().split())
 
for x in range(10000):
    if (int(x*0.08)==A and int(x*0.1)==B):
        print(x)
        break
else:
    print("-1")

Buggy python submission (verdict: Runtime Error):
(A,B)=map(int, input().split())

for x in range(10000):
    if (int(x*0.08)==A and int(x*0.1)==B):
        print"x"
        break
    else:
        print"-1"

Fixed submission:
(A,B)=map(int, input().split())
 
for x in range(10000):
    if (int(x*0.08)==A and int(x*0.1)==B):
        print(x)
        break
else:
    print("-1")

Buggy python submission (verdict: Runtime Error):
(A,B)=map(int, input().split())

for x in range(10000):
    if (int(x*0.08)==a and int(x*0.1)==b):
        print"x"
    else:
        print"-1"

Fixed submission:
(A,B)=map(int, input().split())
 
for x in range(10000):
    if (int(x*0.08)==A and int(x*0.1)==B):
        print(x)
        break
else:
    print("-1")
Buggy python submission (verdict: Runtime Error):
n=input()
if n%2==0:
    print(n/2)
else:
    print((n//2)+1)

Fixed submission:
n=int(input())
if n%2==0:
    print(int(n/2))
else:
    print((n//2)+1)
Buggy python submission (verdict: Runtime Error):
n=input()
x=list(map(int, input().split()))
maxn=0
for i in range(n):
    if x[i]>maxn:
        maxn=x[i]
    else:
        maxn=maxn
minp=0
for j in range(n):
    minp=minp+(x[j]-1)**2
for i in range(maxn+1)
    for j in range(n):
        power=power+(x[j]-i)**2
    if power<minp:
        minp=power
    else:
        minp=minp
print(minp)

Fixed submission:
n=int(input())
x=list(map(int, input().split()))
maxn=0
for i in range(n):
    if x[i]>maxn:
        maxn=x[i]
    else:
        maxn=maxn
minp=0
for j in range(n):
    minp=minp+(x[j]-1)**2
for i in range(maxn+1):
    power=0
    for j in range(n):
        power=power+(x[j]-i)**2
    if power<minp:
        minp=power
    else:
        minp=minp
print(minp)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
sum1=0
max1=0
for i in range(n-k+1):
    sum1=0
    max1=max1
    for j in range(i,i+k):
        sum1=sum1+((1+p[j])/2)
    if sum1>max1:
      max1=sum1
print(max1)



Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
sum1=0
a=[]
for j in range(k):
    sum1=sum1+((1+p[j])/2)
a.append(sum1)
for i in range(1,n-k+1):
    sum1=sum1-((1+p[i-1])/2)+((1+p[i+k-1])/2)
    a.append(sum1)
ans=max(a)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
sum1=0
max1=0
for i in range(n-k+1):
    sum1=0
    max1=max1
    for j in range(i,i+k):
        sum1=sum1+((1+p[j])/2)
        if sum1>max1:
          max1=sum1
print(max1)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))
sum1=0
a=[]
for j in range(k):
    sum1=sum1+((1+p[j])/2)
a.append(sum1)
for i in range(1,n-k+1):
    sum1=sum1-((1+p[i-1])/2)+((1+p[i+k-1])/2)
    a.append(sum1)
ans=max(a)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=list(map(int,input().split()))
ans=1
m=s[0]
for i in range(1,n):
    if s[i]==1:
        ans=ans+1
    elif p[i]>m:
        continue
    else
        ans=ans+1
        m=s[i]
print(ans)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
ans=1
m=p[0]
for i in range(1,len(p)):
    if p[i]==1:
        ans=ans+1
        break
    elif p[i]>m:
        continue
    else:
        ans=ans+1
        m=p[i]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
p=list(map(int,input().split()))
ans=0
count=0
for i in range(n):
    for j in range(i+1):
        if p[i]<=p[j]:
            count=1
        else:
            count=0
            break
    ans=ans+count
print(ans)

Fixed submission:
n=int(input())
p=list(map(int,input().split()))
ans=1
m=p[0]
for i in range(1,len(p)):
    if p[i]==1:
        ans=ans+1
        break
    elif p[i]>m:
        continue
    else:
        ans=ans+1
        m=p[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
count=0
for i in range(n):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count=count+1
                i=i+3
            else:
                i=i+2
        else:
            i=i+1
print(count)

Fixed submission:
n=int(input())
s=input()
count=0
for i in range(n-2):
    if s[i]=="A":
        if s[i+1]=="B":
            if s[i+2]=="C":
                count=count+1
                i=i+3
            else:
                i=i+2
        else:
            i=i+1
print(count)
Buggy python submission (verdict: Runtime Error):
s,t=map(input().split())
print(t+s)

Fixed submission:
s,t=input().split()
print(t+s)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(n):
    if a[i]!=i+1-count:
        count=count+1
if count=0:
    count=-1
print(count)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(n):
    if a[i]!=i+1-count:
        count=count+1
if count==n:
    count=-1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
m=n-1
for a in range(1,n//2+1):
    if n%a==0:
        i=a
        j=n//a
        if i+j-2<m:
            m=i+j-2
print(m)

Fixed submission:
import math
n=int(input())
s=int(math.sqrt(n))
m=n-1
for a in range(1,s//1+1):
    if n%a==0:
        i=a
        j=n//a
        if i+j-2<m:
            m=i+j-2
print(m)
Buggy python submission (verdict: Runtime Error):
s=input()
n=len(s)
ans="Yes"
if n%2==0:
    for i in range(n//2+1):
        if s[2*i]=="L":
            ans="No"
            break
        if s[2*i+1]=="R":
            ans="No"
            break
else:
    if s[0]=="L":
        ans="No"
    for i in range(1,n//2+1):
        if s[2*i]=="L":
            ans="No"
            break
        if s[2*i-1]=="R":
            ans="No"
            break
print(ans)

Fixed submission:
s=input()
n=len(s)
ans="Yes"
if n%2==0:
    for i in range(n//2):
        if s[2*i]=="L":
            ans="No"
            break
        if s[2*i+1]=="R":
            ans="No"
            break
else:
    if s[0]=="L":
        ans="No"
    for i in range(1,n//2+1):
        if s[2*i]=="L":
            ans="No"
            break
        if s[2*i-1]=="R":
            ans="No"
            break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k,q=map(int,input().split())
a= []
for _ in range(q):
    a.append(int(input()))
ans=[k]*n
for i in range(q):
    for j in range(n):
        ans[j]=ans[j]-1
    ans[a[i]-1]=ans[a[i]-1]+1
for i in range(n):
    if ans[i]>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q=map(int,input().split())
a= []
for _ in range(q):
    a.append(int(input()))
ans=[0]*n
for i in range(q):
    ans[a[i]-1]=ans[a[i]-1]+1
for i in range(n):
    if ans[i]>q-k:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
ans="Yes"
for i in range(n-1):
    m=min(h[i+1:n])
    if h[i]-m>1:
        ans="No"
        break
print(ans)

Fixed submission:
n=int(input())
t=n
c=1
while t>=10:
    t=t//10
    c=c+1
ans=0
for i in range(1,c):
    if i%2==1:
        ans+=10**(i)-10**(i-1)
if c%2==1:
    ans=ans+n+1-10**(c-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
m1=0
m2=0
for i in range(n):
    a.append(int(input()))
    if a>m1:
        m2=m1
        m1=a
        index=i
    elif m1==a:
        m2=a
    elif a>m2:
        m2=a
for i in range(n):
    if i==index:
        print(m2)
    else:
        print(m1)

Fixed submission:
n=int(input())
a=[]
m1=0
m2=0
for i in range(n):
    a.append(int(input()))
    A=a[i]
    if a[i]>m1:
        m2=m1
        m1=a[i]
        index=i
    elif m1==a[i]:
        m2=a[i]
    elif a[i]>m2:
        m2=a[i]
for i in range(n):
    if i==index:
        print(m2)
    else:
        print(m1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
m=0
for i in range(n):
    a.append(int(input()))
for i in range(n):
    if a[i]!=max(a):
        print(max(a))
    else:
        m=a[i]
        a[i]=1
        print(max(a))
        a[i]=m

Fixed submission:
n=int(input())
a=[]
m1=0
m2=0
for i in range(n):
    a.append(int(input()))
    A=a[i]
    if a[i]>m1:
        m2=m1
        m1=a[i]
        index=i
    elif m1==a[i]:
        m2=a[i]
    elif a[i]>m2:
        m2=a[i]
for i in range(n):
    if i==index:
        print(m2)
    else:
        print(m1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
m=0
for i in range(n):
    a.append(int(input()))
for i in range(n):
    m=a[i]
    a[i]=1
    print(max(a))
    a[i]=m

Fixed submission:
n=int(input())
a=[]
m1=0
m2=0
for i in range(n):
    a.append(int(input()))
    A=a[i]
    if a[i]>m1:
        m2=m1
        m1=a[i]
        index=i
    elif m1==a[i]:
        m2=a[i]
    elif a[i]>m2:
        m2=a[i]
for i in range(n):
    if i==index:
        print(m2)
    else:
        print(m1)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
s[k-1] = chr(ord(s[k-1]) - ord('A') + ord('a'))
for c in s:
	print(c, end="")

Fixed submission:
n,k=map(int,input().split())
s=list(input())
s[k-1]=s[k-1].lower()
print("".join(s))
Buggy python submission (verdict: Runtime Error):
A=[]
for _ in range(3):
    A.append(int(input()))
a=A[0]
b=A[1]
c=A[2]
x=int(input())
count=0
for p in range(a):
    for q in range(b):
        for r in range(c):
            if 500*p+100*q+50*r==x:
                count=count+1
			else:
				count=count
print(count)

Fixed submission:
A=[]
for _ in range(3):
    A.append(int(input()))
a=A[0]
b=A[1]
c=A[2]
x=int(input())
count=0
for p in range(a+1):
    for q in range(b+1):
        for r in range(c+1):
            if 500*p+100*q+50*r==x:
                count=count+1
            else:
              count=count
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [input() for _ in range(N)]
c = 0
while S != []:
  s = S.pop(0)
  if s in S:
    continue
  else:
    c += 1
print(c)

Fixed submission:
N = int(input())
S = {input() for _ in range(N)}
print(len(S))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
  print(A.count(i))

Fixed submission:
import collections
N = int(input())
A = list(map(int,input().split()))
a = collections.Counter(A)
for i in range(1,N+1):
  print(a[i])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
s = 0
for a in range(1,N+1):
  t = A.count(a)
  if t>= 2:
    s += (t-1)*t/2
  
for k in range(1,N+1):
  i = A[k-1]
  I = A.count(i)
  if I < 2:
    print(int(s))
  else:
    print(int(s - (I-1)))

Fixed submission:
from collections import deque
N = int(input())
A = list(map(int,input().split()))
balls = [[] for _ in range(N+1)]
for i in range(N):
  balls[A[i]].append(i)
  
K = 0  
for i in range(N+1):
  if len(balls[i]) < 2:
    continue
  else:
    u = len(balls[i])
    K += int(u*(u-1)/2)
  
t = 0
q = deque()
for i in range(N):
  s = A[i]
  a = len(balls[s])
  if a >=2:
    d = a-1
  else:
    d = 0
  q.append(K-d)


while q:
  v = q.popleft()
  print(v)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
def ta():
  l = A[0]
  A.pop(0)
  co = 0
  for s in range(1,N+1):
    t = A.count(s)
    if t >= 2:
      co += t*(t-1)/2
    else:
      co += 0
  A.append(l)
  return co
  
for k in range(1,N+1):
  print(int(ta()))

Fixed submission:
from collections import deque
N = int(input())
A = list(map(int,input().split()))
balls = [[] for _ in range(N+1)]
for i in range(N):
  balls[A[i]].append(i)
  
K = 0  
for i in range(N+1):
  if len(balls[i]) < 2:
    continue
  else:
    u = len(balls[i])
    K += int(u*(u-1)/2)
  
t = 0
q = deque()
for i in range(N):
  s = A[i]
  a = len(balls[s])
  if a >=2:
    d = a-1
  else:
    d = 0
  q.append(K-d)


while q:
  v = q.popleft()
  print(v)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
c = 0
for i in range(N):
  if S[i] != 'A':
    continue
  else:
    if S[i+1] == 'B' and S[i+2] == 'C' and i <= N-3:
      c += 1
print(c)

Fixed submission:
N = int(input())
S = input()
c = 0
for i in range(N-2):
  if S[i] != 'A':
    continue
  else:
    if S[i+1] == 'B' and S[i+2] == 'C' and i <= N-3:
      c += 1
print(c)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
c = 0
for i in range(N):
  if S[i] != 'A':
    continue
  else:
    if S[i+1] == 'B' and S[i+2] == 'C':
      c += 1
print(c)

Fixed submission:
N = int(input())
S = input()
c = 0
for i in range(N-2):
  if S[i] != 'A':
    continue
  else:
    if S[i+1] == 'B' and S[i+2] == 'C' and i <= N-3:
      c += 1
print(c)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
Flag = True
if N % 2 == 1:
  Flag = False
for i in range(0,N+1):
  if Flag == True and S[i] != S[i+N/2] :
    Flag = False
if Flag == True:
  print('Yes')
else:
  print('No')

Fixed submission:
N = int(input())
S = input()
Flag = True
if N % 2 == 1:
  Flag = False
else:
  for i in range(0,int(N/2)):
    a = S[i]
    b = S[int(i+(N/2))]
    if a != b :
      Flag = False
if Flag == True:
  print('Yes')
elif Flag == False:
  print('No')
Buggy python submission (verdict: Runtime Error):
A,B = map(int.input().split)

if A > 9 or B > 9:
	print(-1)
else:
	print(A*B)

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

if A > 9 or B > 9:
	print(-1)
else:
	print(A*B)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B= int(input())
if A > 9 or B > 9:
	print(-1)
else
	print(A*B)

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

if A > 9 or B > 9:
	print(-1)
else:
	print(A*B)
Buggy python submission (verdict: Runtime Error):
N = int(input())
s =[]
n = N//2
for i in range(1,n):
  if N % i == 0:
    a = N//i + i
    s.append(a)
print(min(s)-2)

Fixed submission:
N = int(input())
s =N+1
n = int(N**0.5) 
i = 1
while i<=n:
  if N % i != 0:
    i += 1
  elif N % i == 0 and N//i +i < s:
    s = N//i + i
    i += 1
  else:
    i += 1
print(s-2)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
E = []
for i in range(1,N+1):
  if N % i == 0:
    E.append(N/i)
if len(E) % 2 == 0:
  k = int(E[int(len(E)/2)])+int(E[int(len(E)/2)-1])
else:
  k = int(E[int((len(E)-1)/2)]) * 2
print(k-2)

Fixed submission:
N = int(input())
s =N+1
n = int(N**0.5) 
i = 1
while i<=n:
  if N % i != 0:
    i += 1
  elif N % i == 0 and N//i +i < s:
    s = N//i + i
    i += 1
  else:
    i += 1
print(s-2)