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

Fixed submission:
c = input()
if c in 'aiueo':
  print('vowel')
else:
  print('consonant')

Buggy submission (verdict: Runtime Error):
c = int(input())
print("vowel" if c in "aiueo" else "consonant")
Problem p02713 (python)

Fixed submission:
from math import gcd
N = int(input())
ans = 0
for i in range(1,N+1):
  for j in range(1,N+1):
    for k in range(1,N+1):
      ans += gcd(gcd(i,j),k)

print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
N = int(input())
ans = 0
for i in range(N+1):
  for k in range(N+1):
    for l in range(N+1):
      ans += gcd(gcd(i,j),k)

print(ans)
Problem p03624 (python)

Fixed submission:
print(min(set(map(chr, range(97, 123))) - set(input()) or ["None"]))

Buggy submission (verdict: Runtime Error):
print(min(set(map(chr, range(97, 123))) - set(input())) or "None")

Buggy submission (verdict: Runtime Error):
print(min(set(map(chr, range(97, 123))) - set(input())) or None)

Buggy submission (verdict: Runtime Error):
print(min(set(map(chr, range(97, 123))) - set(input())))
Problem p03161 (python)

Fixed submission:

INF = 2**31-1
n,k = map(int,input().split())
h = list(map(int,input().split()))
dp = [INF for _ in range(n)]

dp[0] = 0

for i in range(0,n):
    for j in range(1,k+1):
        if i+j < n:
            dp[i+j] = min(dp[i+j], abs(h[i+j] - h[i]) + dp[i])
        else: break

print(dp[n-1])

Buggy submission (verdict: Runtime Error):
NF = 10e7
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
dp = [INF for _ in range(n)]

dp[0] = 0

for i in range(0,n):
    for j in range(1,k+1):
        if i+j < n:
            dp[i+j] = min(dp[i+j], abs(h[i+j] - h[i]) + dp[i])
        else: break

print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f

INF = 10e5
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
dp = [INF for _ in range(n)]

dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2,n):
    for j in range(1,k+1):
        if i >= j:
            dp[i] = min(dp[i], abs(h[i] - h[i-j]) + dp[i-j])
        else: break

print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f

INF = 10e5
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
dp = [INF for _ in range(n)]

dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2,n):
    for j in range(1,k+1):
        if i >= j:
            dp[i] = min(dp[i], abs(h[i] - h[i-j]) + dp[i-j])
        else: break

print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f

INF = 10e5
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
dp = [INF for _ in range(n)]

dp[0] = 0
dp[1] = abs(h[1]-h[0])

for i in range(2,n):
    for j in range(1,k+1):
        if i >= j:
            dp[i] = min(dp[i], abs(h[i] - h[i-j]) + dp[i-j])
        else: break

print(dp[n-1])
Problem p03163 (python)

Fixed submission:
N,W = map(int,input().split())
w,v = [0 for _ in range(N)], [0 for _ in range(N)]
for i in range(N):
    w[i],v[i] = map(int,input().split())
# dp[i][w] = [合計重さ,重さw で得られる最大の価値v]
dp = [[0 for _ in range(W+1)] for i in range(N+1)]

for i in range(N):
    for sum_w in range(W+1):
        if sum_w - w[i] >= 0:
            dp[i+1][sum_w] = max(dp[i][sum_w], dp[i][sum_w - w[i]] + v[i])
        dp[i+1][sum_w] = max(dp[i+1][sum_w],dp[i][sum_w])

# for i in dp:
#     print(i)
print(dp[N][W])

Buggy submission (verdict: Runtime Error):

N,W = map(int,input().split())
w,v = [0 for _ in range(N)],[0 for _ in range(N)]

for i in range(N):
    w[i],v[i] = map(int,input().split())

dp = [[0 for _ in range(110)] for _ in range(100100)]

for i in range(N):
    for sum_w in range(0,W+1):
        if sum_w - w[i] >= 0:
            dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - w[i]] + v[i])

        dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])

#dp[i]][sum_w]
print(dp[N][W])
Problem p02554 (python)

