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

Fixed submission:
import sys
 
a,b = map(int,input().split())
low = int(min(a//0.08,b//0.1))
high = int(max((a+1)//0.08,(b+1)//0.1))
for i in range(low,high+1):
  if int(i*0.08)==a and int(i*0.1)==b:
    print(i)
    sys.exit()
print(-1)

Buggy submission (verdict: Runtime Error):
import math
l1=input().split(" ")
t80=int(l1[0])
t100=int(l1[1])
t80_min=(t80//0.08)
t80_max=((t80+1)//0.08)
t100_min=(t100//0.1)
t100_max=((t100+1)//0.1)
f=0
for i  in range(min(t80_min,t100_min),max(t100_max,t100_max)):
    if int(i*0.08)==a and int(i*0.1)==b:
        print(i)
        sys.exit()
print(-1)

Buggy submission (verdict: Runtime Error):
import math
l1=input().split(" ")
t80=int(l1[0])
t100=int(l1[1])
t80_min=math.ceil(t80/0.08)
t80_max=math.ceil((t80+1)/0.08)
t100_min=math.ceil(t100/0.1)
t100_max=math.ceil((t100+1)/0.1)
f=0
for i  in range(min(t80_min,t100_min),max(t100_max,t100_max)):
    if int(i*0.08)==a and int(i*0.1)==b:
        print(i)
        sys.exit()
print(-1)

Buggy submission (verdict: Runtime Error):
import math
l1=input().split(" ")
t80=int(l1[0])
t100=int(l1[1])
t80_min=math.ceil(t80/0.08)
t80_max=math.ceil((t80+1)/0.08)
t100_min=math.ceil(t100/0.1)
t100_max=math.ceil((t100+1)/0.1)
f=0
for i  in range(min(t80_min,t100_min),max(t80_max,t100_max)):
    if int(i*0.08)==a and int(i*0.1)==b:
        print(i)
        sys.exit()
print(-1)

Buggy submission (verdict: Runtime Error):
l1=input().split(" ")
t80=int(l1[0])
t100=int(l1[1])
t80_min=(t80/0.08)
t80_max=((t80+1)/0.08)
t100_min=(t100/0.1)
t100_max=((t100+1)/0.1)
if t80_max<t100_min:
    print("-1")
else:
    if t80_min<=t100_min:
        print(math.ceil(t100_min))
    else:
        print(math.ceil(t80_min))
Problem p02922 (python)

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

for n in range(0,20):
    if n*(a-1)>=b-1:
        break

print(n)

Buggy submission (verdict: Runtime Error):
for n in range(0,20):
    if n*a-n>=b-1:
        break

print(n)

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if b==1:
    n=1
else:
    for n in range(1,20):
    if n*a-n>b:
        break
print(n)

Buggy submission (verdict: Runtime Error):

a,b=map(int,input().split())
if b==1:
    n=1
else:
    for n in range(0,20):
    if n*a-n>b:
        break
print(n)

Buggy submission (verdict: Runtime Error):
a=str(input())
b=str(input())
for n in range(0,len(a)):
    if 3*n+1>b:
        break
print(n)

Buggy submission (verdict: Runtime Error):
a=input().split()

c=a[1]%a[0]
d=b[1]//a[0]
d=d-1
if c!=0:
    d+=1

print(d)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=b%a
d=b//a
d=d-1
if c!=0:
    d+=1

print(d)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=b%a
d=b//a
if c!=0:
    d+=1

print(d)
Problem p02639 (python)

Fixed submission:
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)
elif e == 0:
    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 e == 0:
    print(4)
elif f == 0:
    print(5)
Problem p02681 (python)

Fixed submission:
S = input()
T = input()
if S == T[:-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
S = input()
T = input()
if S = T[:-1]:
    print('Yes')
else:
    print('No')
Problem p02700 (python)

Fixed submission:
A, B, C, D = map(int, input().split())
while True:
    C = C - B
    if C <= 0:
        print('Yes')
        exit()
    A = A - D
    if A <= 0:
        print('No')
        exit()

Buggy submission (verdict: Runtime Error):
while True:
    C = C - B
    if C <= 0:
        print('Yes')
        break
    A = A - D
    if A <= 0:
        print('No')
        break
Problem p02690 (python)

Fixed submission:
X = int(input())
c = 0
for i in range(-200,200):
    for j in range(-200,200):
        if i**5-j**5==X:
            a = i
            b = j
            print(a, b)    
            c = 1
            break
    if c != 0:
        break

Buggy submission (verdict: Runtime Error):
X = int(input())
c = 0
for i in range(100):
    for j in range(100):
        if i**5-j**5==X:
            a = i
            b = j
            c += 1
            break
    if c ==0:
        for j in range(100):
            if i**5+j**5==X:
            a = i
            b = j
            break
print(a b)

Buggy submission (verdict: Runtime Error):
X = int(input())
c = 0
for i in range(100):
    for j in range(100):
        if i**5-j**5==X:
            a = i
            b = j
            c += 1
            break
    if c ==0:
        for j in range(100):
            if i**5+j**5==X:
            a = i
            b = j
            break
print(a,b)

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

for i in range(100):
    for j in range(100):
        if i**5-j**5==X:
            a = i
            b = j
            break
print(a,b)
Problem p02939 (python)

Fixed submission:
def main():
  s = list(input())
  divide = []
  compare = 0
  for i in range(len(s)):
    if s[i] == compare and i != len(s)-1:
      s[i+1] = s[i] + s[i+1]
    elif s[i] == compare:
      break
    else:
      compare = s[i]
      divide.append(s[i])
      # print(divide)
  print(len(divide))


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
  s = list(input())
  divide = []
  compare = 0
  for i in range(len(s)):
    if s[i] == compare :
      s[i+1] = s[i] + s[i+1]
    else:
      compare = s[i]
      divide.append(s[i])
  print(len(divide))


if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
  s = list(input())
  divide = [1]
  for i in range(len(s)):
    if s[i] == divide[-1] :
      s[i+1] = s[i] + s[i+1]
    else:
      divide.append(s[i])
  print(len(divide)-1)


if __name__ == '__main__':
  main()
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
if n==0:
  print(x)
else:
    l1 = list(map(int,input().split()))	
    l2 = list(range(-150, 200))
    diff = set(l1) ^ set(l2)
    diff = list(diff)
    def sorting(numbers_array):
      return sorted(numbers_array, key=abs)
    sl = map(lambda a: a - x, diff)
    print(sorting(sl)[0]+x)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n==0:
  print(x)
else:
    l1 = list(map(int,input().split()))	
    l2 = list(range(1, 100))
    diff = set(l1) ^ set(l2)
    diff = list(diff)
    def sorting(numbers_array):
    return sorted(numbers_array, key=abs)

    sl = map(lambda a: a - x, diff)
    print(sorting(sl)[0])
Problem p02657 (python)

Fixed submission:
x, y = map(int, input().split())

print(x*y)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
li = list(map(int, input().split()))

ans = np.prod(li)
print(ans) if ans <= 10**18) else print(-1)
Problem p03456 (python)

Fixed submission:
def solve():
    a,b = input().split()

    for i in range(1000):
        if i * i == int('{}{}'.format(a,b)):
            print('Yes')
            return
    print('No')
solve()

Buggy submission (verdict: Runtime Error):
def solve():
    a,b = input().split()

    for i in range(101):
        if i * i == int(f'{a}{b}'):
            print('Yes')
            return
    print('No')
solve()
Problem p02684 (python)

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

history = []
is_visited = [False] * n

index = 0
cnt = 0
loop_start_city_index = 0
for i in range(k+1):
    if i == k:
        print(index+1)
        exit()

    if is_visited[index]:    # すでに訪れた街にきた
        loop_start_city_index = index
        break
    
    is_visited[index] = True
    history.append(index)
    index = a[index] - 1
    cnt += 1

from_start_to_loop_start = history.index(loop_start_city_index)
loop_length = len(history) - from_start_to_loop_start

print(history[from_start_to_loop_start + (k-from_start_to_loop_start)%loop_length] + 1)

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

history = []
is_visited = [False] * n

index = 0
cnt = 0
loop_start_city_index = 0
for i in range(k+1):
    if i == k:
        print(index+1)
        exit()

    is_visited[index] = True

    if is_visited[index]:    # すでに訪れた街にきた
        loop_start_city_index = index
        break
    history.append(index)
    index = a[index] - 1
    cnt += 1

from_start_to_loop_start = history.index(loop_start_city_index)
loop_length = len(history) - from_start_to_loop_start

print(history[from_start_to_loop_start + (k-from_start_to_loop_start)%loop_length] + 1)
Problem p03160 (python)

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

dp = [float("inf")] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, n):
    one = abs(h[i] - h[i-1]) + dp[i-1]
    two = abs(h[i] - h[i-2]) + dp[i-2]
    dp[i] = min(one, two)
print(dp[n-1])

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
h = list(map(int, input().split()))

dp = [math.inf] * n
dp[0] = 0
dp[1] = abs(h[1] - h[0])

for i in range(2, n):
    one = abs(h[i] - h[i-1]) + dp[i-1]
    two = abs(h[i] - h[i-2]) + dp[i-2]
    dp[i] = min(one, two)
print(dp[n-1])
Problem p02664 (python)

Fixed submission:
s=input()
t=s
s_list=list(s)
for i in range(len(t)):
    if s_list[i]=='?':
        
        
        if s_list[i-1]=='D':
            if i==len(t)-1:
                s_list[i]='D'
            elif s_list[i+1]=='P':
                s_list[i]='D'
            elif s_list[i+1]=='D':
                s_list[i]='P'
            else:
                s_list[i]='P'
          
        else:
            s_list[i]='D'
    
s_cha="".join(s_list)            
print(s_cha)

Buggy submission (verdict: Runtime Error):
s=input()
t=s
s_list=list(s)
for i in range(len(t)):
    if t[i]=='?':
        
        if t[i-1]=='D':
            if i==len(t):
                s_list[i]='D'
            if t[i+1]=='P':
                s_list[i]='D'
            else:
                s_list[i]='P'
          
        else:
            s_list[i]='D'
    
s_cha="".join(s_list)            
print(s_cha)
Problem p03043 (python)

Fixed submission:
N,K = map(int,input().split())
bosu = [N]*N
for i in range(1,N+1):
    point = i
    while point < K:
        point *= 2
        bosu[i-1] *= 2
        
ans = 0
for i in bosu:
    ans += 1/i

print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
bosu = [1]*N
for i in range(1:N+1):
    point = i
    while i < K:
        point *= 2
        bosu[i-1] *= 2

print(N/sum(bosu))
Problem p03061 (python)

Fixed submission:
from fractions import gcd
#input
N = int(input())
A = [int(i) for i in input().split()]
#cluc left and right gcd 
left = [0]*N
right = [0]*N
count = 0
left[0] = A[0]
right[-1] = A[-1]
Ans = []

for i in A[1:]:
    left[count+1] = gcd(left[count],i)
    count += 1

for i in reversed(A[:-1]):
    right[count-1] = gcd(right[count],i)
    count -= 1
# make ans
Ans.append(right[1])
Ans.append(left[-2])
for i in range(N-2):
    Ans.append(gcd(left[i],right[i+2]))
print(max(Ans))

Buggy submission (verdict: Runtime Error):
from math import gcd
#input
N = int(input())
A = [int(i) for i in input().split()]
#cluc left and right gcd 
left = [0]*N
right = [0]*N
count = 0
left[0] = A[0]
right[-1] = A[-1]
Ans = []

for i in A[1:]:
    left[count+1] = gcd(left[count],i)
    count += 1

for i in reversed(A[:-1]):
    right[count-1] = gcd(right[count],i)
    count -= 1
# make ans
Ans.append(right[1])
Ans.append(left[-2])
for i in range(N-2):
    Ans.append(gcd(left[i],right[i+2]))
print(max(Ans))

Buggy submission (verdict: Runtime Error):
import fractions
N = int(input())
A = [int(i) for i in input().split()]

def mygcd(A):
    if len(A) == 1:
        return A[0]
    else:
        return fractions.gcd(A[0],mygcd(A[1:]))
        
ans = []
for i in range(N):
    ans.append(mygcd(A[:i]+A[i+1:]))

print(max(ans))

Buggy submission (verdict: Runtime Error):
import fractions
N = int(input())
A = [int(i) for i in input().split()]

def gcd(a,b):
    

def mygcd(A):
    if len(A) == 1:
        return A[0]
    else:
        return fractions.gcd(A[0],mygcd(A[1:]))
        
ans = []
for i in range(N):
    ans.append(mygcd(A[:i]+A[i+1:]))

print(max(ans))

Buggy submission (verdict: Runtime Error):
import fraction
N = int(input())
A = [int(i) for i in input().split()]

def gcd(a,b):
    

def mygcd(A):
    if len(A) == 1:
        return A[0]
    else:
        return fraction.gcd(A[0],mygcd(A[1:]))
        
ans = []
for i in range(N):
    ans.append(mygcd(A[:i]+A[i+1:]))

print(max(ans))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
A = [int(i) for i in input().split()]

def mygcd(A):
    if len(A) == 1:
        return A[0]
    else:
        return math.gcd(A[0],mygcd(A[1:]))
        
ans = []
for i in range(N):
    ans.append(mygcd(A[:i]+A[i+1:]))

print(max(ans))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
A = [int(i) for i in input().split()]

def mygcd(A):
    if len(A) == 1:
        return A[0]
    else:
        return math.gcd(A[0],mygcd(A[1:]))
        
ans = []
for i in range(N):
    ans.append(mygcd(A[:i-1]+A[i:]))

print(max(ans))
Problem p03087 (python)

Fixed submission:
N,Q=map(int,input().split())
S=input()
t=[0]*(N+1)
for i in range(N):
  t[i+1]=t[i]+(1 if S[i:i+2]=="AC" else 0)
for i in range(Q):
  start,end=map(int,input().split())
  print(t[end-1]-t[start-1])

Buggy submission (verdict: Runtime Error):
input_num=list(input())
input_str=list(input())
anslen=[]
for i in range(input_num[1]):
  divpoint=list(input())
  k=''.join(input_str[divpoint[0]:divpoint[1]])
  anslen.append(k.count("AC"))
for i in range(input_num[1]):
  print(anslen[i])

Buggy submission (verdict: Runtime Error):
input_num=(input().split())
input_str=input().split()
anslen=[]
for i in range(input_num[1]):
  divpoint=(input().split())
  k=''.join(input_str[divpoint[0]:divpoint[1]])
  anslen.append(k.count("AC"))
for i in range(input_num[1]):
  print(anslen[i])

Buggy submission (verdict: Runtime Error):
input_num=(input().split())
input_str=input()
anslen=[]
for i in range(input_num[1]):
  divpoint=(input().split())
  k=input_str[divpoint[0]:divpoint[1]+1]
  anslen.append(k.count("AC"))
for i in range(input_num[1]):
  print(anslen[i])
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
i = 0
leng = len(S)
while S[i] == "1":
    i += 1
    if i >= leng:
        break
if K-1 < i:
    print(1)
else:
    print(int(S[i]))

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
i = 0
while S[i] == "1":
    i += 1
if K-1 < i:
    print(1)
else:
    print(int(S[i]))
Problem p03760 (python)

Fixed submission:
O = input()
E = input()
length = len(O)+len(E)
ans = [""]*length

for i in range(length):
    if i%2 == 0:
        ans[i] = O[i//2]
    else:
        ans[i] = E[i//2]
        
ans = "".join(ans)
print(ans)

Buggy submission (verdict: Runtime Error):
O = input()
E = input()
length = len(O)*2
ans = [""]*length

for i in range(length):
    if i%2 == 0:
        ans[i] = O[i//2]
    else:
        ans[i] = E[i//2]
        
ans = "".join(ans)
print(ans)
Problem p02641 (python)

Fixed submission:
import numpy as np
X, N=map(int,input().split())
if N==0:
  ans=X
  print(ans)
else:
  ps=map(int,input().split())

  ps_sort=sorted(ps)

  ind_crit=N-1
  for p in ps_sort:
    if p>=X:
      ind_crit=ps_sort.index(p)
      break

  if not ps_sort[ind_crit]==X:
    ans=X
  else:
    diff=0
    while(True):
      diff+=1
      if not X-diff in ps_sort:
        ans=X-diff
        break
      if not X+diff in ps_sort:
        ans=X+diff
        break

  print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
X, N=map(int,input().split())
ps=map(int,input().split())

ps_sort=sorted(ps)

ind_crit=N-1
for p in ps_sort:
  if p>=X:
    ind_crit=ps_sort.index(p)
    break
    
if not ps_sort[ind_crit]==X:
  ans=X
else:
  diff=0
  while(True):
    diff+=1
    if not X-diff in ps_sort:
      ans=X-diff
      break
    if not X+diff in ps_sort:
      ans=X+diff
      break

print(ans)
Problem p02780 (python)

Fixed submission:
# D
import numpy as np
N, K = map(int,input().split())
p = list(map(int,input().split()))

sums=np.cumsum([(s+1)/2 for s in p])

ans=np.max([ sums[i+K]-sums[i] for i in range(N-K)]+[sums[K-1]])

print(ans )

Buggy submission (verdict: Runtime Error):
# D
import numpy as np
N, K = map(int,input().split())
p = list(map(int,input().split()))

sums=np.cumsum([(s+1)/2 for s in p])

ans=np.max([ sums[i+K]-sums[i] for i in range(N-K)])

print(ans )
Problem p02993 (python)

Fixed submission:
S = input()
judge = "Good"
for num in range(3):
  if int(S[num]) == int(S[num + 1]):
    judge = "Bad"
    break
print(judge)

Buggy submission (verdict: Runtime Error):
N = int(input() )
for i in range(N):
  C[i] = [map(int, input().split() ) ]
 
C.sort(key= lambda s:(s[1],s[0]) )
 
judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)

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

C.sort(key= lambda s:(s[1],s[0]) )


judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)

Buggy submission (verdict: Runtime Error):
N, L = map(int, input().split())
 
if L > -1:
  N_eat = 1
elif N+L-1 < 1:
  N_eat = N
else:
  N_eat = 1-L
pie = N*N/2 +N*(L-1) - (L + N_eat-1) 
print(pie)

Buggy submission (verdict: Runtime Error):
S = input()
bad = 0
for num in range(2):
  if S[num] == S[num + 1]:
    print("Bad")
    break
    bad = 1
if bad == 0:
  print(Good)
Problem p02994 (python)

Fixed submission:
N, L = map(int, input().split())
 
if L > -1:
  N_eat = 1
elif N+L-1 < 1:
  N_eat = N
else:
  N_eat = 1-L
 
pie = N*(N+1)/2 +N*(L-1) - (L + N_eat-1) 
print(int(pie) )

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

if L >= 0:
  N_eat = 1
elif N+L-1 <= 0:
  N_eat = N
else:
  N_eat = 1-L
pie = double(N*N/2 +N*(L-1) - (L + N_eat-1) ) 
print(pie)
Problem p02996 (python)

Fixed submission:
N = int(input() )
C = []
for i in range(N):
  A, B = map(int, input().split() )
  C.append([A, B])
C.sort(key=lambda s:s[1] )
 
judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)

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

for i in range(N):
  A, B = map(int, input().split() )
  C[i] = [A, B]
C.sort(key=lambda s:s[1] )
 
judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)

Buggy submission (verdict: Runtime Error):
N = int(input() )
for i in range(N):
  C[i] = (map(int, input().split() ) )
 
C.sort(key=lambda s:s[1] )
 
judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)

Buggy submission (verdict: Runtime Error):
N = int(input() )
for i in range(N):
  C[i] = [map(int, input().split() ) ]
 
C.sort(key= lambda s:(s[1],s[0]) )
 
judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)

Buggy submission (verdict: Runtime Error):
N = int(input() )
for i in range(N):
  C[i] = list(map(int, input().split() ) )
 
C.sort(key= lambda s:(s[1],s[0]) )
 
 
judge = "Yes"
time = 0
for i in range(N):
  time += C[i][0]
  if time > C[i][1]:
    judge = "No"
    break
print(judge)
Problem p02678 (python)

Fixed submission:
from collections import deque

N, M = map(int, input().split())
G = [[] for _ in range(N)]
for i in range(M):
  A, B = map(int, input().split())
  G[A-1].append(B-1)
  G[B-1].append(A-1)

seen = [0 for _ in range(N)]
seen[0] = 1
shirube = [-1 for _ in range(N-1)]

stack = deque([0])
while stack:
  now = stack.popleft()
  for i in G[now]:
    if seen[i] == 0:
      seen[i] = 1
      stack.append(i)
      shirube[i-1] = now
    
for i in range(N):
  if seen[i] == 0:
    print('No')
    exit()
    
print('Yes')
for j in range(N-1):
  print(shirube[j]+1)

Buggy submission (verdict: Runtime Error):
from collections import deque

N, M = map(int, input().split())
G = [[] for _ in range(M)]
for i in range(M):
  A, B = map(int, input().split())
  G[A-1].append(B-1)
  G[B-1].append(A-1)

seen = [0 for _ in range(N)]
seen[0] = 1
shirube = [-1 for _ in range(N-1)]

stack = deque([0])
while stack:
  now = stack.popleft()
  for i in G[now]:
    if seen[i] == 0:
      seen[i] = 1
      stack.append(i)
      shirube[i-1] = now
    
for i in range(N):
  if seen[i] == 0:
    print('No')
    exit()
    
print('Yes')
for j in range(N-1):
  print(shirube[j]+1)

Buggy submission (verdict: Runtime Error):
from collections import deque

N, M = map(int, input().split())
G = [[] for _ in range(M)]
for i in range(M):
  A, B = map(int, input().split())
  G[A-1].append(B-1)
  G[B-1].append(A-1)

seen = [0 for _ in range(N)]
seen[0] = 1
shirube = [-1 for _ in range(N-1)]

stack = deque([0])
while stack:
  now = stack.popleft()
  for i in G[now]:
    if seen[i] == 0:
      seen[i] = 1
      stack.append(i)
      shirube[i-1] = now
    
for i in range(N):
  if seen[i] == 0:
    print('No')
    break
else:
  print('Yes')
  for j in range(N-1):
    print(shirube[j]+1)
Problem p03160 (python)

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

if N == 2:
  print(abs(h[1]-h[0]))
  exit()

dp = [0 for _ in range(N)]
dp[1] = abs(h[1] - h[0])
for i in range(2, N):
  dp[i] = min(dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1]))

print(dp[N-1])

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

INF = sum(h)*2
dp = [0 for _ in range(N)]

for i in range(1, N):
  dp[i] = min([dp[i-j-1]+abs(h[i]-h[i-j-1]) for j in range(min(i,K))])

print(dp[N-1])
Problem p03263 (python)

Fixed submission:
H, W = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(H)]

N = 0
ans = []
for hi in range(H):
  for wi in range(W-1):
    if a[hi][wi]%2 == 1:
      N += 1
      a[hi][wi+1] += 1
      ans.append((hi+1, wi+1, hi+1, wi+2))
      
for hi in range(H-1):
  if a[hi][-1]%2 == 1:
    N += 1
    a[hi+1][-1] += 1
    ans.append((hi+1, W, hi+2, W))
    
print(N)
for y, x, yp, xp in ans:
  print(y, x, yp, xp)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(H)]

