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

Fixed submission:
import math
 
a = int(input())
oturi = math.ceil(a/1000)*1000-a
 
print(oturi)

Buggy submission (verdict: Runtime Error):
import math

a = input()
oturi = math.ceil(a/1000)*1000-a

print(oturi)
Problem p02628 (python)

Fixed submission:
n, k = map(int, input().split())
p = input()
x = p.split()
l = [int(s) for s in x]
shukei = 0

def shukei_def():
    global shukei
    if n == len(l):
        for i in range(k):
            shukei += min(l)
            l.remove(min(l))
        else:
            return

shukei_def()

print(shukei)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
p = input()
x = p.split()
l = int(x)

if n == len(l):
  pass
else:
  return

for i in range(k):
  shukei += min(l)
  l.remove(min(l))

print(shukei)
Problem p02639 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a, b, c, d, e = map(int, input().split())
 
suuji_list = ["", a, b, c, d, e]
 
print(suuji_list.index(0))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b, c, d, e = map(int, input().split())

suuji_list = ["", a, b, c, d, e]

print(list.index(0))
Problem p03455 (python)

Fixed submission:
A, B = map(int, input().split())
 
if (A*B) % 2 == 0:
  print('Even')
else:
  print('Odd')

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

if (A*B) % 2 == 0:
  print(Even)
else:
  print(Odd)
Problem p02612 (python)

Fixed submission:
n = int(input())
otsuri = 1000 - (n % 1000)
if otsuri == 1000:
  print(0)
else:
  print(otsuri)

Buggy submission (verdict: Runtime Error):
n = int(input())
otsuri = 1000 - (n % 1000)
if otsuri == 1000:
  print(0)
else:
  print(osturi)
Problem p02681 (python)

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

if (len(s) == len(t)-1) and (s == t[:len(t)-1]):
    print("Yes")
else:
    print('No')

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

xa = min(a,k)
k1 = k-xa
xb = min(b,k1)
k2 = k1-xb
xc = k2

print(xa-xc)
Problem p02899 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
for i,val in enumerate(a):
    b[val-1] = i + 1
print(*b)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(input().split())
b = [0]*n
for i,val in enumerate(a):
    b[val-1] = i + 1
print(*b)
Problem p02613 (python)

Fixed submission:
nums = int(input())

S = {'AC': 0, 'WA': 0, 'TLE': 0, 'RE': 0}

for i in range(0, nums):
    input_str = input()
    if input_str in S:
        S[input_str] += 1

print('AC x %d' % S['AC'])
print('WA x %d' % S['WA'])
print('TLE x %d' % S['TLE'])
print('RE x %d' % S['RE'])

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

S = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}

for i in nums:
  input_str = input()
  if input_str in S:
    S[input_str] += 1
    
print('AC x %d' % S['AC'])
print('WA x %d' % S['WA'])
print('TLE x %d' % S['TLE'])
print('RE x %d' % S['RE'])
Problem p02639 (python)

Fixed submission:
X=list(map(int,input().split()))
for i in range(5):
  if X[i]!=i+1:
    print(i+1);exit()

Buggy submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
A.sort()
max_a=A[-1]
dp=[True]*(max_a+1)
ans=0
for i in range(N):
  a=A[i]
  #print(a)
  if dp[a]==True: 
    if i==N-1:
      ans+=1
    elif a!=A[i+1]:
      ans+=1   
    k=a
    while k<=max_a:
      dp[k]=False    
      k+=a
print(ans)
Problem p02814 (python)

Fixed submission:
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
def kn(h):
  l=0
  while h%2==0:
    h=h//2
    l+=1
  return l
  
