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

Fixed submission:
X,K,D = map(int, input().split())
Ans = 0

if abs(X) >= K * D:
  if X >= 0:
    Ans = X - (K * D)
  else:
    Ans = abs(X + (K * D))
    
else:
  abX = abs(X)
#  if X >= 0:
  if (K - abX // D) % 2 == 0:
    Ans = abX - ((abX // D) * D)
  else:
    Ans = abs(abX - ((abX // D) * D) - D)
      
#  else:
#    print(abs(X // D))
#    if (K - abs(X // D)) % 2 == 0:
#      Ans = abs(X + (abs((X // D)) * D))
#    else:
#      Ans = abs(X + (abs((X // D)) * D) - D)
    
print(Ans)

Buggy submission (verdict: Runtime Error):
X,K,D = map(int, input().split())
Ans = 0

if abs(X) >= K * D:
  if X >= 0:
    Ans = X - (K * D)
  else:
    Ans = abs(X + (K * D))
    
else:
  abX = abs(X)
#  if X >= 0:
  if (K - abX // D) % 2 == 0:
      Ans = abX - ((abX // D) * D)
    else:
      Ans = abs(abX - ((abX // D) * D) - D)
      
#  else:
#    print(abs(X // D))
#    if (K - abs(X // D)) % 2 == 0:
#      Ans = abs(X + (abs((X // D)) * D))
#    else:
#      Ans = abs(X + (abs((X // D)) * D) - D)
    
print(Ans)
Problem p02608 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N = int(input())

Ans = 0
numlist = [0] * 10001

if int(float(N)**0.5) <= 1:
  rMax = 1
else:
  rMax = int(float(N)**0.5)  

for x in range(1,rMax+1):
  for y in range(1,rMax+1):
    for z in range(1,rMax+1):
      Ans = x**2 + y**2 + z**2 + (x * y) + (y * z) + (z * x)
      if Ans <= 10000:
        numlist[Ans] += 1
  
for r in range(1,N+1):
  print(numlist[r])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N = int(input())

Ans = 0
numlist = [0] * 10000

if int(float(N)**0.5) <= 1:
  rMax = 1
else:
  rMax = int(float(N)**0.5)  

for x in range(1,rMax+1):
  for y in range(1,rMax+1):
    for z in range(1,rMax+1):
      Ans = x**2 + y**2 + z**2 + (x * y) + (y * z) + (z * x)
      if Ans <= 10000:
        numlist[Ans] += 1
  
for r in range(1,N+1):
  print(numlist[r])

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
N = int(input())

Ans = 0
numlist = [0] * 10000

if int(float(N)**0.5) <= 1:
  rMax = 1
else:
  rMax = int(float(N)**0.5)  

for x in range(1,rMax+1):
  for y in range(1,rMax+1):
    for z in range(1,rMax+1):
      Ans = x**2 + y**2 + z**2 + (x * y) + (y * z) + (z * x)
      numlist[Ans] += 1
  
for r in range(1,N+1):
  print(numlist[r])
Problem p02717 (python)

Fixed submission:
X,Y,Z=map(int,input().split())

print(str(Z)+' '+str(X)+' '+str(Y))

Buggy submission (verdict: Runtime Error):
X,Y,Z=map(int,input())
print(str(Z)+' '+str(X)+' '+str(Y))
Problem p02718 (python)

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

A.sort(reverse=True)
if A[M-1]>=sum(A)/(4*M):
  print('Yes')
else:
  print('No')

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

A.sort(reverse=True)
if A[M]>=sum(A)/(4*M):
  print('Yes')
else:
  print('No')
Problem p02582 (python)

Fixed submission:
S= input()

if S.count('RRR') == 1:
    print(3)
elif S.count('RR') == 1:
    print(2)
elif S.count('RSR') == 1 or S.count('RSS') == 1 or S.count('SRS') == 1 or S.count('SSR') == 1:
    print(1)
else:
    print(0)

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

if S.count('RRR') == 1:
    print(3)
elif S.count('RR') == 1:
    print(2)
elif S.count('RSR') == 1 or S.count('RSS') == 1 or S.count('SRS') == 1 or S.count('SSR') == 1
    print(1)
else:
    print(0)
Problem p02630 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
B=[]
C=[]

for _ in range(Q):
    bi, ci = list(map(int, input().split()))
    B.append(bi)
    C.append(ci)

dic = {}
for i in A:
    dic[i] = dic.get(i,0) + 1

sum = sum(A)

for i in range(Q):
    sum += dic.get(B[i], 0) * (C[i] -B[i])
    dic[C[i]] = dic.get(C[i], 0) + dic.get(B[i], 0)
    dic[B[i]] = dic.get(B[i], 0)
    dic[B[i]] = 0
    print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
B=[]
C=[]

for _ in range(Q):
    bi, ci = list(map(int, input().split()))
    B.append(bi)
    C.append(ci)

dic = {}
for i in A:
    dic[i] = dic.get(i,0) + 1

sum = sum(A)

for i in range(Q):
    sum += dic[B[i]] * (C[i] -B[i])
    dic[C[i]] = dic.get(C[i], 0) + dic[B[i]]
    dic[B[i]] = 0
    print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
B=[]
C=[]

for _ in range(q):
    bi, ci = list(map(int, input().split()))
    B.append(bi)
    C.append(ci)

dic = {}
for i in A:
    dic[i] = dic.get(i,0) + 1

sum = sum(A)

for i in range(Q):
    sum += dic[B[i]] * (C[i] -B[i])
    dic[C[i]] += dic[B[i]]
    dic[B[i]] = 0
    print(sum)
Problem p02641 (python)

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

result = 0
if N == 0:
    result = X
else:
    list = [i for i in range(201)]
    for i in P:
        list.remove(i)
    if len(list) == 0:
        result = 0
    else:
        min = 100
        for i in list:
            if min > abs(X-i):
                min = abs(X - i)
                result = i
print(result)

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

result = 0
if N == 0:
    result = X
else:
    list = [i for i in range(101)]
    for i in P:
        list.remove(i)
    for i in range(len(list)):
        list[i] = abs(list[i] - X)
    list.sort()
    if list[0] == list[1]:
        result = X - list[0]
    else:
        result = X + list[0]
print(result)

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

result = 0
if N == 0:
    result = X
else:
    list = [i for i in range(-100,100)]
    for i in P:
        list.remove(i)
    min = 100
    for i in list:
        if min > abs(X-i):
            min = abs(X - i)
            result = i

print(result)
Problem p02640 (python)

Fixed submission:
x, y = map(int,input().split())
flag=False
for i in range(x+1):
  yi=2*i+4*(x-i)
  if y==yi:
    flag=True
    break
    
print("Yes") if flag else print("No")

Buggy submission (verdict: Runtime Error):
x, y = map(int,input().split())
flag=False
for i in range(x+1):
  yi=2*i+4(x-i)
  if y==yi:
    flag=True
    break
    
print("Yes") if flag else print("No")
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
if N!=0:
  p = list(map(int, input().split()))
else:
  p =[]

p = set(p)
i=0
while i<101:
  n = X-i
  if not(n in p):
    ans = n
    break
  n = X+i
  if not(n in p):
    ans = n
    break
  i+=1

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 0
A = sorted(A)
if N == 0:
  ans = 0
else:
  for i in range(len(A)-1,-1,-1):
    for j in range(0,i+1,1):
      if i==j:
        ans+=1
        if i==0 and A[0]==A[1]:
          ans-=1
        break
      if A[i]%A[j]==0:
        break
      if A[i]<A[j]*2:
        ans+=1
        break

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
ans = 0
A = sorted(A)
if N == 0:
  ans = 0
else:
  for i in range(len(A)-1,-1,-1):
    for j in range(0,i+1,1):
      if i==j:
        ans+=1
        if i==0 and A[0]==A[1]:
          ans-=1
        break
      if A[i]%A[j]==0:
        break
      if A[i]<A[j]*2:
        ans+=1
        break

print(ans)
Problem p02760 (python)

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

i = 0
while i<N:
  b = int(input())
  j=0
  while j<3:
    k=0
    while k<3:
      if A[j][k]==b:
        A[j][k]=0
      k+=1
    j+=1
  i+=1

flag = False
i = 0
while i<3:
  if A[i][0]+A[i][1]+A[i][2] == 0:
    flag = True
    break
  if A[0][i]+A[1][i]+A[2][i] == 0:
    flag = True
    break
  i += 1

if A[0][0]+A[1][1]+A[2][2] == 0:
  flag = True
if A[2][0]+A[1][1]+A[0][2] == 0:
  flag = True

if flag == True:
  print("Yes")
else:
    print("No")

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

i = 0
while i<N:
  b = int(input())
  j=0
  while j<3:
    k=0
    while k<3:
      if A[j][k]==b:
        A[j][k]=0
      k+=1
    j+=1
  i+=1

flag = False
i = 0
while i<3:
  if A[i][0]+A[i][1]+A[i][2] == 0:
    flag = True
    break
  if A[0][i]+A[1][i]+A[2][i] == 0:
    flag = True
    break
  i += 1

if A[0][0]+A[1][1]+A[2][2] == 0:
  flag = Trueå
if A[2][0]+A[1][1]+A[0][2] == 0:
  flag = True

if flag == True:
  print("Yes")
else:
    print("No")
Problem p02761 (python)

Fixed submission:
N, M = map(int, input().split())
A = ["x"]*N
for i in range(M):
  s, c = map(int, input().split())
  if A[s-1] == "x":
    A[s-1] = c
  elif A[s-1] != c:
    print(-1)
    exit()


if A[0]==0 and N>1:
  print(-1)
  exit()
elif N==1 and (A[0]=="x" or A[0] == 0):
  print(0)
  exit()
elif A[0]=="x" or A[0] == 0:
  A[0]=1

for i in range(1,N):
  if A[i]=="x":
    A[i]=0

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

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = [0]*N
for i in range(M):
  s, c = map(int, input().split())
  if A[s-1] == 0:
    A[s-1] = c
  elif A[s-1] != c:
    print(-1)
    exit()

if A[0]>0:
  ans = A[0]*100+A[1]*10+A[2]
else:
  ans = -1
  
print(ans)
Problem p02971 (python)

Fixed submission:
N = int(input())
A = [0]*N

for i in range(N):
  A[i] = int(input())

As = sorted(A, reverse=True)
M = As[0]
Ms = As[1]

for i in range(N):
  if M == A[i]:
    print(Ms)
  else:
    print(M)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0]*N

for i in range(N):
  A[i] = int(input())

  M = max(A)
for i in range(N):
  if M == A[i]:
    ans = max(max(A[0:i]),max(A[i+1:N]))
    print(ans)
  else:
    print(M)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0]*N

for i in range(N):
  A[i] = int(input())

for i in range(N):
  ans = max(A[0:i].extend(A[i+1:N]))
  print(ans)
Problem p03254 (python)

Fixed submission:
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans=0
for i in range(N):
  x = x-a[i]
  if x>=0:
    ans+=1
  else:
    break
if x>0:
  print(ans-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
N, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans=0
for i in range(N)
  x = x-a[i]
  if x>=0:
    ans+=1
  else:
    break
print(ans)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())

if len(S)>=K and S[:K] == "1"*K:
  print("1")
else:
  S = S.replace("1","")
  print(S[0])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
S = S.replace("1","")
print(S[0])
Problem p03386 (python)

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

for i in range(A,min([A+K+1,B+1]),1):
  if i<A+K:
    print(i)
    
for i in range(max([A+K, B-K-1]),B+1,1):
  if i>B-K:
    print(i)

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

ab = set(list(range(A,B+1,1)))
a = set(list(range(A,A+K,1)))&ab
b = set(list(range(B-K+1,B+1,1)))&ab
ans=list(a|b)
ans = sorted(ans)

if len(ansi)>0:
  for ansi in ans:
    print(ansi)

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

ab = set(list(range(A,B+1,1)))
a = set(list(range(A,A+K,1)))&ab
b = set(list(range(B-K+1,B+1,1)))&ab
ans=list(a|b)
ans = sorted(ans)

for ansi in ans:
  print(ansi)

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

ab = set(list(range(A,B+1,1)))
a = list(range(A,A+K,1))
b = list(range(B-K+1,B+1,1))
a.extend(b)
ans=a
ans = set(ans)
ans = list(ans&ab)
ans = sorted(ans)

for ansi in ans:
  print(ansi)
Problem p03545 (python)

Fixed submission:
s = input()
A = int(s[0])
B = int(s[1])
C = int(s[2])
D = int(s[3])

flag = [0]*3
tmp = 0
for i in range(8):
  flag[0]=(i>>2)&1
  flag[1]=(i>>1)&1
  flag[2]=(i)&1
  
  tmp = A +(-1)**flag[0]*B +(-1)**flag[1]*C +(-1)**flag[2]*D
  if tmp==7:
    ans=s[0]
    for j in range(3):
      if flag[j]:
        ans+="-"+s[j+1]
      else:
        ans+="+"+s[j+1]
    ans+="=7"
    print(ans)
    break

Buggy submission (verdict: Runtime Error):
s = input()
A = int(s[0])
B = int(s[1])
C = int(s[2])
D = int(s[3])

flag = [0]*3
tmp = 0
for i in range(8):
  flag[0]=(i>>2)&1
  flag[1]=(i>>1)&1
  flag[2]=(i)&1
  
  tmp = A +(-1)**flag[0]*B +(-1)**flag[0]*C +(-1)**flag[0]*D
  if tmp==7:
    ans=s[0]
    for j in range(3):
      if flag[i]:
        ans+="-"+s[i+1]
      else:
        ans+="+"+s[i+1]
    ans+="=7"
    print(ans)
    break
Problem p03639 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
c2=c4=0

for i in range(N):
  if a[i]%4==0:
    c4+=1
  if a[i]%2==0:
    c2+=1

nodd=N-c2
c2=c2-c4
if c2>0:
  nodd+=1
if c4>=nodd-1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
c2=c4=0

for i in range(len(N)):
  if a[i]%4==0:
    c4+=1
  if a[i]%2==0:
    c2+=1

nodd=N-c2
c4=c4-c2

if nodd<c4:
  print("Yes")
else:
  print("No")
Problem p03738 (python)

Fixed submission:
A = int(input())
B = int(input())

if A>B:
  print("GREATER")
elif A<B:
  print("LESS")
else:
  print("EQUAL")

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

if A>B:
  print("GREATER")
elif A<B:
  print("LESS")
else:
  print("EQUAL")

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

if A>B:
  print("GREATER")
elif A<B:
  print("LESS")
else:
  print("EQUAL")
Problem p02582 (python)

Fixed submission:

flag = True
count = 0
l = []

for s in input():
    if flag:
        if s == "R":
            count += 1
            l.append(count)
        else:
            l.append(0)
            count = 0


print(max(l))

Buggy submission (verdict: Runtime Error):

l = []

count = 0

for s in input():
    if s == "R":
        count += 1
    else:
        l.append(count)
        count = 0

print(max(l))

Buggy submission (verdict: Runtime Error):

l = []

count = 0


for s in input():
    if s == "R":
        count += 1
    else:
        l.append(count)
        count = 0

print(max(l))
Problem p02582 (python)

Fixed submission:
import re

S = input()

rrr = S.count("RRR")
rr = S.count("RR")
r = S.count("R")

if rrr == 1:
    print(3)
elif rr == 1:
    print(2)
elif r == 1 or r == 2:
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import heapq

N, K = map(int, input().split(" "))
 
Ps = list(map(int, input().split(" ")))
Cs = list(map(int, input().split(" ")))


max_points = []
heapq.heapify(max_points)
for start_point in range(1, N+1):
    flg = False
    C_point = 0
    max_point = []
    heapq.heapify(max_point)
    now_point = start_point
    for _ in range(K):
        next_point = Ps[now_point-1]
        C_point += Cs[next_point-1]
        
        heapq.heappush(max_point, -C_point)
#        max_point.append(C_point)
        now_point = next_point
    
        if next_point == start_point:
            flg = True
            l = _ + 1
            last_point = C_point
            break
        
    if flg:
#        print("l",l)
        q, r = divmod(K, l)
#        print(q,r)
        now_point = start_point
        C_point = 0
        for _ in range(r):
            next_point = Ps[now_point-1]
            C_point += Cs[next_point-1]
            ins = last_point * q + C_point
            heapq.heappush(max_point, -ins)
#            max_point.append(ins)
            
            now_point = next_point        
#    print("2nd", max_point)
    max_point_ = heapq.heappop(max_point)
    heapq.heappush(max_points, max_point_)
#    max_points.append(max(max_point))
    
print(-heapq.heappop(max_points))
#print(max(max_points))

Buggy submission (verdict: Runtime Error):
import heapq

N, K = map(int, input().split(" "))
 
Ps = list(map(int, input().split(" ")))
Cs = list(map(int, input().split(" ")))


max_points = []
heapq.heapify(max_points)
for now_point in range(2, N+1):
    max_point = -float('inf')
    C_point = 0
    max_point = []
    heapq.heapify(max_point)
    for _ in range(K):
        next_point = Ps[now_point-1]
        C_point += Cs[next_point-1]
        
        heapq.heappush(max_point, -C_point)
        now_point = next_point
    
    max_point_ = heapq.heappop(max_point)
    heapq.heappush(max_points, max_point_)
 
print(-heapq.heappop(max_points))
Problem p02639 (python)

Fixed submission:
lis=list(map(int,input().split()))
for i, x in enumerate(lis):
  if x == 0:
    a = i+1
print (a)

Buggy submission (verdict: Runtime Error):
lis=list(input().split( ))
 
for i,x in enumerate(lis):
  if x == 0:
    a = i
print a

Buggy submission (verdict: Runtime Error):
lis=list(input())

for i,x in enumerate(lis):
  if x == 0:
    a = i
print a
Problem p02724 (python)

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

Buggy submission (verdict: Runtime Error):
X = int(input())
a = X // 500
X -= a * 500
b = X // 5
print(a,b)
print(a*1000+5*
Problem p02885 (python)

Fixed submission:
A,B = map(int,input().split())
curtain_len = A-B*2
if curtain_len > 0:
  print(curtain_len)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
L = list(map(int,input().split()))
L.sort()
ans = 0
for i in range(N):
  for j in range(i+1,N):
      add_len = L[i]+L[j]
      idx = bisect.bisect_left(L, add_len)
      ans += max(0, idx-(j+1))
print(ans)
Problem p02886 (python)

Fixed submission:
N = int(input())
d = list(map(int,input().split()))
recovery_amount = 0 
for i in range(N):
  for j in range(i,N):
    if i == j:
      continue
    recovery_amount += d[i]*d[j]
print(recovery_amount)

Buggy submission (verdict: Runtime Error):
N = int(input())
d = map(int,input().split())
recovery_amount = 0 
for i in range(N):
  for j in range(N):
    if i == j:
      continue
    recovery_amount += d[i]*d[j]
print(recovery_amount)
Problem p02924 (python)

Fixed submission:
N = int(input())
print((N-1)*(1 + N-1) // 2)

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main(void){
    int N;
    int count = 0;
    cin >> N;
    cout << (int)(((N-1)*(1 + N-1))/2) << endl;
    return 0;
}

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
array = np.arange(N)
print(sum(array))
Problem p03068 (python)

Fixed submission:
N = int(input())
S = list(input())
K = int(input())
for i in range(N):
  if S[i] != S[K-1]:
    S[i] = "*"
print("".join(S))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = list(input())
K = int(input())
for i in range(N):
  if S[i] != S[K]:
    S[i] = "*"
print("".join(S))

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())
for i in range(N):
  if S[i] != S[K]:
    S[i] = "*"
print(S)
Problem p02582 (python)

Fixed submission:
a = input()
if "RRR" in a:
  print(3)
elif "RR" in a:
  print(2)
elif "R" in a:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a = input()
if "RRR" in a:
  print(3)
elif "RR" in a:
  print(2)
elif "R" in a:
  print(1)
else:a
  print(0)
Problem p02614 (python)

Fixed submission:
h, w, k = map(int, input().split())
X = [[1 if a == "#" else 0 for a in input()] for _ in range(h)]
ans = 0
for ii in range(1 << h):
  for jj in range(1 << w):
    if sum([sum([X[i][j] for j in range(w) if jj >> j & 1]) for i in range(h) if ii >> i & 1]) == k:
      ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
h, w, k = map(int, input().split())
X = [[1 if a == "#" else 0 for a in input()] for _ in range(H)
ans = 0
for ii in range(1 << h):
  for jj in range(1 << w):
    if sum([sum([X[i][j] for j in range(w) if jj >> j & 1]) for i in range(h) if ii >> i & 1]) == k:
      ans += 1
print(ans)
Problem p02678 (python)

Fixed submission:
import networkx as nx
n,m=map(int,input().split())
s=[list(map(int,input().split())) for i in range(m)]

g=nx.Graph()
g.add_edges_from(s)
di=nx.predecessor(g,source=1)

print("Yes")
for x in range(2,n+1):
      print(di[x][0])

Buggy submission (verdict: Runtime Error):
import networkx as nx
n,m=map(int,input().split())
s=[list(map(int,input().split())) for i in range(m)]

g=nx.Graph()
g.add_edges_from(s)
di=nx.predecessor(g,source=1)

print("Yes)
for x in range(2,n+1):
      print(di[x][0])
Problem p02690 (python)

Fixed submission:
import sys
X = int(input())
a = 1
b = 0
for a in range(1, 120):
  for b in range(-119, a):
    if pow(a, 5) - pow(b, 5) == X:
      print(a,b)
      sys.exit()

Buggy submission (verdict: Runtime Error):
import sys
X = int(inout())
a = 1
b = 0
for a in rangr(1, 120):
  for b in range(-119, a):
    if pow(a, 5) - pow(b, 5) == X:
      print(a,b)
      sys.exit()
Problem p02981 (python)

Fixed submission:
a = list(map(int,input().split()))
if a[0]*a[1]<=a[2]:
  print(a[0]*a[1])
else:
  print(a[2])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
if a[0]*a[1]<=a[2]:
  prnit(a[0]*a[1])
else:
  print(a[2])
Problem p03000 (python)

Fixed submission:
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 1
d = 0
for i in b:
  d += i
  if d <= a[1]:
    c += 1
print(c)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
d = 0
i = 0
while d <= a[1]:
  d += b[i]
  c += 1
  i += 1
print(c)
Problem p03043 (python)

Fixed submission:
n,k = map(int,input().strip().split())
c = 0
for i in range(1,n+1):
  if i>k:
    c+=1/n
  else:
    cnt=0
    while i<k:
      i*=2
      cnt+=1
    c+=1/n*(1/2)**cnt
print(c)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().strip().split())
c = 0
for i in range(1,n+1):
  if n>k:
    c+=1/n
  else:
    cnt=0
    while i<k:
      i*=2
      cnt+=1
    c+=1/N*(1/2)**cnt
print(c)
Problem p03219 (python)

Fixed submission:
a,b = map(int,input().split())
print(a+b//2)

Buggy submission (verdict: Runtime Error):
a,b = map(int(input().split()))
print(a+b//2)
Problem p02573 (python)

Fixed submission:
from sys import stdin,stdout
from collections import defaultdict
import sys
sys.setrecursionlimit(10**7)
# n=int(stdin.readline())
def dfs(src):
    global sz
    vis[src]=1
    sz+=1
    for neigh in g[src]:
        if not vis[neigh]:
            dfs(neigh)

n,eg=list(map(int,stdin.readline().split()))
g=defaultdict(list)
for i in range(eg):
    A,B=map(int,stdin.readline().split())
    g[A]+=[B]
    g[B]+=[A]
vis=[0]*(n+1);ans=0
for node in range(1,n+1):
    if not vis[node]:
        sz=0
        dfs(node)
        ans=max(ans,sz)
print(ans)

Buggy submission (verdict: Runtime Error):
from sys import stdin,stdout
from collections import defaultdict
# n=int(stdin.readline())
def dfs(src):
    global sz
    vis[src]=1
    sz+=1
    for neigh in g[src]:
        if not vis[neigh]:
            dfs(neigh)

n,eg=list(map(int,stdin.readline().split()))
g=defaultdict(list)
for i in range(eg):
    A,B=map(int,stdin.readline().split())
    g[A]+=[B]
    g[B]+=[A]
vis=[0]*(n+1);ans=0
for node in range(1,n+1):
    if not vis[node]:
        sz=0
        dfs(node)
        ans=max(ans,sz)
print(ans)
Problem p02584 (python)

Fixed submission:
from sys import stdin,stdout
for _ in range(1):#int(stdin.readline())):
    # n=int(stdin.readline())
    x,k,d=list(map(int,stdin.readline().split()))
    '''if x==k==d:
        print(0 if k&1 else x)
        continue'''
    x=abs(x)
    des=x%d
    op=x//d
    # print(des,op)
    a=[des,des-d]
    if k<op:#check for eq
        print(x-k*d)
    else:
        print(abs(a[(k-op)%2]))

Buggy submission (verdict: Runtime Error):
from sys import stdin,stdout
for _ in range(1):#int(stdin.readline())):
    # n=int(stdin.readline())
    x,k,d=list(map(int,stdin.readline().split()))
    if x==k==d:
        print(0 if k&1 else x)
        continue
    des=x%d
    op=x//d
    a=[des,des-d]
    if k<=op:#check for eq
        print(x-k*d)
    else:
        print(abs(a[k%op]))