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

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

Buggy submission (verdict: Runtime Error):
x,y,z = sorted(map(int, input().split()))
print((b-a)+(c-b))
Problem p03471 (python)

Fixed submission:
n, yen = map(int, input().split())
yen //= 1000

for noguchi in range(n + 1):
    for higuchi in range(n + 1 - noguchi):
        yukichi = n - noguchi - higuchi
        if noguchi + higuchi * 5 + yukichi * 10 == yen:
            print(yukichi, higuchi, noguchi)
            exit(0)
print("-1 -1 -1")

Buggy submission (verdict: Runtime Error):
for noguchi in range(n + 1):
    for higuchi in range(n + 1 - noguchi):
        yukichi = n - noguchi - higuchi
        if noguchi + higuchi * 5 + yukichi * 10 == yen:
            print(yukichi, higuchi, noguchi)
            exit(0)
print("-1 -1 -1")
Problem p03777 (python)

Fixed submission:
a, b= map(str, input().split())
if a=="H":
    print(b)
else:
    if b == "H":
        print("D")
    if b == "D":
        print("H")

Buggy submission (verdict: Runtime Error):
a, b= map(str, input().split())
if a=="H":
    print(b)
else:
    if b = "H":
        print("D")
    if b = "D":
        print("H")
Problem p02658 (python)

Fixed submission:
def main():
    N = int(input())
    A = list(map(int, input().split()))
    SUM = 1

    if 0 in A:
        print(0)
        return

    for a in A:
        SUM = SUM * a
        if SUM > 1000000000000000000:
            print(-1)
            return

    print(SUM)
main()

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

if 0 in A:
    print(0)
    return

for a in A:
    SUM = SUM * a
    if SUM > 1000000000000000000:
        print(-1)
        return

    print(SUM)

main()
Problem p02583 (python)

Fixed submission:
N=int(input())
L=list(map(int,input().split()))
count=0
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]<(L[b]+L[c]) and L[b]<(L[a]+L[c]) and L[c]<(L[b]+L[a]) and L[a]!=L[b] and L[a]!=L[c] and L[c]!=L[b] and a<b<c:
                count=count+1
            else:
                continue
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
L=map(int,input().split())
count=0
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]<(L[b]+L[c]) and L[b]<(L[a]+L[c]) and L[c]<(L[b]+L[a]) and a!=b and b!=c and c!=a:
                count=count+1
            else:
                continue
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
L=list(map(int,input().split()))
count=0
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]),a!=b, b!=c, c!=a:
                count=count+1
            else:
                continue
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
L=list(map(int,input().split()))
count=0
a!=b, b!=c, c!=a
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]):
                count=count+1
            else:
                continue
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
L=list(map(int,input().split()))
count=0
0<=a<=N-1,0<=b<=N-1,0<=c<=N-1,a!=b, b!=c, c!=a
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]):
                count=count+1
            else:
                continue
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
L=list(map(int,input().split()))
count=0
0<=a<=N,0<=b<=N,0<=c<=N
for a in range(N):
    for b in range(N):
        for c in range(N):
            if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]) a!=b, b!=c, c!=a:
                count=count+1
            else:
                continue
print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
L=list(map(int,input().split()))
count=0
0<=a<=N,0<=b<=N,0<=c<=N
for a in range(N):
    for b in range(N)
        for c in range(N)
        if L[a]>(L[b]+L[c]),L[b]>(L[a]+L[c]),L[c]>(L[b]+L[a]) a!=b, b!=c, c!=a:
            count=count+1
        else:
            continue
print(count)
Problem p02639 (python)

Fixed submission:
x=list(map(int,input().split()))
for k in range(5):
    if x[k]==0:
        print(k+1)
    else:
        continue

Buggy submission (verdict: Runtime Error):
x=list(map(int,input().split()))
for k in range(5)
    if x[k]==0:
        print(k+1)
    else:
        continue

Buggy submission (verdict: Runtime Error):
x=list(map(int,input().split()))
for k in range(5)
    if x[k]=0:
        print(k)
    else:
        continue

