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

Fixed submission:
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    if i in WA.keys():
        y+=WA[i]
print(sum(AC.values()),y)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
AC={}
WA={}
for i in range(M):
    a,b=input().split()
    if not(a in AC.keys()):
        if b=="AC":
            AC[a]=1
        else:
            if a in WA.keys():
                WA[a]+=1
            else:
                WA[a]=1
y=0
for i in AC.keys():
    y+=WA[i]
print(sum(AC.values()),y)

Buggy submission (verdict: Runtime Error):
N,M=map(int, input().split())
wa={}
ac=[]
key=[]

    
for i in range(M):
    p,s=input().split()
    if p not in ac:
        if p not in key:
            key.append(p)
            wa[P[i]]=0

        if s=="WA":
            wa[p]+=1
        else:
            ac.append(p)
ans=0
for i in key:
    if i in ac:
        ans+=wa[i]
print(len(ac),ans)

Buggy submission (verdict: Runtime Error):
%%time
N,M=map(int, input().split())
P=[]
S=[]
for i in range(M):
    p,s=input().split()
    P.append(int(p))
    S.append(s)


import numpy as np
P=np.array(P)
S=np.array(S)

if M>0:
    ans=P[S=="AC"]

    wa=0
    ac=[]
    for i in range(M):
        if P[i] in ans and P[i] not in ac and S[i]=="WA":
            wa+=1
        else:
            ac.append(P[i])
    
    
    print(len(ans),wa)
else:
    print(0,0)

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M=map(int, input().split())
A = np.array([input().split() for i in range(M)])


P=A[:,0]
S=A[:,1]

if M>0:
    ans=np.unique(P[S=="AC"])

    wa=0
    for j in ans:
        for i in S[P==j]:
            if i=="WA":
                wa+=1
            else:
                break

    print(len(ans),wa)
else:
    print(0,0)

Buggy submission (verdict: Runtime Error):
N,M=map(int, input().split())
P=[]
S=[]
for i in range(M):
    p,s=input().split()
    P.append(int(p))
    S.append(s)


import numpy as np
P=np.array(P)
S=np.array(S)

ans=np.unique(P[S=="AC"])

wa=0
for j in ans:
    for i in S[P==j]:
        if i=="WA":
            wa+=1
        else:
            break

print(len(ans),wa)
Problem p02812 (python)

Fixed submission:
N=int(input())
S=input()
ans=0
c=0
for s in S:
    
    if s=="A":
        c=1
    elif s=="B" and c==1:
        c=2
    elif s=="C" and c==2:
        ans+=1
        c=0
    else:
        c=0

print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
ans=0
for s in S:
    
    if s=="A":
        c=1
    elif s=="B" and c==1:
        c=2
    elif s=="C" and c==2:
        ans+=1
        c=0
    else:
        c=0

print(ans)
Problem p02817 (python)

Fixed submission:
S, T =input().split()
print(T+S)

Buggy submission (verdict: Runtime Error):
 S, T =input().split()
print(T+S)
Problem p02837 (python)

Fixed submission:
def counter(x):
    if x==0:
        return 0
    return counter(x >> 1) + (x & 1)
N=int(input())
A=[[]]
X=[[]]
Y=[[]]
for i in range(1,N+1):
    a=int(input())
    A.append(a)
    x=[[]]
    y=[[]]
    for j in range(a):
        b=list(map(int,input().split()))
        x.append(b[0])
        y.append(b[1])
    X.append(x)
    Y.append(y)
ans=0
for bits in range(1 << N):
    #print(bin(bits))
    ok=True
    for i in range(1,N+1):
        if not (bits & (1<<i-1)):
            continue
        for j in range(1,A[i]+1):
            if(((bits >> (X[i][j]-1)) & 1) ^ Y[i][j]):
                ok = False
        
    if ok:
#        print(ok,bin(bits))
        ans = max(ans, counter(bits))
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=[[]]
X=[[]]
Y=[[]]
for i in range(1,N+1):
    a=int(input())
    A.append(a)
    x=[[]]
    y=[[]]
    for j in range(a):
        b=list(map(int,input().split()))
        x.append(b[0])
        y.append(b[1])
    X.append(x)
    Y.append(y)
ans=0
for bits in range(1 << N):
    #print(bin(bits))
    ok=True
    for i in range(1,N+1):
        if not (bits & (1<<i-1)):
            continue
        for j in range(1,A[i]+1):
            if(((bits >> (X[i][j]-1)) & 1) ^ Y[i][j]):
                ok = False
        
    if ok:
