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

Fixed submission:
N = int(input()) % 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
from collections import deque

N = int(input())

a = []
b = []
for i in range(N):
    i1, i2 = map(int, input().split())
    g = math.gcd(i1,i2)
    if g == 0:
        a.append(i1)
        b.append(i2)
        continue
    x = i1 // g
    y = i2 // g
    if x < 0:
        x = - x
        y = - y 
    a.append(x)
    b.append(y)

P = {}
for i in range(N):
    if b[i] < 0:
        tmp = b[i]
        b[i] = a[i]
        a[i] = - tmp
        sgn = 1
    elif a[i] == 0:
        a[i] = b[i]
        b[i] = 0
        sgn = 1
    else :
        sgn = 0

    if (a[i],b[i]) in P:
        P[(a[i],b[i])][sgn]=P[(a[i],b[i])][sgn] + 1
    elif sgn == 0 :
        P[(a[i],b[i])]=[1,0]
    else :
        P[(a[i],b[i])]=[0,1]
        

MOD = 1000000007
a1 = 1 
ans0=0
for k in P:
    if k == (0,0):
        ans0 = P[k][0]
    else:
        a1 = a1*(pow(2,P[k][0],MOD)+pow(2,P[k][1],MOD) - 1) % MOD

if ans0 != 0:
    ans = ans0 + a1 -1
else:
    ans = a1 -1
print(ans%MOD)
Problem p02692 (python)

Fixed submission:
n,a,b,c = map(int, input().split())
s = [input() for _ in range(n)]

d = {'A':a,'B':b,'C':c}

ans = ['Yes']

for i in range(n):
    if d[s[i][0]] == 0 and d[s[i][1]] == 0:
        print('No')
        exit()
    if d[s[i][0]] == 1 and d[s[i][1]] == 1 and n-i > 1:
        d[s[i][0]] = 2
        d[s[i][1]] = 0
        if d[s[i+1][0]] == 0 and d[s[i+1][1]] ==0:
            d[s[i][0]] = 0
            d[s[i][1]] = 2
            ans.append(s[i][1])
        else:
            ans.append(s[i][0])
    elif d[s[i][0]] >= d[s[i][1]]:
        d[s[i][0]] = d[s[i][0]] - 1
        d[s[i][1]] = d[s[i][1]] + 1
        ans.append(s[i][1])
    else:
        d[s[i][0]] = d[s[i][0]] + 1
        d[s[i][1]] = d[s[i][1]] - 1
        ans.append(s[i][0])

for i in range(n+1):
    print(ans[i])

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

d = {'A':a,'B':b,'C':c}

ans = ['Yes']

for i in range(n):
    if d[s[i][0]] == 0 and d[s[i][1]] == 0:
        print('No')
        exit()
    if d[s[i][0]] == 1 and d[s[i][1]] == 1 and n > 1:
        d[s[i][0]] = 2
        d[s[i][1]] = 0
        if d[s[i+1][0]] == 0 and d[s[i+1][1]] ==0:
            d[s[i][0]] = 0
            d[s[i][1]] = 2
            ans.append(s[i][1])
        else:
            ans.append(s[i][0])
    elif d[s[i][0]] >= d[s[i][1]]:
        d[s[i][0]] = d[s[i][0]] - 1
        d[s[i][1]] = d[s[i][1]] + 1
        ans.append(s[i][1])
    else:
        d[s[i][0]] = d[s[i][0]] + 1
        d[s[i][1]] = d[s[i][1]] - 1
        ans.append(s[i][0])

for i in range(n+1):
    print(ans[i])

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

d = {'A':a,'B':b,'C':c}

ans = ['Yes']