Buggy submission (verdict: Runtime Error):
x=list(map(int,input().split()))
for k in range(5)
    if x[k]==0:
        print(k)
        exit()
    else:
        continue
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
p_list = list(map(int, input().split()))

if N == 0: 
   print(X)
else:
   for i in range(0,100):
       if not X-i in p_list:
           print(X-i)
           break
       elif not X+i in p_list:
           print(X+i)
           break

Buggy submission (verdict: Runtime Error):
X,N=map(int, input().split())
p=list(map(int,input().split()))   
if N==0:
    print(X)
else:
    for k in range(0,58):
        if not X-k in p:
            print(X-k)
            break 
        elif not X+k in p_list:
            print(X+k)
            break

Buggy submission (verdict: Runtime Error):
X,N=map(int, input().split())
p=list(map(int,input().split()))   
if N==0:
    print(X)
else:
    for k in range(0,51):
        if not X-k in p:
            print(X-k)
            break 
        elif not X+k in p_list:
            print(X+k)
            break

Buggy submission (verdict: Runtime Error):
X,N=map(int, input().split())
p=list(map(int,input().split()))
p.sort()    
if N==0:
    print(X)
else:
    for k in range(0,51):
        if not X-k in p:
            print(X-k)
            break 
        elif not X+k in p_list:
            print(X+k)
            break

Buggy submission (verdict: Runtime Error):
X,N=map(int, input().split())
p=list(map(int,input().split()))
p.sort()    
for k in range(0,51):
    if not X-k in p:
        print(X-k)
        break 
    elif not X+k in p_list:
        print(X+k)
        break

Buggy submission (verdict: Runtime Error):
X,N=map(int, input().split())
p=list(map(int,input().split()))
p.sort()    
for k in range(0,51):
    if not X-k in p:
        print(X-k)
        break 
    elif not X+i in p_list:
        print(X+i)
        break
Problem p02675 (python)

Fixed submission:
N=input()
if N[-1]=="3":
    print ("bon")
elif N[-1]=="0" or N[-1]=="8" or N[-1]=="6" or N[-1]=="1":
    print("pon")
else:
    print("hon")

Buggy submission (verdict: Runtime Error):
N=input()
if N[-1]==3:
    print ("bon")
elif N[-1]==0 or N[-1]==8 or N[-1]==6 or [n-1]==1:
    print("pon")
else:
    print("hon")

Buggy submission (verdict: Runtime Error):
N=input()
if s[-1]==3:
    print ("bon")
elif s[-1]==0 or s[-1]==8 or s[-1]==6 or s[-1]==1:
    print("pon")
else:
    print("hon")
Problem p03680 (python)

Fixed submission:
def input_int():
    return(int(input()))

def input_int_list():
    return(list(map(int,input().split())))

def input_int_map():
    return(map(int,input().split()))

def run():
    num_count = input_int()
    nums = []
    for _ in range(num_count):
        nums.append(input_int())

    num_count = 1

    current_num = 1
    while True:
        current_num = nums[current_num - 1]

        if num_count >= len(nums):
            print(-1)
            return

        if current_num == 2:
            print(num_count)
            return
        num_count += 1

run()

Buggy submission (verdict: Runtime Error):
def input_int():
    return(int(input()))

def input_int_list():
    return(list(map(int,input().split())))

def input_int_map():
    return(map(int,input().split()))

def run():
    num_count = input_int()
    nums = []
    for _ in range(num_count):
        nums.append(input_int())

    num_history = set(1)

    current_num = 1
    while True:
        current_num = nums[current_num - 1]

        if current_num == 1:
            print(-1)
            return

        if current_num == 2:
            print(len(num_history))
            return

        num_history.add(current_num)

run()
Problem p03238 (python)

Fixed submission:
n = input()
n = int(n)

if n == 1:
  print ("Hello World")
else:
  a = input()
  b = input()
  a = int(a)
  b = int(b)
  c = a + b
  print (c)

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

if n == 1:
  print ("Hello World")
else:
  a = input()
  b = input()
  a = int(a)
  b = int(b)
  c = a + b
  print (c)