#        print(ok,bin(bits))
        ans = max(ans, counter(bits))
print(ans)
Problem p02855 (python)

Fixed submission:
import numpy as np
H,W,K=map(int, input().split())
M=np.array([list(input()) for _ in range(H)])
ans=np.zeros((H,W),int)
k=0

for i in range(H):
    l=0
    for j in range(W):
        if M[i,j]=='#':
            k+=1
            ans[i,l:j+1]=k
            l=j+1

            
for i in range(H):
    for j in range(W):
        if ans[i,j]==0:
            ans[i,j]=ans[i,j-1]
            
            
for j in range(W):
    J=W-j-1
    for i in range(H):
        I=H-i-1
        if I!=H-1 and ans[I,J]==0:
            ans[I,J]=ans[I+1,J]


for i in range(H):
    if sum(ans[i,:])==0:
        if i!=0:
            ans[i,:]=ans[i-1,:]
        if i==0:
            ans[i,:]=ans[1,:]
            
for row in ans:
    print(*row)

Buggy submission (verdict: Runtime Error):
import numpy as np
H,W,K=map(int, input().split())
M=np.array([list(input()) for _ in range(H)])
ans=np.zeros((H,W),int)
k=0

for i in range(H):
    l=0
    for j in range(W):
        if M[i,j]=='#':
            k+=1
            ans[i,l:j+1]=k
            l=j+1

# for i in range(H):
#     if sum(ans[i,:])==0:
#         if i!=0:
#             ans[i,:]=ans[i-1,:]
#         if i==0:
#             ans[i,:]=ans[1,:]
            
for i in range(H):
    for j in range(W):
        if ans[i,j]==0:
            ans[i,j]=ans[i,j-1]
            
            
for j in range(W):
    J=W-j-1
    for i in range(H):
        I=H-i-1
        if ans[I,J]==0:
            ans[I,J]=ans[I+1,J]
            
for row in ans:
    print(*row)

Buggy submission (verdict: Runtime Error):
import numpy as np
H,W,K=map(int, input().split())
M=np.array([list(input()) for _ in range(H)])
ans=np.zeros((H,W),int)
k=0

for i in range(H):
    l=0
    for j in range(W):
        if M[i,j]=='#':
            k+=1
            ans[i,l:j+1]=k
            l=j+1

# for i in range(H):
#     if sum(ans[i,:])==0:
#         if i!=0:
#             ans[i,:]=ans[i-1,:]
#         if i==0:
#             ans[i,:]=ans[1,:]
            
for i in range(H):
    for j in range(W):
        if ans[i,j]==0:
            ans[i,j]=ans[i,j-1]
            
            
for j in range(W):
    J=W-j-1
    for i in range(H):
        I=H-i-1
        if ans[J,I]==0:
            ans[J,I]=ans[J+1,I]
            
for row in ans:
    print(*row)

Buggy submission (verdict: Runtime Error):
import numpy as np
H,W,K=map(int, input().split())
M=np.array([list(input()) for _ in range(H)])
ans=np.zeros((H,W),int)
k=0
l
for i in range(H):
    l=0
    for j in range(W):
        if M[i,j]=='#':
            k+=1
            ans[i,l:j+1]=k
            l=j+1

for i in range(H):
    if sum(ans[i,:])==0:
        if i!=0:
            ans[i,:]=ans[i-1,:]
        if i==0:
            ans[i,:]=ans[1,:]
for i in range(H):
    for j in range(W):
        if ans[i,j]==0:
            ans[i,j]=ans[i,j-1]
            
for row in ans:
    print(*row)
Problem p02882 (python)

Fixed submission:
import math
A,B,X=map(int, input().split())
C=2*X/(A*B)
if C<=A:
    math.atan(B/C)*(180)/math.pi
    C=2*X/(A*B)
    print(math.atan(B/C)*(180)/math.pi)
else:
    Y=A*A*B-X
    C=2*Y/(A*A)
    
    C=2*Y/(A*A)
    print(math.atan(C/A)*(180)/math.pi)

Buggy submission (verdict: Runtime Error):
A,B,X=map(int, input().split())
C=2*X/(A*B)
if C<=A:
    math.atan(B/C)*(180)/math.pi
    C=2*X/(A*B)
    print(math.atan(B/C)*(180)/math.pi)