k=1
flag=kn(A[0]//2)
for a in A:
  a//=2
  k=lcm(k,a)
  if flag != kn(a):
    print(0);exit()
  
print(int(M//k//2+M//k%2))

Buggy submission (verdict: Runtime Error):
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
def kn(h):
  l=0
  while h%2==0:
    h=h//2
    l+=1
  return l
  
k=1
flag=kn(A[0])
for a in A:
  k=lcm(k,a)
  if flag != kn(a):
    print(0);exit()

k/=2
  
if k==1:
  k=3
print(int(M//k//2+M//k%2))

Buggy submission (verdict: Runtime Error):
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
def kn(h):
  l=0
  while h%2==0:
    h=h//2
    l+=1
  return l
  
k=1
flag=kn(A[0])
for a in A:
  k=lcm(k,a)
  if flag != kn(a):
    print(0);exit()

k/=2
  
if k<min(A):
  k*=2*1.5
print(int(M//k//2+M//k%2))

Buggy submission (verdict: Runtime Error):
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
k=1
for a in A:
  k=lcm(k,a)

k/=2
  
if k<min(A):
  k*=2*1.5
print(int(M//k//2+M//k%2))

Buggy submission (verdict: Runtime Error):
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
k=1
for a in A:
  k=lcm(k,a)
if k%2==0:
  k/=2
  
else:
  k*=1.5
print(int(M//k//2+M//k%2))

Buggy submission (verdict: Runtime Error):
import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
k=1
for a in A:
  k=lcm(k,a)
if k%2==0:
  k/=2

print(int(M//k//2+M//k%2))
Problem p02991 (python)

Fixed submission:
from collections import deque
n,m=map(int,input().split())
edge = [[] for i in range(n+1)]
#edge[i] : iから出る道の[行先]の配列
for _ in range(m):
    u, v = map(int, input().split())
    edge[u].append(v)
s,t = map(int, input().split())
queue = deque()
queue.append((s, 0))
visited = [[False] * 3 for _ in range(n+1)]
while queue:
    u, d = queue.popleft()
    if visited[u][d % 3]:
        continue
    visited[u][d % 3] = True
    if d % 3 == 0 and u == t:
        print(d // 3);exit()
    for v in edge[u]:
        queue.append((v, d+1))
print(-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
edge = [[] for i in range(n*3)]
#edge[i] : iから出る道の[行先]の配列
for i in range(m):
    x,y = map(int,input().split())
    x-=1;y-=1
    x*=3;y*=3
    edge[x  ].append(y+1)
    edge[x+1].append(y+2)
    edge[x+2].append(y  )
    
def dfs(s,g,res,visited):
  visited[s]=1
  if s==g or s==g+1 or s==g+2:
    if res%3==0:
      return res//3
  
  if 0 not in visited:
    return float("inf")
  
  l=float("inf")
  for i in edge[s]:
    if visited[i]==0:
      l=min(l,dfs(i,g,res+1,visited))
  return l

s,t=map(int,input().split())
s-=1;t-=1
ans=dfs(s*3,t*3,0,[0]*(n*3))
if ans==float("inf"):
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
n,m=map(int,input().split())
edge = [[] for i in range(n*3)]
#edge[i] : iから出る道の[行先]の配列
for i in range(m):
    x,y = map(int,input().split())
    x-=1;y-=1
    x*=3;y*=3
    edge[x  ].append(y+1)
    edge[x+1].append(y+2)
    edge[x+2].append(y  )
    
def dfs(s,g,res,visited):
  if s==g or s==g+1 or s==g+2:
    if res%3==0:
      return res//3
  
  if len(visited)>3*n:
    return float("inf")
  
  if edge[s]==[]:
    return float("inf")
  
  l=float("inf")
  for i in edge[s]:
    if i not in visited:
      l=min(l,dfs(i,g,res+1,visited+[i]))
  return l

s,t=map(int,input().split())
s-=1;t-=1
ans=dfs(s*3,t*3,0,[])
if ans==float("inf"):
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
import heapq
n,m=map(int,input().split())
edge = [[] for i in range(n*3)]
#edge[i] : iから出る道の[行先]の配列
for i in range(m):
    x,y = map(int,input().split())
    x-=1;y-=1
    x*=3;y*=3
    edge[x  ].append(y+1)
    edge[x+1].append(y+2)
    edge[x+2].append(y  )
    
def dfs(s,g,res):
  #print(s,g,res)
  if s==g or s==g+1 or s==g+2:
    if res%3==0:
      return res//3
  
  if res>n+m:
    return float("inf")
  
  if edge[s]==[]:
    return float("inf")
  
  l=float("inf")
  for i in edge[s]:
    l=min(l,dfs(i,g,res+1))
  return l

s,t=map(int,input().split())
s-=1;t-=1
ans=dfs(s*3,t*3,0)
if ans==float("inf"):
  print(-1)
else:
  print(ans)
Problem p03043 (python)

Fixed submission:
N,K=map(int,input().split())
ans=0
for i in range(N):
  p=i+1
  q=1/N
  while p<K:
    p*=2
    q*=1/2
  ans+=q

print(ans)

Buggy submission (verdict: Runtime Error):
S=input()
sf=int(S[:2])
sb=int(S[3:])
if 1<=sf and sf<=12:
  if 1<=sb and sb<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1<=sb and sb<=12:
    print("YYMM")
  else:
    print("NA")
Problem p03061 (python)

Fixed submission:
import copy
import fractions
N=int(input())
A=list(map(int,input().split()))
ans=[]
L=[0 for i in range(N)]
R=[0 for i in range(N)]
for i in range(N):
  if i != 0:
    L[i]=fractions.gcd(L[i-1],A[i-1])
    R[N-1-i]=fractions.gcd(R[N-i],A[N-i])

for i in range(N):
  ans.append(fractions.gcd(L[i],R[i]))

print(max(ans))

Buggy submission (verdict: Runtime Error):
import copy
import fractions
N=int(input())
A=list(map(int,input().split()))
ans=[]
def dfs(A):
  l=[]
  if len(A)==1:
    return A[0]
  for i in range(0,len(A),2):
    l.append(fractions.gcd(A[i],A[i+1]))
  return dfs(l)
  
  
for i in range(N):
  s=copy.deepcopy(A)
  s.pop(i)
  ans.append(dfs(s))

print(max(ans))
Problem p03380 (python)

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

def binary(l,i):
  r=N-1
  while l<=r:
    m=(l+r)//2
    if A[m]==i:
      return A[m]
    elif A[m]>i:
      r=m-1
    else:
      l=m+1
  x=abs(A[m]-i)
  for j in range(max(0,m-2),min(m+3,N-1)):
    if x >= abs(A[j]-i):
      res = A[j]     
      x=abs(A[j]-i)
  return res


print(A[-1],binary(1,A[-1]/2))

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

def binary(l,i):
  r=N-1
  while l<r:
    m=(l+r)//2
    if A[m]==i:
      return A[m]
    elif A[m]>i:
      r=m-1
    else:
      l=m+1
  x=abs(A[m]-i)
  for j in range(max(0,m-2),min(m+3,N)):
    if x >= abs(A[j]-i):
      res = A[j]     
      x=abs(A[j]-i)
  return res


print(A[-1],binary(1,A[-1]/2))
Problem p03565 (python)

Fixed submission:
S_d,T = list(input()),list(input())

if len(S_d) < len(T):
  print("UNRESTORABLE");exit()

flag = 1
for i in range(-len(T),-len(S_d)-1,-1):
  key = 0
  for j in range(len(T)):
    if S_d[i+j]=="?" or S_d[i+j]==T[j]:
      key+=1
    else:
      break
  if key == len(T):
    st=len(S_d)+i
    break
  else:
    st=-1

if st==-1:
  print("UNRESTORABLE")
else:
  for i in range(len(S_d)):
    if st <= i and i < st+len(T):
      print(T[i-st],end="")
    elif S_d[i]=="?":
      print("a",end="")
    else:
      print(S_d[i],end="")

Buggy submission (verdict: Runtime Error):
S_d,T = list(input()),list(input())

if len(S_d) < len(T):
  print("UNRESTORABLE");exit()

flag = 1
for i in range(-len(T),-len(S_d)-1,-1):
  key = 0
  for j in range(len(T)):
    if S_d[i+j]=="?" or S_d[i+j]==T[j]:
      key+=1
    else:
      break
  if key == len(T):
    st=len(S_d)+i
    break
  else:
    st=-1

if st==-1:
  print(UNRESTORABLE)
else:
  for i in range(len(S_d)):
    if st <= i and i < st+len(T):
      print(T[i-st],end="")
    elif S_d[i]=="?":
      print("a",end="")
    else:
      print(S_d[i],end="")

Buggy submission (verdict: Runtime Error):
S_d,T = list(input()),list(input())

if len(S_d) < len(T):
  print("UNRESTORABLE");exit()

flag = 1
for i in range(-len(T),-len(S_d)-1,-1):
  key = 0
  for j in range(len(T)):
    if S_d[i+j]=="?" or S_d[i+j]==T[j]:
      key+=1
  if key == len(T):
    st=len(S_d)+i
    break
  else:
    st=-1

if st==-1:
  print(UNRESTORABLE)
else:
  for i in range(len(S_d)):
    if st <= i and i < st+len(T):
      print(T[i-st],end="")
    elif S_d[i]=="?":
      print("a",end="")
    else:
      print(S_d[i],end="")
Problem p03848 (python)

Fixed submission:
import collections
N=int(input())
A=collections.Counter(list(map(int,input().split())))
if N%2==0:
  for i in range(0,N,2):
    if i%2==0 and A[i]==0:
      pass
    elif i%2==1 and A[i]==2:
      pass
    else:
        print(0);exit(0)
else:
  for i in range(N):
    if i==0 and A[i]==1:
      continue
    if i%2==0 and A[i]==2:
      pass
    elif i%2==1 and A[i]==0:
      pass
    else:
      print(0);exit(0)
print(pow(2,N//2,10**9+7 ))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
A=collections.Counter(list(map(int,input().split())))
if N%2==0:
  for i in range(0,N,2):
    if i%2==0 and A[i]==0:
      pass
    elif i%2==a and A[i]==2:
      pass
    else:
        print(0);exit(0)
else:
  for i in range(N):
    if i==0 and A[i]==1:
      continue
    if i%2==0 and A[i]==2:
      pass
    elif i%2==1 and A[i]==0:
      pass
    else:
      print(0);exit(0)
print(pow(2,N//2,10**9+7 ))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
A=collections.Counter(list(map(int,input().split())))
if N%2==0:
  for i in range(0,N,2):
    if i%2==0 and A[i]==0:
      pass
    elif i%2==a and A[i]==2:
      pass
    else:
        print(0);exit()
else:
  for i in range(N):
    if i==0 and A[i]==1:
      continue
    if i%2==0 and A[i]==2:
      pass
    elif i%2==1 and A[i]==0:
      pass
    else:
      print(0);exit()
print(pow(2,N//2,10**9+7 ))

Buggy submission (verdict: Runtime Error):
import collections
N=int(input())
A=collections.Counter(list(map(int,input().split())))
if N%2==0:
  for i in range(0,N,2):
    if i%2==0 and A[i]==0:
      pass
    elif i%2==a and A[i]==2:
      pass
    else:
        print(0);exit()
  print(2**(N//2))
else:
  for i in range(N):
    if i==0:
      if A[i]!=1:
        print(0);exit()
    elif i%2==0 and A[i]==2:
      pass
    elif i%2==1 and A[i]==0:
      pass
    else:
      print(0);exit()
  print(2**(N//2))
Problem p03854 (python)

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

l=-1
while l-2>=-len(S):
    k=S[l:l-3:-1]
    if k=="mae":
        T+="dream"[::-1]
        l-=5
    elif k=="rem":
        T+="dreamer"[::-1]
        l-=7
    elif k=="esa":
        T+="erase"[::-1]
        l-=5
    elif k=="res":
        T+="eraser"[::-1]
        l-=6
    else:
        break
if S=="".join(T[::-1]):
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
IN = iter(Input.split('\n')).__next__
def input():
    return IN()
#ここから先

S=input()
T=[]

l=-1
while l>=-len(S):
    if S[l]=="r":
        if l-2<-len(S):
            print("NO");break
        elif S[l-2]=="s":
            T+="eraser"[::-1]
            l-=6
        else:
            T+="dreamer"[::-1]
            l-=7
    elif S[l]=="e":
        T+="erase"[::-1]
        l-=5
    elif S[l]=="m":
        T+="dream"[::-1]
        l-=5
    else:
        print("NO");break
        
if S=="".join(T[::-1]):
    print("YES")
Problem p03999 (python)

Fixed submission:
S=list(input())
ans=0

for x in range(2**(len(S)-1)):
  bin_x = str(format(x,str(len(S)-1)+"b"))[::-1]
  
  l=0
  res=0
  for r,i in enumerate(bin_x):
    if i == "1":
      res+=int("".join(S[l:r+1]))
      l=r+1
  res+=int("".join(S[l:len(S)]))
  ans+=res
print(ans)

Buggy submission (verdict: Runtime Error):
S=list(input())
ans=0
for i in range(2**(len(S)-1)):
  bin_i= format(i, 'b')
  bin_i=str(bin_i.zfill(len(S)-1))
  s=0
  l=int(S[0])
  for j,k in enumerate(bin_i):
    if k=="0":
      l=l*10+int(S[j+1])
    else:
      s+=l
      l=int(S[j+1])
      
    if j==len(S)-2:
        s+=l
  ans+=s
print(ans)
Problem p04030 (python)

Fixed submission:
a = list(input())
ans = []
for b in a:
    if  b == "0":
        ans.append("0")
    elif b == "1":
        ans.append("1")
    elif len(ans) != 0:
        ans.pop()
print("".join(ans))

Buggy submission (verdict: Runtime Error):
a = list(input())
ans = []
for b in a:
    if  b == "0":
        ans.append("0")
    elif b == "1":
        ans.append("1")
    else:
        ans.pop()
print("".join(ans))
Problem p04032 (python)

Fixed submission:
S = input()
if len(S)==2 and S[0]==S[1]:
    print(1,2);exit()
for i in range(len(S)-2):
    if S[i] == S[i+1] or S[i] == S[i+2] or S[i+1] == S[i+2]:
        print(i+1,i+3);exit()
print("-1 -1")

Buggy submission (verdict: Runtime Error):
S = input()
if len(S)==2 and s[0]==s[1]:
    print(1,2);exit()
for i in range(len(S)-2):
    if S[i] == S[i+1] or S[i] == S[i+2] or S[i+1] == S[i+2]:
        print(i+1,i+3);exit()
print("-1 -1")

Buggy submission (verdict: Runtime Error):
[InternetShortcut]
URL=https://atcoder.jp/contests/abc043/custom_test
import collections

S = list(input())
n = collections.Counter(S).most_common()[0][1]
for i in range(2, min(2*n,len(S)+1)):
    for j in range(0,len(S)-(i-1)):
        s = S[j:j+i]
        s_com = collections.Counter(s).most_common()
        for com in s_com:
            if com[1] >= i//2+1:
                print(j,j+i);exit()
            elif com[1] <i//2+1:
                break

print("-1 -1")
Problem p02642 (python)

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

a.sort()

table=[True]*1000001
count=0
if n==1:
  count=1
else:
  for i in range(0,n):
    pp=a[i]
    if table[pp]==True:
      if i==0:
        if pp!=a[i+1]:
          count+=1
        for j in range(pp,1000001,pp):
          table[j]=False
      elif i==n-1:
        if pp!=a[n-2]:
          count+=1
      else:
        if pp!=a[i+1] and pp!=a[i-1]:
          count+=1
        for j in range(pp,1000001,pp):
          table[j]=False
      
print(count)

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

a.sort()

table=[True]*1000001
count=0
if n==1:
  count=1
else:
  for i in range(0,n):
    pp=a[i]
    if table[pp]==True:
      if i==0:
        if a[i]!=a[i+1]:
          count+=1
          for j in range(pp,1000002,pp):
            table[j]=False
      elif i==n-1:
        if a[i]!=a[i-1]:
          count+=1
          for j in range(pp,1000002,pp):
            table[j]=False
      else:
        if a[i]!=a[i+1] and a[i]!=a[i-1]:
          count+=1
          for j in range(pp,1000002,pp):
            table[j]=False
      
print(count)

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

a.sort()

table=[True]*1000001
count=0
for i in range(0,n):
  pp=a[i]
  if table[pp]==True:
    if i==0:
      if a[i]!=a[i+1]:
        count+=1
        for j in range(pp,1000001,pp):
          table[j]=False
    elif i==n-1:
      if a[i]!=a[i-1]:
        count+=1
        for j in range(pp,1000001,pp):
          table[j]=False
    else:
      if a[i]!=a[i+1] and a[i]!=a[i-1]:
        count+=1
        for j in range(pp,1000001,pp):
          table[j]=False
      
print(count)

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

a.sort()

table=[]
for i in range(1000001):
  table.append([True,0])
count=0
for i in range(0,n):
  pp=a[i]
  if table[pp][0]==True:
    if i==0:
      if a[i]!=a[i+1]:
        count+=1
    elif i==n-1:
      if a[i]!=a[i-1]:
        count+=1
    else:
      if a[i]!=a[i+1] and a[i]!=a[i-1]:
        count+=1
  if table[pp][1]==0:
    table[pp][1]=1
    for j in range(pp,1000001,pp):
      table[j][0]=False
      
print(count)

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

a.sort()

table=[]
for i in range(1000001):
  table.append([True,0])
count=0
for i in range(0,n):
  if table[a[i]][0]==True:
    count+=1
  if table[a[i]][1]==0:
    table[a[i]][1]=1
    for j in range(a[i],1000002,a[i]):
      table[j][0]=False
  elif table[a[i]][1]==1:
    count-=1
    table[a[i]][1]=2
      
print(count)
Problem p02678 (python)

Fixed submission:
from collections import deque
dic={}
n,m=map(int,input().split())
nod=[[]]
keep=[0]*n
for i in range(n-1):
  nod.append([])
for i in range(m):
  a,b=map(int,input().split())
  nod[a-1].append(b)
  nod[b-1].append(a)
use=deque()
use.append(1)
for i in range(0,10**100):
  if bool(use):
    sss=use.popleft()
    for j in nod[sss-1]:
      if not j in dic:
        keep[j-1]=sss
        use.append(j)
        dic[j]=1
  else:
    break

keep.pop(0)
print("Yes")
for x in keep:
  print(x)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
nod=[[]]
check=[[0,0]]
for i in range(n-1):
  nod.append([])
  check.append([10**10,0])
for i in range(m):
  a,b=map(int,input().split())
  nod[a-1].append(b)
  nod[b-1].append(a)


def dfs(k):
  count=check[k-1][0]+1
  uselist=nod[k-1]
  for x in uselist:
    if count<check[x-1][0]:
      check[x-1][0]=count
      check[x-1][1]=k
      dfs(x)
    else:
      continue
  return

dfs(1)
print("Yes")
for i in range(n-1):
  print(check[i+1][1])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
nod=[[]]
check=[[0,0]]
for i in range(n-1):
  nod.append([])
  check.append([10**10,0])
for i in range(m):
  a,b=map(int,input().split())
  nod[a-1].append(b)
  nod[b-1].append(a)


def dfs(k):
  count=check[k-1][0]+1
  uselist=nod[k-1]
  for x in uselist:
    if count<check[x-1][0]:
      check[x-1][0]=count
      check[x-1][1]=k
      dfs(x)
    else:
      continue

dfs(1)
print("Yes")
for i in range(n-1):
  print(check[i+1][1])

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
nod=[[]]
check=[[0,0]]
for i in range(n-1):
  nod.append([])
  check.append([10**10,0])
for i in range(m):
  a,b=map(int,input().split())
  nod[a-1].append(b)
  nod[b-1].append(a)


def dfs(k):
  count=check[k-1][0]+1
  uselist=nod[k-1]
  for x in uselist:
    if count<check[x-1][0]:
      check[x-1][0]=count
      check[x-1][1]=k
      dfs(x)
    else:
      continue

dfs(1)
for i in range(n-1):
  print(check[i+1][1])
Problem p02690 (python)

Fixed submission:
x=int(input())
keep=0
for i in range(-1000,1000):
  for j in range(-1000,1000):
    if i**5-j**5==x:
      print(i,j)
      keep=1
      break
  if keep==1:
    break

Buggy submission (verdict: Runtime Error):
x=int(input())
for i in range(-1000,1000):
  for j in range(-1000,1000):
    if i**5-j**5==x:
      print(i,j)
      keep=1
      break
  if keep==1:
    break
Problem p02713 (python)

Fixed submission:
k = int(input())
import math
k1 = 0
k2 = 0
k3 = 0
count = 0
for i in range(0,k):
  k1 = k1 + 1
  k2 = 0
  for j in range(0,k1):
    k3=0
    k2 = k2 + 1
    for k in range(0, k2):
      k3 = k3 + 1
      if k1==k2==k3:
        count = count + k1
      elif k1==k2:
        count = count + 3*math.gcd(k1,k3)
      elif k2==k3:
        count = count + 3*math.gcd(k1,k2)
      elif k3==k1:
        count = count + 3*math.gcd(k1,k2)
      else:
        k4 = math.gcd(k1,k2)
        count = count + 6*math.gcd(k3,k4)
print(count)

Buggy submission (verdict: Runtime Error):
k = int(input())
import math
k1 = 0
k2 = 0
k3 = 0
count = 0
for i in range(0,k):
  k1 = k1 + 1
  for j in range(0,i):
    k2 = k2 + 1
    for k in range(0, j):
      k3 = k3 + 1
      if k1==k2==k3:
        count = count + k1
      elif k1==k2 or k2==k3 or k3==k1:
        count = count + 3*math.gcd(k1,k2,k3)
      else:
        count = count + 6*math.gcd(k1,k2,k3)
Problem p02761 (python)

Fixed submission:
n,m=map(int,input().split())
keep=0
aa=["#"]*n
for i in range(m):
  s,c=map(str,input().split())
  s=int(s)
  if n>=2 and s==1 and c=="0":
    keep=1
    print(-1)
    break
  if aa[s-1]=="#":
    aa[s-1]=c
  elif aa[s-1] !=c:
    keep=1
    print(-1)
    break
if keep==0:
  moji=""
  if aa[0]=="#" and n>=2:
    moji+="1"
  elif n==1 and aa[0]=="#":
    moji+="0"
  else:
    moji+=aa[0]
  for i in range(1,n):
    if aa[i]=="#":
      moji+="0"
    else:
      moji+=aa[i]
  print(moji)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
keep=0
aa=["#"]*n
for i in range(m):
  s,c=map(str,input().split())
  s=int(s)
  if aa[s-1]=="#":
    aa[s-1]=c
  elif aa[s-1] !=c:
    keep=1
    print(-1)
    break
if keep==0:
  moji=""
  if aa[0]=="#":
    moji+="1"
  else:
    moji+=aa[0]
  for i in range(1,n):
    if aa[i]=="#":
      moji+="0"
    else:
      moji+=aa[i]
print(moji)
Problem p02789 (python)

Fixed submission:
n,m=map(int,input().split())
if n == m:
  print('Yes')
else:
  print('No')

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

m=2*(10**5)+1
count = 0
for i in range(0, n):
  if p[i] <= m:
    m = p[i]
    count = count + 1

print(count)

Buggy submission (verdict: Runtime Error):
n,m = map(int(input().split()))
if n == m:
  print'Yes'
else:
  print'No'