N = 0
ans = []
for hi in range(H):
  for wi in range(W-1):
    if a[hi][wi]%2 == 1:
      N += 1
      a[hi][wi+1] += 1
      ans.append((hi+1, wi+1, hi+1, wi+2))
      
for hi in range(H-1):
  if a[hi][-1]%2 == 1:
    N += 1
    a[hi+1][wi] += 1
    ans.append((hi+1, W, hi+2, W))
    
print(N)
for y, x, yp, xp in ans:
  print(y, x, yp, xp)
Problem p03266 (python)

Fixed submission:
n,k=map(int,input().split())
if k%2==1:
  print((n//k)**3)
else:
  m=n*2//k
  if m%2==1:
    print(((m-1)//2)**3+((m+1)//2)**3)
  else:
    print((m**3)//4)

Buggy submission (verdict: Runtime Error):
31415 9265
Problem p03289 (python)

Fixed submission:
S = input()
abc = 'abcdefghijklmnopqrstuvwxyz'
if S[0] == 'A':
  if S[2:len(S)-1].count('C') == 1:
    for c in S:
      if (c!='A') and (c!='C') and (c not in abc):
        print('WA')
        exit()
    else:
      print('AC')
  else:
    print('WA')
else:
  print('WA')

Buggy submission (verdict: Runtime Error):
s=input()
if s[0:1]!='A':
  print('WA')
  exit()
t=s[2:len(s)-1]
countc=0
for i in range(len(t)):
  if t[i]=='C':
    countc+=1
if countc!=1:
  print('WA')
  exit()
for i in range(1,len(s)):
  if s[i:i+1]!='C' and s[i:i+1].isupper():
    print('WA')
    exit()
print('AC')

















for i in range(100*d):
  for j in range(d):
    if i+1==p[j]:
      tugi=max(tugi,j+1+c[j])
    elif i+1<p[j]:
      tugi=max(tugi,j+1)
  ten+=tugi
  tugi=0
  print(ten)
  if ten>=g:
    print(i+1)
    exit()
Problem p03337 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
print(max(a+b,a-b,a*b))