else:
    C=2*Y/(A*A)
    Y=A*A*B-X
    C=2*Y/(A*A)
    print(math.atan(C/A)*(180)/math.pi)
Problem p02918 (python)

Fixed submission:
N,K=map(int,input().split())
S=list(input())

old='X'
count=0
for i,s in enumerate(S):
    if s==old:
        count+=1

    old=s
print(min(count+2*K,N-1))

Buggy submission (verdict: Runtime Error):
if K<N//2+1:
    for i in range(K):
        flag=0
        old=S[0]
        reverse=[]

        for j in range(1,N):
    #         print(j,old,S[j])
            if S[j]!=old:
                reverse.append(j)
                old=S[j]

            if len(reverse)==2:

                for k in range(reverse[0],reverse[1]):

                    if S[k]=='R':
                        S[k]='L'
                    else:
                        S[k]='R'
                break

        if len(reverse)==1:
                 for k in range(reverse[0],N):
                    if S[k]=='R':
                        S[k]='L'
                    else:
                        S[k]='R'
    old='aaa'
    ans=0
    for s in S:
        if old==s:
            ans+=1
        old=s
    print(ans)
else:
    print(N)
Problem p02927 (python)

Fixed submission:
M, D   = map(int, input().split())
ans=0
for i in range(M):
    m=i+1
    for j in range(D):
        d=j+1
        d1=d%10
        d10=d//10
        if d1>=2 and d10>=2 and m==d10*d1:
            ans+=1
#             print(m,d)
print(ans)

Buggy submission (verdict: Runtime Error):
M, D   = map(int, input().split())ans=0
for i in range(M):
    m=i+1
    for j in range(D):
        d=j+1
        d1=d%10
        d10=d//10
        if d1>=2 and d10>=2 and m==d10*d1:
            ans+=1
#             print(m,d)
print(ans)
Problem p02937 (python)

Fixed submission:
s = input()
t = input()
r = 0
p = 0
x = 0
for i in t:
    if s.find(i) == -1:
        print(-1)
        exit()
    if p > s.find(i):
        if s[p:].find(i) == -1:
            x += 1
            p = s.find(i) + 1
        else:
            p = p + s[p:].find(i) + 1
    else:
        p = s.find(i) + 1
print(x * len(s) + p)

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

ss=list(s)
tt=list(t)
l=len(ss)    
count=0
y=-1
ind={}
flag1=0
for x in tt:
    ind[x]=[i for i, xx in enumerate(ss) if xx == x]
    if ind[x]==[]:
        flag1=1

if flag1==0:    
    for x in tt:
        for z in ind[x]:
            if z>y:
                y=z
                flag=0
                break
            flag=1
        if flag==1:
            count+=1
            y=ind[x][0]
    #         print(count,z,y)
    ans=count*l+z+1
    print(ans)
else:
    pritn(-1)
Problem p02945 (python)

Fixed submission:
A, B   = map(int, input().split())
x= A+B
y= A-B
z=A*B
print(max([x,y,z]))