Problem p02613 (python)

Fixed submission:
n = int(input())
s = [input() for i in range(n)]

AC = s.count("AC")
WA = s.count("WA")
TLE = s.count("TLE")
RE = s.count("RE")

AC2 = "AC x " + str(AC)
WA2 = "WA x " + str(WA)
TLE2 = "TLE x " + str(TLE)
RE2 = "RE x " + str(RE)

list = [AC2,WA2,TLE2,RE2]
list_n = "\n".join(list)
print(list_n)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]

AC = s.count("AC")
WA = s.count("WA")
TLE = s.count("TLE")
RE = s.count("RE")

AC2 = "AC x " + str(AC)
WA2 = "WA x " + str(WA)
TLE2 = "TLE x " + str(TLE)
RE2 = "RE x " + str(RE)
x
list = [AC2,WA2,TLE2,RE2]
list_n = "\n".join(list)
print(list_n)
Problem p02639 (python)

Fixed submission:
x = [int(i) for i in input().split()]
print(x.index(0) + 1)

Buggy submission (verdict: Runtime Error):
a, b, c, d, e = map(int, input().split())
if a = 0:
	print("1")
elif b = 0:
	print("2")
elif c = 0:
	print("3")
elif d = 0:
	print("4")
else:
	print("5")

Buggy submission (verdict: Runtime Error):
a, b, c, d, e = map(int,input().split())
if a = 0:
　　　　print(‘1’)
elif b = 0:
　　　　print(‘2’)
elif c = 0:
　　　　print(‘3’)
elif d = 0:
　　　　print(‘4’)
else: 
　　　　print('5')
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
print("Yes" if s == t[:-1] else "No")

Buggy submission (verdict: Runtime Error):
s, t = input().split()
print("Yes" if s == t[:-1] else "No")

Buggy submission (verdict: Runtime Error):
s, t = input().split()
print("Yes" if s == t[:-1] else "No")
Problem p02607 (python)

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

count = 0

for i in range(1,N+1):
  if (i%2 == 1) and (s[i-1]%2 == 1):
    count = count + 1
 

print(count)

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

count = 0

for i in range(N+1):
  if ((i+1)%2 == 1) and (s[i]%2 == 1):
    count = count + 1

print(count)
Problem p02675 (python)

Fixed submission:
n = int(input()) 
en = str(n)
if (en[-1:]=="2" or en[-1:]=="4" or en[-1:]=="5" or en[-1:]=="7" or en[-1:]=="9"):
	print("hon")
elif (en[-1:]=="0" or en[-1:]=="1" or en[-1:]=="6" or en[-1:]=="8"):
	print("pon")
else:
	print("bon")

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()

if len(s)<=k:
	print(s)

else:
	print(s[0:k] + "...")

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()

if len(s)<=k:
	print(s)

else:
	print(s[0:k] + "…")

Buggy submission (verdict: Runtime Error):
k = int(input())
s = input()

if len(s)<=k:
	print(s)

else:
	print(s[0:k] + "...")
Problem p02981 (python)

Fixed submission:
import numpy as np
N,A,B=map(int,input().split())
if N*A > B:
  print(B)
else:
  print(N*A)

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

def kansuu(N,A,B):
	if N*A>B:
	  return B
	else:
 	  return NA

Buggy submission (verdict: Runtime Error):
N = input()
A = input()
B = input()
if NA > B:
  return B
else:
  return NA
Problem p02548 (python)

Fixed submission:
N = int(input())
ans = 0
for A in range(1,N):
  ans += (N-1) // A
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
count = 0
for X in range(N):
    for i in range(1, int(X**0.5)+1):
        if X % i == 0:
            count += 1
            if i != X // i:
                count += 1
  print(count)
Problem p02582 (python)

Fixed submission:
N = input()
if N == "RRR":
  print(3)
elif N == "SSS":
  print(0)
elif N == "SRR":
  print(2)
elif N == "RRS":
  print(2)  
else:
  print(1)

Buggy submission (verdict: Runtime Error):
N = input()
for i in range(1,4):
  p = "R"*i
  if p in N:
    ans = i