for i in range(n):
    if d[s[i][0]] == 0 and d[s[i][1]] == 0:
        print('No')
        exit()
    if d[s[i][0]] == 1 and d[s[i][1]] == 1:
        d[s[i][0]] = 2
        d[s[i][1]] = 0
        if d[s[i+1][0]] == 0 and d[s[i+1][1]] ==0:
            d[s[i][0]] = 0
            d[s[i][1]] = 2
            ans.append(s[i][1])
        else:
            ans.append(s[i][0])
    elif d[s[i][0]] >= d[s[i][1]]:
        d[s[i][0]] = d[s[i][0]] - 1
        d[s[i][1]] = d[s[i][1]] + 1
        ans.append(s[i][1])
    else:
        d[s[i][0]] = d[s[i][0]] + 1
        d[s[i][1]] = d[s[i][1]] - 1
        ans.append(s[i][0])

for i in range(n+1):
    print(ans[i])
Problem p02554 (python)

Fixed submission:
a = 1000000007
 
n = int(input())
 
not0 = 1
not0and9 = 1
all = 1
for i in range(n):
  not0and9 = (not0and9 * 8) % a
  not0 = (not0 * 9) % a
  all = (all * 10) % a;
  
print((all + not0and9 - 2 * not0) % a)

Buggy submission (verdict: Runtime Error):
a = 1000000007

n = input()

not0 = 1
not0and9 = 1
all = 1
for i in range(n):
  not0and9 = (not0and9 * 8) % a
  not0 = (not0 * 9) % a
  all = (all * 10) % a;
  
print((all + not0and9 - 2 * not9) % a)
Problem p02583 (python)

Fixed submission:
N = int(input())
A = map(int, input().split())
A = sorted(A, reverse = False)
count = 0

for i in range(N-2):
    for j in range(i+1, N-1):
        for k in range(j+1, N):
            if (A[i] != A[j] != A[k]) and (A[k] < A[i] + A[j]):
                count += 1

print (count)

Buggy submission (verdict: Runtime Error):
#B-making trinagle
#while文を入れる場所がわからなかった
#import bisectってなんやねん
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
cnt = 0

def judge():
    if m == a + b:
        return "ok!"
    elif m >= a  b:
        return "high"
    else:
        return "low"

while True:
for i in range(N-2):
    a = list[i]
    for j in range(i + 1, N-1):
        b = list[j]
        if a == b:
            return True
        else:
            m = i + j
            while True:
            def judge(c)