Buggy submission (verdict: Runtime Error):
A, B   = map(int, input().spli
x= A+B
y= A-B
z=A*B
print(max([x,y,z]))
Problem p02947 (python)

Fixed submission:
N = int(input())
dic = {}
ans = 0
for i in range(N):
    tmp = "".join(sorted(input()))
    if tmp in dic:
        ans += dic[tmp]
        dic[tmp] += 1
    else:
        dic[tmp] = 1
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
ans=0
N = int(input())
A=[]
for i In range(N):
    x=collections.Counter(list(input()))
    for s in A:
        if x==s:
            ans+=1
        else:
            A.append(x)
print(ans)
Problem p02963 (python)

Fixed submission:
S=int(input())
a=10**9
b=0
c=S%a
d=S//a+1
if S==1000000000000000000:
    print(0,0,10**9,0,0,10**9)
else:
    print(0,1,a,b,c,d)

Buggy submission (verdict: Runtime Error):
S=int(input())
x=int(math.sqrt(S))
y=S-x**2
print(2,0,x+2,y,1,x)

Buggy submission (verdict: Runtime Error):
S = int(input())
y=1
for i in range(2,S+1):
    if S%i==0:
        y*=i
        x=int(S/y)
        if x < 10**9:
            break
print(0,0, x, 0, 0, y)
Problem p02969 (python)

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

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

def sol(i,want):
    num=int(N/(i+1))
    wa=-A[0]
    for j in range(num):
        wa+=A[i+j*i]
    wa=wa%2
    if wa==want:
        x=0
    else:
        x=1
#     print(num)
    return x 

B=A[:]
half=int(N/2)
for i in range(half):
    j=half-1-i
#     print(j)
    B[j]=sol(j,A[j])
    
C=[]
for i in range(N):
    if B[i]==1:
        C.append(i+1)
m=sum(B)
print(m)
print(*C)

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

def sol(i,want):
    num=int(N/(i+1))
    wa=-A[0]
    for j in range(num):
        wa+=A[i+j*i]
    wa=wa%2
    if wa==want:
        x=0
    else:
        x=1
#     print(num)
    return x 

B=A[:]
for i in range(half):
    j=half-1-i
#     print(j)
    B[j]=sol(j,A[j])
    
C=[]
for i in range(N):
    if B[i]==1:
        C.append(i+1)
m=sum(B)
print(m)
print(*C)

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

def sol(i,want):
    num=int(N/(i+1))
    wa=-A[0]
    for j in range(num):
        wa+=A[i+j*i]
    wa=wa%2
    if wa==want:
        x=0
    else:
        x=1
#     print(num)
    return x 

B=A[:]
for i in range(half):
    j=half-1-i
#     print(j)
    B[j]=sol(j,A[j])
    
C=[]
for i in range(N):
    if B[i]==1:
        C.append(i+1)
m=sum(B)
print(m)
for i in range(m):
    print(C[i])
Problem p02971 (python)

Fixed submission:
import numpy as np
N = int(input())
A = np.array([int(input()) for i in range(N)])

max_index=np.argmax(A)
a_max=int(A[max_index])
a_second=int(np.amax(np.delete(A,max_index)))
A[:]=a_max
A[max_index]=a_second
for a in A:
    print(int(a))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = np.array([int(input()) for i in range(N)])

max_index=np.argmax(A)
a_max=int(A[max_index])
a_second=int(np.amax(np.delete(A,max_index)))
A[:]=a_max
A[max_index]=a_second
for a in A:
    print(int(a))
Problem p02995 (python)

Fixed submission:

import fractions

A,B,C,D = map(int, input().split())
ans=B-A+1


E=D * C // fractions.gcd(C, D)

if A%C==0:
    nC_initial=A//C
else:
    nC_initial=A//C+1
    
if A%D==0:
    nD_initial=A//D
else:
    nD_initial=A//D+1

    
if A%E==0:
    nE_initial=A//E
else:
    nE_initial=A//E+1
    
nC_final=B//C
nD_final=B//D
nE_final=B//E
if nC_final<nC_initial:
    nC_final=nC_initial
if nD_final<nD_initial:
    nD_final=nD_initial
if nE_final<nE_initial:
    nE_final=nE_initial
nc=(nC_final-nC_initial+1)
nd=(nD_final-nD_initial+1)
ne=(nE_final-nE_initial+1)
if B<C:
    nc=0
    ne=0
if B<D:
    nd=0
    ne=0
if B<E:
    ne=0


#print(ans,nC_initial,nC_final,nD_initial,nD_final, nE_initial,nE_final)
#print(ans,nc,nd,ne)
print(ans-nc-nd+ne)

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int, input().split())
ans=B-A+1

import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
E=lcm(C,D)

if A%C==0:
    nC_initial=A//C
else:
    nC_initial=A//C+1
    
if A%D==0:
    nD_initial=A//D
else:
    nD_initial=A//D+1

    
if A%E==0:
    nE_initial=A//E
else:
    nE_initial=A//E+1
    
nC_final=B//C
nD_final=B//D
nE_final=B//E
if nC_final<nC_initial:
    nC_final=nC_initial
if nD_final<nD_initial:
    nD_final=nD_initial
if nE_final<nE_initial:
    nE_final=nE_initial
#print(ans,nC_initial,nC_final,nD_initial,nD_final, nE_initial,nE_final)
print(ans-(nC_final-nC_initial+1)-(nD_final-nD_initial+1)+(nE_final-nE_initial+1))
Problem p03035 (python)

Fixed submission:
A, B = map(int, input().split())
if A>=13:
    print(B)
elif A<=5:
    print(0)
else:
    print(int(B/2))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A>=13:
    print(B)
elif A<=5:
    print(0)