print(ans)
Problem p02694 (python)

Fixed submission:
X = int(input())

count = 0
save = 100

while save < X:
  save += save // 100
  count += 1
  
print(count)

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

count = 0
save = 100

while save < X:
  save += a / 100
  save = int(save)
  count += 1
  
print(count)
Problem p02760 (python)

Fixed submission:
array = [ list(map(int,input().split())) for _ in range(3) ]
number = []
N = int(input())
for _ in range(N):
  number += [ int(input()) ]
for i in range(3):
  for t in range(3):
    if array[i][t] in number:
      array[i][t] = 0
for i in range(1):
  if array[i][0] == array[i+1][0] == array[i+2][0]:
    print('Yes')
    exit()
  elif array[i][1] == array[i+1][1] == array[i+2][1]:
    print('Yes')
    exit()
  elif array[i][2] == array[i+1][2] == array[i+2][2]:
    print('Yes')
    exit()
  elif array[i][0] == array[i][1] == array[i][2]: 
    print('Yes')
    exit()
  elif array[i+1][0] == array[i+1][1] == array[i+1][2]:
    print('Yes')
    exit()
  elif array[i+2][0] == array[i+2][1] == array[i+2][2]:
    print('Yes')
    exit()
    
if array[0][0] == array[1][1] == array[2][2] or array[0][2] == array[1][1] == array[2][0]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
for _ in range(N):
  number += [ int(input()) ]
for i in range(3):
  for t in range(3):
    if array[i][t] in number:
      array[i][t] = 0
for i in range(1):
  if array[i][0] == array[i+1][0] == array[i+2][0]:
    print('Yes')
    exit()
  elif array[i][1] == array[i+1][1] == array[i+2][1]:
    print('Yes')
    exit()
  elif array[i][2] == array[i+1][2] == array[i+2][2]:
    print('Yes')
    exit()
  elif array[i][0] == array[i][1] == array[i][2]: 
    print('Yes')
    exit()
  elif array[i+1][0] == array[i+1][1] == array[i+1][2]:
    print('Yes')
    exit()
  elif array[i+2][0] == array[i+2][1] == array[i+2][2]:
    print('Yes')
    exit()
    
if array[0][0] == array[1][1] == array[2][2] or array[0][2] == array[1][1] == array[2][0]:
  print('Yes')
else:
  print('No')
Problem p02603 (python)

Fixed submission:
n=int(input())
#n,k=map(int,input().split())
v=list(map(int,input().split()))
l=list()
prev=0
for i in v:
  if prev!=i:
    l.append(i)
    prev=i
n=len(l)
if n==1:
  print(1000)