cnt = m - j
print (cnt)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a, b= map(int(input().split())
print (a*b)
Problem p02675 (python)

Fixed submission:
N = int(input())
N = N % 10
if N in (2, 4, 5, 7, 9):
    print ("hon")
elif N in (0, 1, 6, 8):
    print ("pon")
elif N == 3:
    print ("bon")

Buggy submission (verdict: Runtime Error):
import math
A, B, H, M =map(int, input().split())
Hs = H*30 + M*0.5
Ms = 6*M
shita = Hs-Ms
shita = abs(shita)
if  shita >= 180:
    shita = 360 - shita
shita = math.radians(shita)
C = A*A + B*B - 2*A*B*(math.cos(shita))
print (math.sqrt(C))

Buggy submission (verdict: Runtime Error):
import math
A, B, H, M =map(int, input().split())
Hs = H*30 + M/2
Ms = 6*M
shita = Hs-Ms
print (shita)
shita = abs(shita)
if  shita >= 180:
    shita = shita - 180
shita = math.radians(shita)
C = A*A + B*B - 2*A*B*(math.cos(shita))
print (math.sqrt(C))

Buggy submission (verdict: Runtime Error):
N = int(input())
N = N % 10
if N in (2, 4, 5, 7, 9):
    print ("hon")
elif N in (0, 1, 6, 7):
    print ("pon")
elif N in (3):
    print ("bon")
Problem p02677 (python)

Fixed submission:
import math
A, B, H, M =map(int, input().split())
Hs = H*30 + M*0.5
Ms = 6*M
shita = Hs-Ms
shita = abs(shita)
if  shita >= 180:
    shita = 360 - shita
shita = math.radians(shita)
C = A*A + B*B - 2*A*B*(math.cos(shita))
print (math.sqrt(C))

Buggy submission (verdict: Runtime Error):
import math
A, B, H, M =map(int, input().split())
Hs = H/ 12 + 6*M
Ms = H/12 + M/2
shita = Hs-Ms
shita = abs(shita)
if  shita >= 180:
    shita = 180 - shita
shita = math.radians(shita)
C = A*A + B*B - 2*A*B*math.cos(shtia)
print (C ** 0.5)
Problem p02760 (python)

Fixed submission:
A = [list(map(int, input().split())) for i in range(3)]
N = int(input())

for k in range(N):
    B = int(input())
    for l in range(3):
        for m in range(3):
            if A[l][m] == B:
                A[l][m] = 0

if (A[0][0] == A[0][1] == A[0][2] == 0) or (A[1][0] == A[1][1] == A[1][2] == 0) or (A[2][0] == A[2][1] == A[2][2] == 0):
    print ("Yes")
elif (A[0][0] == A[1][0] == A[2][0] == 0) or (A[0][1] == A[1][1] == A[2][1] == 0) or (A[0][2] == A[1][2] == A[2][2] == 0):
    print ("Yes")
elif (A[0][0] == A[1][1] == A[2][2] == 0) or (A[0][2] == A[1][1] == A[2][0] == 0):
    print ("Yes")
else:
    print ("No")

Buggy submission (verdict: Runtime Error):
Aij= [int(input().split()) for l in range(3)]
N=int(input())
b= [int(input()) for i in range(N)]
for j in range(3):
    for k in range(3):
        for n in range(N):
            if int(Aij[j][k])==b[n]:
                Aij[j][k]="0"


if (Aij[0][0] == Aij[0][1] == Aij[0][2] == "0") or (Aij[1][0] == Aij[1][1] == Aij[1][2] == "0") or (Aij[2][0] == Aij[2][1] == Aij[2][2] == "0"):
    print('Yes')
elif Aij[0][0]=='0' and Aij[0][1]=='0' and Aij[0][2]=='0':
    print('Yes')
elif Aij[1][0]=='0' and Aij[1][1]=='0' and Aij[1][2]=='0':
    print('Yes')
elif Aij[2][0]=='0' and Aij[2][1]=='0' and Aij[2][2]=='0':
    print('Yes')
elif Aij[0][0]=='0'and Aij[1][1]=='0'and Aij[2][2]=='0':
    print('Yes')
elif Aij[0][2]=='0' and Aij[1][1]=='0'and Aij[2][0]=='0':
    print('Yes')
else:
    print('No')
Problem p02576 (python)

Fixed submission:
n,x,t=map(int,input().split())
if n%x==0:
  print(int(n//x)*t)
else:
  print((int(n//x)+1)*t)

Buggy submission (verdict: Runtime Error):
n,x,t=map(int,input())
if n%x==0:
  print(int(n//x)*t)
else:
  print((int(n//x)+1)*t)
Problem p02760 (python)

Fixed submission:
b1=list(map(int,input().split()))
b2=list(map(int,input().split()))
b3=list(map(int,input().split()))
n=int(input())

for i in range(n):
    bb=int(input())
    for j in range(3):
        if bb==b1[j]:
            b1[j]=0
        elif bb==b2[j]:
            b2[j]=0
        elif bb==b3[j]:
            b3[j]=0
if sum(b1)==0 or sum(b2)==0 or sum(b3)==0:
    print("Yes")
elif b1[0]==b2[0]==b3[0]==0:
    print("Yes")
elif b1[1]==b2[1]==b3[1]==0:
    print("Yes")
elif b1[2]==b2[2]==b3[2]==0:
    print("Yes")
elif b1[0]==b2[1]==b3[2]==0:
    print("Yes")
elif b1[2]==b2[1]==b3[0]==0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
for i in range(n):
    bb=int(input())
    for j in range(3):
        if bb==b1[j]:
            b1[j]=0
        elif bb==b2[j]:
            b2[j]=0
        elif bb==b3[j]:
            b3[j]=0
if sum(b1)==0 or sum(b2)==0 or sum(b3)==0:
    print("Yes")
elif b1[0]==b2[0]==b3[0]==0:
    print("Yes")
elif b1[1]==b2[1]==b3[1]==0:
    print("Yes")
elif b1[2]==b2[2]==b3[2]==0:
    print("Yes")

    
elif b1[0]==b2[1]==b3[2]==0:
    print("Yes")
elif b1[2]==b2[1]==b3[0]==0:
    print("Yes")
else:
    print("No")
Problem p02761 (python)

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

for i in range(m):
    ans.append(list(map(int,input().split())))
for j in range(10**n):
    if len(str(j))==n and all(str(j)[s-1]==str(c) for s,c in ans):
        print(j)
        break
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=[-1]*n
a,b=map(int,input().split())
ans[a-1]=b

for i in range(m-1):
    a,b=map(int,input().split())
    if ans[a-1]!=-1 and ans[a-1]!=b:
        print(-1)
        exit()
    else:
        ans[a-1]=b
       


if n>1 and ans[0]==0:
    print(-1)
elif n==1:
    if ans[0]==-1:
        print(0)
    else:
        print(ans[0])

elif n==2:
    for j in range(2):
        if ans[j]==-1:
            ans[j]=0
    print(10*ans[0]+ans[1])
else:
    for j in range(3):
        if ans[j]==-1:
            ans[j]=0
    
    print(100*ans[0]+10*ans[1]+ans[2])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=[-1]*n
a,b=map(int,input().split())
ans[a-1]=b

for i in range(m-1):
    a,b=map(int,input().split())
    if ans[a-1]==-1 or ans[a-1]==b:
        ans[a-1]=b
    else:
        print(-1)
        exit()


if n>1 and ans[0]==0:
    print(-1)
elif n==1:
    if ans[0]==-1:
        print(0)
    else:
        print(ans[0])

elif n==2:
    for j in range(2):
        if ans[j]==-1:
            ans[j]=0
    print(10*ans[0]+ans[1])
else:
    for j in range(3):
        if ans[j]==-1:
            ans[j]=0
    
    print(100*ans[0]+10*ans[1]+ans[2])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
ans=["x"]*n

for i in range(m):
    a,b=map(int,input().split())
    
    if ans[a-1]=="x" or ans[a-1]==b:
        ans[a-1]=b
    else:
        print(-1)
        exit()

if n==1 and ans[0]==0:
    print(0)
elif n>1 and ans[0]==0:
    print(-1)
elif "x" not in ans:
    print ("".join(ans))
    
else:
    for j in range(n):
        if ans[j]=="x":
            ans[j]=0
        print(ans[j], end="")
Problem p02882 (python)

Fixed submission:
import math
a,b,x=map(int,input().split())
y=0
if x==a**2*b:
    print(0)
    exit()
elif x<=a**2*b*0.5:
    y+=2*x/(a*b**2)
   
else:
    y+=a**3/(2*b*a**2-2*x)
   
theta=math.degrees(math.atan(y))   
print(90 - theta)

Buggy submission (verdict: Runtime Error):
import math
a,b,x=map(int,input().split())
y=0
if x<=a**2*b*0.5:
    y+=2*x/(a*b**2)
   
else:
    y+=a**3/(2*b*a**2-2*x)
   
theta=math.degrees(math.atan(y))   
print(90 - theta)
Problem p02995 (python)

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


lcm=int(c*d/fractions.gcd(c,d))

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
cd=b//lcm-(a-1)//lcm

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

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


lcm=int(c*d/math.gcd(c,d))

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
cd=b//lcm-(a-1)//lcm

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

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

e=int(c*d/math.gcd(c,d))
x1=(a-1)//c
x2=b//c
y1=(a-1)//d
y2=b//d
z1=(a-1)//e
z2=b//e


print(int(b-a+1-(x2-x1+y2-y1-(z2-z1))))

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

e=int(c*d/math.gcd(c,d))
x1=(a-1)//c
x2=b//c
y1=(a-1)//d
y2=b//d
z1=(a-1)//e
z2=b//e


#print(a,b,c,d,e,x1,x2,y1,y2,z1,z2)

print(b-a+1-(x2-x1+y2-y1-(z2-z1)))
Problem p03086 (python)

Fixed submission:
s=input()
n=len(s)
at=["A","T","G","C"]
ans=[-1]
for i in range(n-1):
    if s[i] not in at:
        ans.append(i)#-ans[-1])
if s[n-1] in at:
    ans.append(n)
else:
    ans.append(n-1)

m=len(ans)
ans2=[]
for j in range(m-1):
    ans2.append(ans[j+1]-ans[j]-1)

#print(ans)
#print(ans2)

if len(ans)==1:
    print(n)
elif len(ans2)==0:
    print(0)
else:
    print(max(ans2))

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
at=["A","T","G","C"]
ans=[-1]
for i in range(n):
    if s[i] not in at:
        ans.append(i)#-ans[-1])
m=len(ans)
ans2=[]
for j in range(m-1):
    ans2.append(ans[j+1]-ans[j]-1)
#print(ans2)    
print(max(ans2))

Buggy submission (verdict: Runtime Error):
s=input()
n=len(s)
at=["A","T","G","C"]
ans=[-1]
for i in range(n):
    if s[i] not in at:
        ans.append(i)#-ans[-1])
m=len(ans)
ans2=[]
for j in range(m-1):
    ans2.append(ans[j+1]-ans[j])
print(ans)    
print(max(ans2)-1)
Problem p03106 (python)

Fixed submission:
a,b,k=map(int,input().split())
A=set()
for i in range(1,a+1):
    if a%i==0:
        A.add(i)
B=set()
for j in range(1,b+1):
    if b%j==0:
        B.add(j)
ans=A & B
ans2=list(ans)
ans3=sorted(ans2, reverse=True)
#print(ans3)
print(ans3[k-1])

Buggy submission (verdict: Runtime Error):
import math

a,b,k=map(int,input().split())

n=math.gcd(a,b)
ans=[]
for i in range(1,n+1):
    if n%int(i)==0:
        ans.append(i)

ans1=ans[::-1]

print(ans1[k-1])

Buggy submission (verdict: Runtime Error):
import math

a,b,k=map(int,input().split())

n=math.gcd(a,b)
ans=[]
for i in range(1,n+1):
    if n%int(i)==0:
        ans.append(i)

ans1=ans[::-1]

print(ans1[k-1])
Problem p03109 (python)

Fixed submission:
ymd=input().split("/")
m=["01","02","03","04"]
if ymd[1] in m:
    print("Heisei")
else:
    print("TBD")

Buggy submission (verdict: Runtime Error):
print("Heisei" if input()<="2019/04/30" and"TBD")
Problem p03110 (python)

Fixed submission:
n=int(input( ))
amt=0
for i in range(n):
    x,y =input().split()
    if y=="JPY":
        amt+=float(x)
    else:
        amt+=float(x)*380000.0
print(amt)

Buggy submission (verdict: Runtime Error):
n=int(input(n))
amt=0
for i in range(n):
  x,y =input().split()
  if y=="JPY":
    amt+=float(x)
  else:
    amt+=float(x)*380000.0
print(amt)
Problem p03238 (python)

Fixed submission:
n=int(input())

print("Hello World" if n==1 else int(input())+int(input()))

Buggy submission (verdict: Runtime Error):
n=int(input())
print("Hello World" if n==1 else int(input())+int(input())

Buggy submission (verdict: Runtime Error):
n=int(input())
a=int(input())
b=int(input())
print("Hello World" if n==1 else a+b)

Buggy submission (verdict: Runtime Error):
n=int(input())
print("Hello World" if n==1 else a+b)
Problem p03243 (python)

Fixed submission:
n=int(input())
if n%111==0:
    print(n)
else:
    print(-((-n)//111)*111)

Buggy submission (verdict: Runtime Error):
n=int(input())
l=[111,222,333,444,555,666,777,888,999]
ans=[]
for i in range(8):
    if l[i]-n>=0:
        ans.append(i)
        
print(l[ans[0]])
Problem p03359 (python)

Fixed submission:
a,b =map(int,input().split())
print(a if b>=a else a-1)

Buggy submission (verdict: Runtime Error):
x,y=map(int,input.split())
print(x if x>=y else x-1)
Problem p03474 (python)

Fixed submission:
a,b=map(int,input().split())
#print(ab)
x=input()
#print(x)
x1=x[:a]
x2=x[a]
x3=x[a+1:a+b+1]
#print(x1)
#print(x2)
#print(x3)


if x2=="-" and  (all(x1[i] in ["0","1","2","3","4","5","6","7","8","9"] for i in range(a))) and (all(x3[j] in ["0","1","2","3","4","5","6","7","8","9"]   for j in range(b))):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
#print(ab)
x=input()
#print(x)
x1=x[:a]
x2=x[a]
x3=x[a+1:a+b+1]
if x2=="-" and  all(int(x1[i])>=0 and int(x1[i])<=9 for i in range(a)) and all(int(x3[j])>=0 and int(x3[j])<=9 for j in range(b)):
    print("Yes")
else:
    print("No")
Problem p03547 (python)

Fixed submission:
x,y=input().split()
print("=" if x==y else ">" if x>y else "<")

Buggy submission (verdict: Runtime Error):
x,y=map(int,input().split())
print("=" if x==y else ">" if x>y else "<")
Problem p03643 (python)

Fixed submission:
print("ABC"+input())

Buggy submission (verdict: Runtime Error):
print("ABC"+str(input())
Problem p03729 (python)

Fixed submission:
x,y,z=input().split()
print("YES" if x[-1]==y[0] and y[-1]==z[0] else "NO")

Buggy submission (verdict: Runtime Error):
x,y,z=input(),split()
print("YES" if x[-1]==y[0] and y[-1]==z[0] else "NO")
Problem p04011 (python)

Fixed submission:
n,k,x,y=(int(input()) for i in range(4))
if n>=k:
    c=k*x+(n-k)*y
else:
    c=n*x
print(c)

Buggy submission (verdict: Runtime Error):
n,k,x,y=(int(input())for i in range(4)
if k>=n:
         c=n*x+(k-n)*y
else:
         c=n*x
print(c)
Problem p02642 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
m = max(a)
y = [0] * (m + 1)
for i in a:
    x = i
    while x <= m:
        y[x] += 1
        x += i
ans = 0
for j in a:
    if y[j] == 1:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a = list(set(a))
a.sort()
ans = 0
if len(a) == 1:
    print(0)
else:
    for _ in range(n):
        m = a.pop()
        ind = True
        for i in a:
            if m % i == 0:
                ind = False
                break
        if ind:
            ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a = list(set(a))
a.sort()
ans = 0
if len(a) == 1:
    print(0)
else:
    for _ in range(n):
        m = a.pop()
        ind = True
        print(a)
        for i in a:
            if m % i == 0:
                ind = False
                break
        if ind:
            ans += 1
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a.sort()
a = list(set(a))
ans = 0
if len(a) == 1:
    print(0)
else:
    for _ in range(n):
        m = a.pop()
        ind = True
        for i in a:
            if m % i == 0:
                ind = False
                break
        if ind:
            ans += 1
    print(ans)
Problem p02678 (python)

Fixed submission:
from collections import deque
n, m = map(int, input().split())
d = [[] for _ in range(n+1)]
ans = [0] * (n)
for _ in range(m):
    a, b = map(int, input().split())
    d[a].append(b)
    d[b].append(a)

q = deque([1])
while not len(q) == 0:
    x = q.popleft()
    for i in d[x]:
        if ans[i-1] == 0:
            ans[i-1] = x
            q.append(i)

if 0 in ans:
    print('No')
else:
    print('Yes')
    s  = "\n".join(map(str, ans[1:]))
    print(s)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
d = {}
ans = [0] * (n)
for _ in range(m):
    a, b = map(int, input().split())
    if not a in d.keys():
        d[a] = [b]
    elif not b in d[a]:
        d[a].append(b)
    if not b in d.keys():
        d[b] = [a]
    elif not a in d[b]:
        d[b].append(a)

q = deque([1])
while not len(q) == 0:
    x = q.popleft()
    for i in d[x]:
        if ans[i-1] == 0:
            ans[i-1] = x
            q.append(i)

if 0 in ans:
    print('No')
else:
    print('Yes')
    for j in ans[1:]:
        print(j)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
d = {}
ans = [0] * (n-1)
for _ in range(m):
    a, b = map(int, input().split())
    if not a in d.keys():
        d[a] = [b]
    else:
        d[a].append(b)
    if not b in d.keys():
        d[b] = [a]
    else:
        d[b].append(a)
    if a == 1:
        ans[b-2] = 1
    if b == 1:
        ans[a-2] = 1

def f(c, t, alr):
    global d
    if t in alr:
        return float("INF")
    if t in d[1]:
        return c
    alr.append(t)
    for tt in d[t]:
        return f(c+1, tt, alr)

for i in range(2, n+1):
    a = float("INF")
    s = -1
    for j in d[i]:
        cost = f(1, j, [])
        if not a == min(a, cost):
            a = cost
            s = j
    if a == float("INF"):
        ans['No']
        break
    ans[i-2] = s
    
if ans[0] == 'No':
    print(ans[0])
else:
    print('Yes')
    for an in ans:
        print(an)
Problem p02796 (python)

Fixed submission:
n = int(input())
scope = []
for _ in range(n):
    x, l = map(int, input().split())
    scope.append([x+l, x-l])
    
scope.sort()
ans = 1
border = scope[0][0]
for i, r in enumerate(scope[1:]):
    if border <= r[1]:
        ans += 1
        border = r[0]
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
xls = []
end = 0
for _ in range(n):
    x, l = map(int, input().split())
    end = max(end, x+l)
    xls.append([x-l, x+l])
    
line = np.zeros(end+1)
ans = 0
for i in xls:
    start = i[0]
    if start <= 0:
        start = 0
    line[start:i[1]-1] += 1
    if np.amax(line[start:i[1]]) <= 1:
        ans += 1
    else:
        line[start:i[1]] -= 1

print(ans)
Problem p02797 (python)

Fixed submission:
n, k, s = map(int, input().split())
o = 10 ** 9
ans = []
if s == 10 ** 9:
    o = 1

for _ in range(k):
    ans.append(s)
for _ in range(n-k):
    ans.append(o)
    
print(' '.join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
n, k, s = map(int, input().split())
o = 10 ** 9
ans = []
if s == 10 ** 9:
    o = 1

for _ in range(k):
    ans.append(s)
for _ in range(n-k):
    ans.append(o)
    
print(''.join(ans))
Problem p02909 (python)

Fixed submission:
s = input()
w = {'Sunny':'Cloudy', 'Cloudy':'Rainy', 'Rainy':'Sunny'}
print(w[s])

Buggy submission (verdict: Runtime Error):
import bisect
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
for i in range(m):
    tmp_max = a.pop()
    bisect.insort(a, tmp_max // 2)
print(sum(a))