else:
    print(int(B/2)
Problem p03043 (python)

Fixed submission:
import math
N,K=map(int,input().split())

points=[]
for i in range(N):
    x=K/(i+1)
    y=math.log(x)/math.log(2)
    y=max(0,math.ceil(y))
    z=pow(2,-math.ceil(y))
    points.append(z)
print(sum(points)/N)

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

points=[]
for i in range(N):
    x=K/(i+1)
    y=math.log(x)/math.log(2)
    y=max(0,math.ceil(y))
    z=pow(2,-math.ceil(y))
    points.append(z)
print(sum(points)/N)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
half=[K]
for i in range(1,K):
    if K%(2**i)==0:
        half.append(int(K/(2**i)))
    else:
        half.append(1+int(K/(2**i)))
    maxi=i
    if int(K/(2**i))==0:
        break
half.sort()

ans=[]
if half[0]<N:
   # ans.append(half[0]/(2**(maxi)))

    for i in range(maxi):

        
        if half[i+1]<N:
            sa=half[i+1]-half[i]
        #    print(half[i],sa)
            ans.append(sa/(2**(maxi-i)))
        else:
            sa=N-half[i]
      #      print(half[i],sa)
            ans.append(sa/(2**(maxi-i)))
            j=i
            break

if half[j+1]==N:
    #print(half[j+1])
    ans.append(1/(2**(maxi-j-1)))
            
if half[-1]<N:
    sa=N-half[-1]+1
  #  print(half[-1],sa,"kjh")
    ans.append(sa)



#print(half)
#print(ans)
ans=sum(ans)/N
print(ans)
Problem p03059 (python)

Fixed submission:
A, B, T = map(int, input().split())
print(int((T+1/2)/A)*B)

Buggy submission (verdict: Runtime Error):
N = int(input())
# スペース区切りの整数の入力
A = list(map(int, input().split()))
C=list(set(A))

#print(A)
#print(C)
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

anslist=[]

if len(C)==1:
  ans=C[0]

elif len(C)==2:
  sol=max(A[0],A[1])

else:
  for i in range(3):
    B=A[:]
    B.remove(C[i])
    sol=0
    for b in B:
        sol=gcd(sol,b)
    anslist.append(sol)
    ans=max(anslist)

#print(anslist)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
# スペース区切りの整数の入力
A = list(map(int, input().split()))


def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

ans=[]

for i in range(3):
    B=A[:]
    del B[i]
    sol=0
    for b in B:
        sol=gcd(sol,b)
    ans.append(sol)


print(max(ans))
Problem p03063 (python)

Fixed submission:
N = int(input())
S =(list(input()))
newS=[]
for i in S:
    if i == ".":
        newS.append(0)
    else:
        newS.append(1)

countW=newS.count(0)
countB=newS.count(1)
ans=min(countW,countB)
countB=0
for s in newS:
    if s ==1:
        
        countB+=1
    else:
      countW-=1
      
        
    ans=min(ans,countB+countW)
    #print(countB,countW)
#print(ans)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S =(list(input()))
newS=[]
for i in S:
    if i == ".":
        newS.append(0)
    else:
        newS.append(1)

points10=[]
before=0
for i,s in enumerate(newS):
    if before -s ==1:
        points10.append(i)
    before = s

ans=[]
for i in points10:
    countW=0
    countB=0
    for j,s in enumerate(newS):
        if j<i:
            if s==1:
                countB=countB+1
        else:
            if s==0:
                countW=countW+1
    #print(countW,countB)
    ans.append(countB+countW-1)
#print(ans)
print(min(ans))
Problem p03393 (python)

Fixed submission:
S=input()
alphabet=[chr(i) for i in range(ord('a'),ord('z')+1)]
if len(S)!=26:
    for x in alphabet: 
        if not(x in set(S)):
            flag=1
            break
    ans=S+x
    print(ans)
else:
    s=ord(S[25])
    j=25
    for i in range(24,-1,-1):
        if s<ord(S[i]):
            j=i
            s=ord(S[i])
        else:
            break

    if j==0:
        print(-1)
    else:
        l=S[j:]
        y=300
        for x in list(map(ord,l)):
            if ord(S[j-1])<x:
                y=min(y,x)
        ans=S[:j-1]+chr(y)
        print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
alphabet=[chr(i) for i in range(ord('a'),ord('z')+1)]
if len(S)!=26:
    for x in alphabet: 
        if not(x in set(S)):
            flag=1
            break
    ans=S+x
    print(ans)
else:
    s=ord(S[25])
    for i in range(24,-1,-1):
        if s<ord(S[i]):
            j=i
            s=ord(S[i])

    if j==0:
        print(-1)
    else:
        l=S[j:]
        y=300
        for x in list(map(ord,l)):
            if ord(S[j-1])<x:
                y=min(y,x)
        ans=S[:j-1]+chr(y)
        print(ans)
Problem p02675 (python)

Fixed submission:
n = int(input())

while n >= 10:
    n -= 10

if n == 3:
    print("bon")

elif n == 0 or n == 1 or n == 6 or n == 8:
    print("pon")

else:
    print("hon")

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

n = 60 * h + m

r = n * math.pi * 11 / 360

ans = math.sqrt(a ** 2 + b ** 2 - 0.5 * a * b * math.cos(r))

print(ans)
Problem p02681 (python)

Fixed submission:
s = input()
t = input()

n = len(t)

if t[0:n-1] == s:
  print("Yes")
  
else:
  print("No")

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

b = 1

for i in range(k + 1):
    b = a[b - 1]

print(b)

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

b = 1

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

print(b)
Problem p02705 (python)

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

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

for i in range(n):
    ans = 0
    for j in range(n - 1):
        if i + 1 == a[j]:
            ans += 1
    print(ans)
Problem p02713 (python)

Fixed submission:
import math
k = int(input())
ans = 0

for a in range(k):
    for b in range(k):
        d = math.gcd(a + 1, b + 1)
        for c in range(k):
            ans += math.gcd(d, c + 1)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
k = int(input())
ans = 0

for a in range(k):
    for b in range(k):
        d = math.gcd(a + 1, b + 1)
        for c in range(k):
            ans += math(d, c + 1)

print(ans)
Problem p02613 (python)

Fixed submission:
import sys
from collections import defaultdict
from typing import Callable


def main():
    readline: Callable[[], str] = sys.stdin.readline

    memory: defaultdict = defaultdict(int)

    n: int = int(readline().rstrip())
    for _ in range(n):
        s: str = readline().rstrip()
        memory[s] += 1

    for judge in ("AC", "WA", "TLE", "RE"):
        print(f"{judge} x {memory[judge]}")

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
from typing import Callable


def main():
    readline: Callable[[], str] = sys.stdin.readline

    memory: defaultdict = defaultdict(int)

    n: int = int(readline().rstrip())
    for _ in range(n):
        s: str = readline().rstrip()
        memory[s] += 1

    for judge in ("AC", "WA", "TLE", "RE");
        print(f"{judge} x {memory[judge]}")

if __name__ == '__main__':
    main()
Problem p02628 (python)

Fixed submission:
import itertools
import sys
from typing import Callable, List, NoReturn


def main() -> NoReturn:
    readline: Callable[[], str] = sys.stdin.readline
    n, k = map(int, readline().rstrip().split())  # type: int,...
    p: List[int] = [int(_) for _ in readline().rstrip().split()]
    p.sort()
    print(sum(p[:k]))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import itertools
import sys
from typing import Callable, List, NoReturn


def main() -> NoReturn:
    readline: Callable[[], str] = sys.stdin.readline
    n, k = map(int, readline().rstrip().split())  # type: int,...
    p: List[int] = [int(_) for _ in readline().rstrip().split()]

    print(sum(p.sort()[:k]))


if __name__ == '__main__':
    main()
Problem p02631 (python)

Fixed submission:
import sys
from typing import Callable, List, NoReturn

import numpy as np


def main() -> NoReturn:
    readline: Callable[[], str] = sys.stdin.readline
    n: int = int(readline().rstrip())
    a: np.ndarray = np.array(tuple(int(_) for _ in readline().rstrip().split()))

    xor_all: int = 0
    for a_n in a:
        xor_all ^= a_n

    values = np.bitwise_xor(a, xor_all)
    print(" ".join(tuple(str(v) for v in  values)))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
from typing import Callable, List, NoReturn

import numpy as np


def main() -> NoReturn:
    readline: Callable[[], str] = sys.stdin.readline
    n: int = int(readline().rstrip())
    a: np.ndarray = np.array(tuple(int(_) for _ in readline().rstrip().split()))

    xor_all: int = 0
    for a_n in a:
        xor_all ^= a_n

    values = np.bitwise_xor(a, xor_all)
    print(" ".join(values))


if __name__ == '__main__':
    main()