else: 
  d=list()
  if l[0]>l[1]:
      d.append(l[0])
  if l[0]<l[1]:
      d.append(l[0])
  for i in range(1,n-1):
    if l[i-1]<l[i] and l[i+1]<l[i]:
      d.append(l[i])
    if l[i-1]>l[i] and l[i+1]>l[i]:
      d.append(l[i])
  if l[-1]>l[-2]:
      d.append(l[-1])
  if l[-1]<l[-2]:
      d.append(l[-1])
  #print(d)
  n=len(d)
  p=1000
  if n>1:
    i=1
    while(i<n):
      if d[i-1]<d[i]:
        z=(p//d[i-1])*d[i]
        r=p%d[i-1]
        i+=2
        if z+r>p:
        	p=z+r
      else:
        i+=1
    print(p)
  else:
    print(p)

Buggy submission (verdict: Runtime Error):
n=int(input())
#n,k=map(int,input().split())
v=list(map(int,input().split()))
l=list()
for i in v:
  if i not in l:
    l.append(i)
n=len(l)
d=list()
if l[0]>l[1]:
    d.append(l[0])
if l[0]<l[1]:
    d.append(l[0])
for i in range(1,n-1):
  if l[i-1]<l[i] and l[i+1]<l[i]:
    d.append(l[i])
  if l[i-1]>l[i] and l[i+1]>l[i]:
    d.append(l[i])
if l[-1]>l[-2]:
    d.append(l[-1])
if l[-1]<l[-2]:
    d.append(l[-1])
#print(d)
n=len(d)
p=1000
for i in range(1,n):
  if l[i-1]<l[i]:
    z=(p//l[i-1])*l[i]
    r=p%l[i-1]
    p=z+r
print(p)
Problem p02657 (python)

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

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

Fixed submission:
n=int(input())
r=n%10
if(r==3):
  print('bon')
elif(r==0 or r==1 or r==6 or r==8):
  print('pon')
else:
  print('hon')

Buggy submission (verdict: Runtime Error):
n=int(input())
r=n%10
if(r==3):
  print('bon')
elif(r==0 or r==1 or r==6 or r=8):
  print('pon')
else:
  print('hon')
Problem p02576 (python)

Fixed submission:
N,X,T = map(int,input().split())

a=N//X
if a != N/X:
    
    print((a+1)*T)
else:
    print(a*T)

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

a=N//X

print((a+1)＊T)
Problem p02700 (python)

Fixed submission:
list = list(map(int, input().split()))
A = list[0]
B = list[1]
C = list[2]
D = list[3]

while A > 0 and B >0:
    C = C - B
    if C <= 0:break
    A = A - D

if A > 0: print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
list = list(map(int, input().split()))
A = list[0]
B = list[1]
C = list[2]
D = list[3]

while A > 0 and B >0:
    C = C - B
    if C =< 0:break
    A = A - D

if A > 0: print("Yes")
else: print("No")
Problem p02705 (python)

Fixed submission:
R = int(input())
import math
print(2 * math.pi * R)

Buggy submission (verdict: Runtime Error):
R = input()
import math
print(2 * math.pi * R)
Problem p02706 (python)

Fixed submission:
N,M = map(int,input().split())
day_list = input().split()

t = 0

for A in day_list:
    t += int(A)

if N - t < 0: print(-1)
else: print(N - t)

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

t = 0

for A in day_list:
    t += A

if N - t < 0: print(-1)
else: print(N - t)
Problem p02708 (python)

Fixed submission:
list = input().split()
N = int(list[0])
K = int(list[1])
i = K
s = 0

def sum(a,b):
    i=0
    i = (a + b)*(b - a + 1)/2
    return i

while i <= N + 1:
    #print(sum(N-i+1,N) + sum(0,i-1))
    s = s + sum(N-i+1,N) - sum(0,i-1) + 1
    i += 1
print(int(s % (10**9+7)))

Buggy submission (verdict: Runtime Error):
list = input().split()
N = list[0]
K = list[1]
i = K
s = 0

def sum(a,b):
    i=0
    for p in range (b-a+1):
        i += a + p
    return i

for i =< N + 1:
    s = s + sum(N-i+1,N) - sum(0,i-1)
    i += 1
print(s)

Buggy submission (verdict: Runtime Error):
list = input().split()
N = list[0]
K = list[1]
i = K
s = 0

def sum(a,b):
    i=0
    for p in range(b-a+1):
        i+= a + p
    return i

print(sum(1,5))

for i =< N + 1:
    s += sum(N-i+1,N) - sum(0,i-1)
    i += 1
print(s)

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

def sum(a,b):
    i=0
    for p in range(b-a+1):
        i+= a + p
    return i

print(sum(1,5))

for i =< N + 1:
    s += sum(N-i+1,N) - sum(0,i-1)
    i += 1
print(s)
Problem p02621 (python)

Fixed submission:
a = int(input())
sum = int(a + a * a + a * a * a)
print(sum)

Buggy submission (verdict: Runtime Error):
 a = int(input())
 sum = int(a + a * a + a * a * a)
 print(sum)
Problem p02630 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = [0] * q
c = [0] * q
ans = sum(a)
number = [0] * 100001
for i in range(q):
    b[i],c[i] = map(int,input().split())

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

for i in range(q):
    if number[b[i]] > 0:
        ans += (c[i] - b[i]) * number[b[i]]
        number[c[i]] += number[b[i]]    
        number[b[i]] = 0
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = [0] * q
c = [0] * q
ans = sum(a)
number = [0] * 100000
for i in range(q):
    b[i],c[i] = map(int,input().split())
for i in range(n):
    number[a[i]] += 1
for i in range(q):
    if number[b[i]] > 0:
        ans += (c[i] - b[i]) * number[b[i]]
        number[c[i]] = number[b[i]]    
        number[b[i]] = 0
    print(ans)
Problem p02642 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
amax = max(a)
ans = 0
numlist = [0] * amax

for i in range(n):
    if numlist[a[i]-1] != 0:
        numlist[a[i]-1] = 2
        continue
    else:
        for j in range(1, amax // a[i] + 1):
            numlist[a[i] * j - 1] += 1
for i in range(n):
    if numlist[a[i]-1] == 1:
        ans += 1
        
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
spl = [[] for i in range(n)]
ans = 0
check = [0] * n

for i in range(n):
    kakunin = a.copy()
    kakunin.remove(a[i])
    
    p = min(int(a[i] ** 0.5), max(kakunin))
    for j in range(1, p + 1):
        if a[i] % j == 0:
            spl[i].append(j)
            if  j != a[i] // j and j != 1:
                spl[i].append(a[i] // j)
for i in range(n):
    if any(spl[i][j] in a for j in range(len(spl[i]))):
        pass
    else:
        ans += 1
        check[i] = 1
for i in range(n):
    list = a
    if check[i] == 1 and a.count(a[i]) > 1:
        ans -= 1
print(ans)
Problem p02675 (python)

Fixed submission:
n=list(input())
if n[len(n)-1]=="3":
  print("bon")
elif n[len(n)-1]=="0" or n[len(n)-1]=="1" or n[len(n)-1]=="6" or n[len(n)-1]=="8":
  print("pon")
else:
  print("hon")

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[list(map(int,input().split())) for i in range(m)]
ikeruheya = [[] for i in range(n)]
ans = [0]*n

ans[0]=1

for i in range(m):
    ikeruheya[a[i][0]-1].append(a[i][1])
    ikeruheya[a[i][1]-1].append(a[i][0])


next=[1]

while len(next):
    imaheya = next.pop(0)-1
    for j in range(len(ikeruheya[imaheya])):
        if ans[ikeruheya[imaheya][j]-1]==0:
            ans[ikeruheya[imaheya][j]-1]= imaheya + 1           
            next.append(ikeruheya[imaheya][j])
            #ikeruheya[[imaheya-1][j]-1].remove(imaheya)
        

print("Yes")
for i in range(1, n):
    print(ans[i])


#b=ikeruheya
#michi=ans
#heya=next
#now=imaheya-1
Problem p02696 (python)

Fixed submission:
a,b,n=map(int,input().split())
c=max(0,a//b)
d=min(b,n)
def floor(x):
    return int((a*x)/b)-a*(int(x/b))
if n<b:
    print(floor(n))
elif n==b:
    print(floor(b-1))
else:
    if b<a:
        print(floor(b-1))
    elif b==a:
        print(floor(b))
    else:
        e=max(b-1,a//b)
        print(floor(e))

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
c=max(0,a//b)
d=min(b,n)
def floor(x):
    return int((a*x)/b)-a*(int(x/b))
if n<=b:
    print(floor(n))
else:
    if b<a:
        print(floor(b-1))
    elif b=a:
        print(floor(b))
    else:
        e=max(b-1,a//b)
        print(floor(e))
Problem p02718 (python)

Fixed submission:
N,M= map(int, input().split())
a = list(map(int,input().split()))
b = sorted(a,reverse = True)
total = 0
for i in range(len(b)):
  total += b[i]

if b[M-1]<total/(4*M):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N,M= map(int, input().split())
a = list(map(int,input().split()))
b = sorted(a,reverse = True)
total = 0
for i in range(len(b)):
  total += b[i]

if b[M]<total/(4*M):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N,M= map(int, input().split())
a = list(map(int,input().split()))
total = 0
for i in range(len(a)):
  total += a[i]

if a[M]<total/(4*M):
  print("No")
else:
  print("Yes")