Fixed submission:
MOD=10**9+7
N=int(input())
ans=pow(10,N,MOD)
ans-=2*pow(9,N,MOD)
ans+=pow(8,N,MOD)
ans%=MOD
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
print((10**N-9**N-9**N+8**N)/(10**7+7)
Problem p02613 (python)

Fixed submission:
N=int(input())
ac=0
wa=0
tle=0
re=0
for _ in range(N):
  s=input()
  if 'AC'==s:
     ac+=1
  elif 'WA'==s:
    wa+=1
  elif 'TLE'==s:
    tle+=1
  elif 'RE'==s:
    re+=1
print('AC','x',ac)
print('WA','x',wa)
print('TLE','x',tle)
print('RE','x',re)

Buggy submission (verdict: Runtime Error):
N=int(input())
ac=0
wa=0
tle=0
re=0
for _ in range(N):
  s=input()
  if 'AC'==s:
     ac+=1
  elif 'WA'==s:
    wa+=1
  elif 'TLE'==s:
    tle+=1
  elif 'RE'==s:
    re+=1
print('AC',x,ac)
print('WA',x,wa)
print('TLE',x,tle)
print('RE',x,re)

Buggy submission (verdict: Runtime Error):
N=int(input())
ac=0
wa=0
tle=0
re=0
for _ in range(N):
  s=input()
  if 'AC'==s:
     ac+=1
  elif 'WA'==s:
    wa+=1
  elif 'TLE'==s:
    tle+=1
  elif 'RE'==s:
    re+=1
print('AC',×,ac)
print('WA',x,wa)
print('TLE',x,tle)
print('RE',x,re)
Problem p02675 (python)

Fixed submission:
N=input()
n=int(N[-1])

if n==2 or n==4 or n==5 or n==7 or n==9:
  print('hon')
elif n==3:
  print('bon')
else :
  print('pon')

Buggy submission (verdict: Runtime Error):
N=input()
n=int(N[-1])

if n==2 or n==4 or n==5 n==7 n==9:
  print('hon')
elif n==3:
  print('bon')
else :
  print('pon')
Problem p02765 (python)

Fixed submission:
a,b=list(map(int,input().split()))
if a<10:
  print(100*(10-a)+b)
else:
  print(b)

Buggy submission (verdict: Runtime Error):
a,b=list(map(int,input().split()))
if a<0:
  print(100*(10-a)+b)
esle:
  print(b)
Problem p02783 (python)

Fixed submission:
a,b=list(map(int,input().split()))
count=0
while (a>0):
  count+=1
  a-=b
print(count)

Buggy submission (verdict: Runtime Error):
a,b=list(map(int,input()))
count=0
while (a<0):
  count+=1
  a-=b
print(count)
Problem p02789 (python)

Fixed submission:
a,b=list(map(int,input().split()))
if a==b:
  print('Yes')
else :
  print('No')

Buggy submission (verdict: Runtime Error):
a,b=list(map(int,input().splilt()))
if a==b:
  print('Yes')
else :
  print('No')

Buggy submission (verdict: Runtime Error):
a,b=lits(map(int,input().splilt()))
if a==b:
  print('Yes')
else :
  print('No')
Problem p02921 (python)

Fixed submission:
a=input()
b=input()
count=0
for i in range(3):
  if a[i]==b[i]:
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
a=input().split()
b=input().split()
count=0
for i in range(3):
  if a[i]==b[i]:
    count+=1
print(count)
Problem p02957 (python)

Fixed submission:
a,b=list(map(int,input().split()))
if (a+b)%2==0:
  print(int((a+b)/2))
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
a,b=list(map(int,input().split()))
if (a+b)%2==0:
  print(int((a+b)/2))
else:
  print('IMPOSSIBLE'

Buggy submission (verdict: Runtime Error):
a,b=list(map(int,input().split()))
if abs(int((a-b)/2))=abs(int((b-a)/2)):
  print(int((a+b)/2))
else:
  print('IMPOSSIBLE')
Problem p02993 (python)

Fixed submission:
a=list(input())
count=0

       
for i in range(4):
  if i==3:
    break
  if a[i]==a[i+1] :
    count+=1
if count>=1:
  print('Bad')
else:
  print('Good')

Buggy submission (verdict: Runtime Error):
a=list(input())
count=0
for i in range(4):
  if a[i]==a[i+1] and i==2:
    count+=1
print(count)
Problem p03101 (python)

Fixed submission:
a,b=list(map(int,input().split()))
c,d=list(map(int,input().split()))
x=a*b
print(x-a*d-b*c+c*d)

Buggy submission (verdict: Runtime Error):
a,b=list(map(int,input().split()))
c,d=list(map(int,input().split()))
x=a*b
print(x-a*c-b*)
Problem p03264 (python)

Fixed submission:
a=int(input())
if a%2==0:
  print(int(a*a/4))
else:
  print(int(((a+1)*(a-1))/4))

Buggy submission (verdict: Runtime Error):
a=int(input)
if a%2==0:
  print(a*a)
else:
  print((a-1)*a)
Problem p03323 (python)

Fixed submission:
a,b=list(map(int,input().split()))
if a<=8 and b<=8:
  print('Yay!')
else :
  print(':(')

Buggy submission (verdict: Runtime Error):
a,b=list(map(int,input().split()))
if a<=8 and b<=8:
  print('Yay!')
esle :
  print(':(')
Problem p02600 (python)

Fixed submission:
def rank(X):
    if X >= 1800:
        return 1
    if X >= 1600:
        return 2
    if X >= 1400:
        return 3
    if X >= 1200:
        return 4
    if X >= 1000:
        return 5
    if X >= 800:
        return 6
    if X >= 600:
        return 7
    if X >= 400:
        return 8


X = int(input())
ans = rank(X)
print(ans)

Buggy submission (verdict: Runtime Error):
def population(n):
    if n == 0:
        return 0
    if n % 2 == 0:
        return population(n // 2)
    return 1 + population(n // 2)

N = int(input())
X = [0] * N
Y = [0] * N
P = [0] * N
for i in range(N):
    X[i], Y[i], P[i] = map(int, input().split())

ans = [10**10] * (N + 1)
for i in range(1 << (2 * N)):
    K = population(i)
    if K > N:
        continue
    cost = 0
    for j in range(N):
        if i & (1 << j) or i & (1 << (j + N)):
            continue
        cost2 = min(abs(X[j]), abs(Y[j]))
        for l in range(2 * N):
            if (i & (1 << l)) == 0:
                #print('cont', i)
                continue
            if l < N:
                #print('x')
                cost2 = min(cost2, abs(X[l] - X[j]))
            else:
                #print('y')
                cost2 = min(cost2, abs(Y[l - N] - Y[j]))
        cost += cost2 * P[j]
    ans[K] = min(ans[K], cost)
    #print(K, cost)
for i in range(N + 1):
    print(ans[i])
Problem p02613 (python)

Fixed submission:
N = int(input())

AC = 0
WA = 0
TLE = 0
RE = 0

for i in range(N):
  ans = input()
  
  if ans == "AC":
    AC += 1
    
  elif ans == "WA":
    WA += 1
    
  elif ans == "TLE":
    TLE += 1
    
  elif ans == "RE":
    RE += 1
    
print("AC x", AC)
print("WA x", WA)
print("TLE x", TLE)
print("RE x", RE)

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

AC = 0
WA = 0
TLE = 0
RE = 0

for i in range(N):
  ans = input()
  
  if ans = "AC":
    AC += 1
    
  elif ans = "WA":
    WA += 1
    
  elif ans = "TLE":
    TLE += 1
    
  elif ans = "RE":
    RE += 1
    
print("AC x", AC)
print("WA x", WA)
print("TLE x", TLE)
print("RE x", RE)
Problem p02639 (python)

Fixed submission:
x1, x2, x3, x4, x5 = map(int, input().split())

if x1 == 0:
  print(1)

elif x2 == 0:
  print(2)

elif x3 == 0:
  print(3)
  
elif x4 == 0:
  print(4)
  
elif x5 == 0:
  print(5)

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

for _ in range(n):
  if x[i] == 0:
    print(i + 1)

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

for _ in range(5):
  if x[i] == 0:
    print(i + 1)
Problem p02641 (python)

Fixed submission:
x, N = map(int, input().split())
p = list(map(int, input().split()))

min =10000
temp = 0
num = 10000

for i in range(-1000, 1000):
  temp = abs(x- i)
  
  if temp < min and i not in p:
    min = temp
    num = i
    
print(num)

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

min =10000
temp = 0

for i in range(-1000, 1000):
  temp = abs(X - i)
  
  if temp < min and i not in p:
    min = temp
    
print(min)

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

min =10000
temp = 0

for i in range(-1000, 1000):
  temp = abs(X - i)
  
  if temp < min and i not in p:
    min = temp
    
print(min)

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

min =10000
temp = 0

for i in range(-1000, 1000):
  temp = abs(X - i)
  
  if temp < min and i not in p:
    min = temp
    
print(min)
Problem p02658 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()

ans = 1

for i in range(N):
  ans *= A[i]
  
  if ans > 10**18:
    print(-1)
    exit()
    
print(ans)

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

ans = A[0]

for i in range(1, N + 1):
  ans *= A[i]
  
  if ans > 10**(18):
    print(-1)
    
print(ans)
Problem p02681 (python)

Fixed submission:
S = input()
T = input()

if S == T[:-1]:
  print("Yes")
  
else:
  print("No")

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

if S == T[:-2]:
  print("Yes")
  
else:
  print("No)
Problem p02694 (python)

Fixed submission:
X = int(input())
yen = 100
count = 0

while True:
  if yen >= X:
    break
  yen += yen // 100
  count += 1
  
print(count)

Buggy submission (verdict: Runtime Error):
X = int(input())
yen = 100
count = 0

while True:
  yen *= 1.01
  count += 1
  
  if int(year) >= X:
    print(count)
    exit()
Problem p02713 (python)

Fixed submission:
import math
K = int(input())
rst = 0
for i in range(1, K + 1):
    for j in range(1, K + 1):
        tmp = math.gcd(i, j)
        for k in range(1, K + 1):
            rst += math.gcd(tmp, k)
print(rst)

Buggy submission (verdict: Runtime Error):
import math

K = int(input())
sum = 0

for i in (1, K + 1):
  for j in range(1, K + 1):
    for k in range(1, K + 1):
      sum += math.gcd(i, j, k)
      
print(sum)
Problem p02719 (python)

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

print(min(N, abs(N-K)))

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

print(min(N, abs(N-K))
Problem p03699 (python)

Fixed submission:
N = int(input())
S = []

for i in range(N):
  S.append(int(input()))
  
S.sort()
ans = sum(S)

if ans % 10 != 0:
  print(ans)
  exit()
  
for i in range(N):
  if S[i] % 10 != 0:
    ans -= S[i]
    print(ans)
    exit()

print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []

for i in range(N):
  S.append(int(input()))
  
S.sort()
ans = sum(S)

if ans % 10 != 0:
  print(ans)
  
for i in range(N):
  if A[i] % 10 != 0:
    ans -= a[i]
    print(ans)
    exit()

print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []

for i in range(N):
  S.append(input())
  
S.sort()

ans = sum(S)

for i in range(N):
  if ans % 10 == 0:
    ans -= S[i]
    
  else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = []

for i in range(N):
  S.append(input())
  
S.sort(reverse = True)

ans = sum(S)

for i in range(N):
  if ans % 10 == 0:
    ans -= S[i]
    
  else:
    print(ans)
Problem p02713 (python)

Fixed submission:
from math import gcd
key = int(input())
sin = 0
for i in range(1,key+1):
    for j in range(1,key+1):
        temp = gcd(i,j)
        for m in range(1,key+1):
            sin += gcd(m,temp)
print(sin)

Buggy submission (verdict: Runtime Error):
from math import gcd
key = int(input())
sin = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        tmp = gcd(i,j)
        for m in range(1,k+1):
            sin += gcd(m,tmp)
print(sin)
Problem p02742 (python)

Fixed submission:
def bishop(H, W):
    if H==1 or W== 1:
        return 1
    result  = int((H-1)/2 + 1) * int((W-1)/2 + 1) + int(H/2) * int(W/2)
    return result
ans = input().split(" ")
H = int(ans[0])
W = int(ans[1])
print(bishop(H,W))

Buggy submission (verdict: Runtime Error):
def bishop(H, W):
    if H==1 or W== 1:
        return 0
    result  = int((H-1)/2 + 1) * int((W-1)/2 + 1) + int(H/2) * int(W/2)
    return result
ans = input().split(" ")
H = int(ans[0])
W = int(ans[1])
print(bishop(H,W)

Buggy submission (verdict: Runtime Error):
ans = input().split(" ")
H = ans[0]
W = ans[1]
result  = int((H-1)/2 + 1) * int((W-1)/2 + 1) + int(H/2) * int(W/2)
print(result)

Buggy submission (verdict: Runtime Error):
ans = input().split(" ")
H = ans[0]
W = ans[1]
result  = int((H-1)/2 + 1) * int((W-1)/2 + 1) + int(H/2) * int(W/2)
Problem p02678 (python)

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



r=list()
for i in range(n):
    a=list()
    r.append(a)
a=list()
for i in range(n):
    a.append(-1)
for i in range(m):
    x=0;y=0
    x,y=map(int,input().split())
    x-=1
    y-=1
    r[x].append(y)
    r[y].append(x)
    

a[0]=0
now=[0]
while len(now)!=0:
    nex=list()
    for i in now:
        for j in r[i]:
            if a[j]==-1:
                a[j]=i
                nex.append(j)
    now=nex


if -1 in a:
    print('No')
else:
    print('Yes')
    for item in a[1:]:
        print(item+1)

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



r=list()
for i in range(m):
    a=list()
    r.append(a)
a=list()
for i in range(n):
    a.append(-1)
for i in range(m):
    x=0;y=0
    x,y=map(int,input().split())
    x-=1
    y-=1
    r[x].append(y)
    r[y].append(x)
    

a[0]=0
now=[0]
while len(now)!=0:
    nex=list()
    for i in now:
        for j in r[i]:
            if a[j]==-1:
                a[j]=i
                nex.append(j)
    now=nex


if -1 in a:
    print('No')
else:
    print('Yes')
    for item in a[1:]:
        print(item+1)
Problem p02683 (python)

Fixed submission:
import numpy as np
(n,m,x)=map(int,input().split())

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

a=np.array(a)
result=np.array([[0]*(m+1)])
for i in range(n):
    l=list()
    for j in range(len(result)):
        l.append(a[i]+result[j])
        l.append(result[j])
    result=np.array(l)

c=list()
h=[x]*m
for line in result:
    if np.all(line[1:]>=h):
        c.append(line[0])
if len(c)==0:
    print(-1)
else:
    print(min(c))

Buggy submission (verdict: Runtime Error):
(n,m,x)=map(int,input().split())
c=list()
a=list()
for i in range(n):
  line=list(map(int,input().split()))
  c.append(line.pop(0))
  a.append(line)

result=list()
for i in range(2**n):
  total=[0]*m
  cost=0
  for k in range(n):
    if bin(i)[k]=="1":
      total+=a[k]
      cost+=int(c[k])
  if total>=[x]*m:
    result.append(cost)

if result!=[]:
  print(min(result))
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
(n,m,x)=map(int,input().split())
c=list()
a=list()
for i in range(n):
  line=map(int,input().split())
  c.apppend(line.pop(c[0]))
  a.append(line)

for i in range(2**n):
  total=[0]*m
  cost=0
  for k in range(n):
    if int(bin(i)[k])==1:
      total+=a[k]
      cost+=c[k]
  if total>=[x]*m:
    result.append(cost)

if result!=None:
  print(min(cost))
else:
  print(-1)
Problem p02684 (python)

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

ans=-1
l=[-1]*n
now=0
i=1
result=[0]
while i<=k:
    now=a[now]
    if l[now]!=-1:
        
        length=i-l[now]
        d=(k-i)%length+l[now]
        ans=l.index(d)
        break
    l[now]=i
    i+=1
    
if ans!=-1:
    print(ans+1)
else:
    print(now+1)

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

ans=0
now=1
i=1
result=[1]
while i<=k:
    now=a[now-1]
    if now in result:
        x=result.index(now)
        length=i-1-x
        ans=result[(k-x)%length+x]
    result.append(now)
    i+=1
    
if ans!=0:
    print(ans)
else:
    print(result[-1])

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

ans=0
now=1
i=1
result=[1]
while i<=k:
    now=a[now]
    if now in result:
        x=result.index(now)
        length=i-1-x
        ans=result[(k-x)%length+x]
    result.append(now)
    i+=1
    
if ans!=0:
    print(ans)
else:
    print(result[-1])
Problem p02692 (python)

Fixed submission:
n,A,B,C=map(int,input().split())
r=[A,B,C]
g=list()
for i in range(n):
    g.append(str(input()))
    
def re(string):
    if string=="AB":
        return(0,1)
    elif string=="AC":
        return(0,2)
    else:
        return(1,2)
    
def al(num):
    if num==0:
        return "A"
    elif num==1:
        return "B"
    else:
        return "C"
    
flag=0
result=list()
for i in range(n):
    a,b=re(g[i])
    if r[a]==0 and r[b]==0:
        print("No")
        flag=1
        break
    elif r[a]>r[b]:
        r[a]-=1
        r[b]+=1
        result.append(al(b))
    elif r[a]<r[b]:
        r[a]+=1
        r[b]-=1
        result.append(al(a))
    else:
        if i+1==n:
            r[a]+=1
            r[b]-=1
            result.append(al(a))
            break
        x,y=re(g[i+1])
        if (x,y)==(a,b):
            r[a]+=1
            r[b]-=1
            result.append(al(a))
        else:
            if x in (a,b):
                r[x]+=2
                r[a]-=1;r[b]-=1
                result.append(al(x))
            else:
                r[y]+=2
                r[a]-=1;r[b]-=1
                result.append(al(y))
        
if flag==0:
    print("Yes")
    for item in result:
        print(item)

Buggy submission (verdict: Runtime Error):
n,A,B,C=map(int,input().split())
r=[A,B,C]
g=list()
for i in range(n):
    g.append(str(input()))
    
def re(string):
    if string=="AB":
        return(0,1)
    elif string=="AC":
        return(0,2)
    else:
        return(1,2)
    
def al(num):
    if num==0:
        return "A"
    elif num==1:
        return "B"
    else:
        return "C"
    
flag=0
result=list()
for i in range(n):
    a,b=re(g[i])
    if r[a]==0 and r[b]==0:
        print("No")
        flag=1
        break
    elif r[a]>r[b]:
        r[a]-=1
        r[b]+=1
        result.append(al(b))
    elif r[a]<r[b]:
        r[a]+=1
        r[b]-=1
        result.append(al(a))
    else:
        x,y=re(g[i+1])
        if (x,y)==(a,b):
            r[a]+=1
            r[b]-=1
            result.append(al(a))
        else:
            if x in (a,b):
                r[x]+=2
                r[a]-=1;r[b]-=1
                result.append(al(x))
            else:
                r[y]+=2
                r[a]-=1;r[b]-=1
                result.append(al(y))
        
if flag==0:
    print("Yes")
    for item in result:
        print(item)
Problem p02548 (python)

Fixed submission:
import numpy as np
num=int(input())
count=0
for a in range(num-1):
  tmp=int(num/(a+1))
  if num%(a+1)==0:
    count+=tmp-1
  else:
    count+=tmp
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
num=int(input())-1
m=np.outer([a+1 for a in range(num)],[a+1 for a in range(num)])
m=np.where(m<=num,1,0)
print(np.sum(m))

Buggy submission (verdict: Runtime Error):
import numpy as np
num=int(input())-1
m=np.outer([a+1 for a in range(num)],[a+1 for a in range(num)])
print(m)
m=np.where(m<=num,1,0)
print(np.sum(m))