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

Fixed submission:
N = int(input())
X = []
Y = []
Height =[] 
for i in range(N):
    x,y,h = map(int,input().split())
    X.append(x)
    Y.append(y)
    Height.append(h)
List = []
flag = 0
for i in range(N):
    if flag ==1:
        break
    if Height[i]==0:
        continue
    else:
        for Cx in range(101):
            for Cy in range(101):
                tmp_h = Height[i]+abs((X[i]-Cx))+abs((Y[i]-Cy))
                if tmp_h >= 1 :
                    List.append([Cx,Cy,tmp_h])
        flag = 1
     
    #1個目のx,y,hからCx,Cy,Hの候補を作り(List)，他のx,y,hは候補と照らし合わせながら答えを探す．
    #制約が小さいからできる全探索

for i in range(1,N):
    for j in List[:]:
        if Height[i] == max(j[2]-abs((X[i]-j[0]))-abs((Y[i]-j[1])),0):
            continue
        else:
            List.remove(j)

print(List[-1][0],List[-1][1],List[-1][2])

Buggy submission (verdict: Runtime Error):
N = int(input())
X = []
Y = []
Height =[] 
for i in range(N):
    x,y,h = map(int,input().split())
    X.append(x)
    Y.append(y)
    Height.append(h)

List = []
for Cx in range(101):
    for Cy in range(101):
        tmp_h = Height[-1]+abs((Cx-X[-1]))+abs((Cy-Y[-1]))
        if tmp_h >= 1:
            List.append([Cx,Cy,tmp_h])
    
#1個目のx,y,hからCx,Cy,Hの候補を作り(List)，他のx,y,hは候補と照らし合わせながら答えを探す．
#制約が小さいからできる全探索

for i in range(1,N-1):
    for j in List[:]:
        if Height[i] == max(j[2]-abs(X[i]-j[0])-abs(Y[i]-j[1]),0):
            continue
        else:
            List.remove(j)

print(List[0][0],List[0][1],List[0][2])

Buggy submission (verdict: Runtime Error):
N = int(input())
X = []
Y = []
Height =[] 
for i in range(N):
    x,y,h = map(int,input().split())
    X.append(x)
    Y.append(y)
    Height.append(h)
List = []
for Cx in range(101):
    for Cy in range(101):
        tmp_h = Height[0]+abs((X[0]-Cx))+abs((Y[0]-Cy))
        if tmp_h >= 1:
            List.append([Cx,Cy,tmp_h])

#1個目のx,y,hからCx,Cy,Hの候補を作り(List)，他のx,y,hは候補と照らし合わせながら答えを探す．
#制約が小さいからできる全探索

for i in range(1,N):
    for j in List[:]:
        if Height[i] == max(j[2]-abs((X[i]-j[0]))-abs((Y[i]-j[1])),0):
            continue
        else:
            List.remove(j)
print(List[0][0],List[0][1],List[0][2])
Problem p03353 (python)

Fixed submission:
s = list(input())
k =  int(input())
s.append((''))
Dict = {}
dict_keys = []
for left in range(len(s)):
    for right in range(left+1,len(s)):
        string = ''.join(s[left:right])
        if len(string)>k:
            break
        if string not in Dict.keys():
            Dict[string] = True
Dict = sorted(Dict.keys())
print(Dict[k-1])

Buggy submission (verdict: Runtime Error):
s = list(input())
k =  int(input())
s.append((''))
Dict = {}
dict_keys = []
for left in range(len(s)):
    for right in range(left+1,len(s)):
        string = ''.join(s[left:right])
        if len(string)>k:
            brak
        if string not in Dict.keys():
            Dict[string] = True
Dict = sorted(Dict.keys())
print(Dict[k-1])
Problem p03386 (python)

Fixed submission:
a,b,k = map(int,input().split())
List =[]

ans = []

for i in range(a,min(a+k,b+1)):
    ans.append(i)
for i in range(b,max(b-k,a),-1):
    ans.append(i)

ans = list(set(ans))
ans.sort()
for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
a,b,K = map(int,input().split())
List =[]
for i in range(a,b+1):
    List.append(i)
for i in range(K):
    print(List[i])
for i in range(b-a+1-K,len(List)):
    print(List[i])
Problem p03436 (python)

Fixed submission:
import collections
H,W = map(int,input().split())
Map = []
black_cnt = 0
for i in range(H):
    tmp = list(input())
    black_cnt += tmp.count('#')
    Map.append(tmp)

Counter = [[float('inf') for j in range(W)]for i in range(H)]
Visited = [[False for j in range(W)]for i in range(H)]
q = collections.deque()
q.append((0,0,0))
while q:
    y,x,cnt = q.popleft()
    if 0>y or H<=y or 0>x or W<=x:
        continue
    if Map[y][x] == '#':
        continue
    if cnt > Counter[y][x]:
        continue
    if Visited[y][x]:
        continue
    Visited[y][x]=True
    Map[y][x] = cnt
    cnt += 1
    q.append((y+1,x,cnt))
    q.append((y-1,x,cnt))
    q.append((y,x+1,cnt))
    q.append((y,x-1,cnt))
if Visited[H-1][W-1] == False:
    print('-1')
else:
    print(H*W-Map[H-1][W-1]-black_cnt-1)

Buggy submission (verdict: Runtime Error):
import collections
H,W = map(int,input().split())
Map = []
black_cnt = 0
for i in range(H):
    tmp = list(input())
    black_cnt += tmp.count('#')
    Map.append(tmp)

Counter = [[float('inf') for j in range(W)]for i in range(H)]
Visited = [[False for j in range(W)]for i in range(H)]
q = collections.deque()
q.append((0,0,0))
while q:
    y,x,cnt = q.popleft()
    if 0>y or H<=y or 0>x or W<=x:
        continue
    if Map[y][x] == '#':
        continue
    if cnt > Counter[y][x]:
        continue
    if Visited[y][x]:
        continue
    Visited[y][x]=True
    Map[y][x] = cnt
    cnt += 1
    q.append((y+1,x,cnt))
    q.append((y-1,x,cnt))
    q.append((y,x+1,cnt))
    q.append((y,x-1,cnt))
print(H*W-Map[H-1][W-1]-black_cnt-1)
Problem p03633 (python)

Fixed submission:
import numpy as np
n = int(input())
T = [int(input()) for i in range(n)]

print(np.lcm.reduce(T))

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
T = [int(input()) for i in range(n)]

T_list = np.array(T)
print(np.lcm.reduce(T_list))
Problem p03637 (python)

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

cnt4,cnt2,cnt = 0,0,0

for i in A:
    if i%4==0:
        cnt4 += 1
    elif i%2==0:
        cnt2 += 1
    else:
        cnt += 1
cnt += cnt2%2

if cnt4+1>=cnt:
    print('Yes')
else:
    print('No')

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

def trial_division(n):
    Num = n
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return [Num]
    else:
        factor.append(n)
        return factor


List = [[] for i in range(N)]
for i in range(N):
    tmp = trial_division(A[i])
    tmp = collections.Counter(tmp)
    List[i] = tmp[2]

cnt0,cnt1,cnt2 = 0,0,0
for i in range(len(List)):
    if List[i]==1 and List[i+1]!=1:
        cnt0 += 1

    if List[i]==0:
        cnt0+=1
        
    elif List[i]==1:
        cnt1+=1
        
    else:
        cnt2 += 1
        


if cnt2+1>=cnt0:
    print('Yes')
else:
    print('No')

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

def trial_division(n):
    Num = n
    #素因数を格納するリスト
    factor = []
    #2から√n以下の数字で割っていく
    tmp = int(math.sqrt(n)) + 1
    for num in range(2,tmp):
        while n % num == 0:
            n //= num
            factor.append(num)
    #リストが空ならそれは素数
    if not factor:
        return [Num]
    else:
        factor.append(n)
        return factor


List = [[] for i in range(N)]
for i in range(N):
    tmp = trial_division(A[i])
    tmp = collections.Counter(tmp)
    List[i] = tmp[2]

cnt0,cnt1,cnt2 = 0,0,0
for i in range(len(List)):
    if List[i]==1 and List[i+1]!=1:
        cnt0 += 1

    if List[i]==0:
        cnt0+=1
        
    elif List[i]==1:
        cnt1+=1
        
    else:
        cnt2 += 1
        


if cnt2+1>=cnt0:
    print('YES')
else:
    print('NO')
Problem p03673 (python)

Fixed submission:
import collections
N = int(input())
A = [i for i in input().split()]

ans = collections.deque()
for i in range(N):
    if (i+1)%2==N%2:
        ans.appendleft(A[i])
    else:
        ans.append(A[i])
print(*ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [str(i) for i in input().split()]
dp = [[0,0] for i in range(N+1)]

dp[0][0],dp[0][1] = A[0],A[0]
for i in range(1,N):
    dp[i][0] = dp[i-1][1]+A[i]
    dp[i][1] = A[i]+dp[i-1][0]
ans = list(dp[N-1][1])
print(*ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [str(i) for i in input().split()]
dp = [[0,0] for i in range(N+1)]

dp[0][0],dp[0][1] = A[0],A[0]
for i in range(1,N):
    dp[i][0] = dp[i-1][1]+A[i]
    dp[i][1] = A[i]+dp[i-1][0]
ans = list(dp[N-1][1])
print(*ans)
Problem p03854 (python)

Fixed submission:
S = list(input())
tmp = ''
L = len(S)
S = S[-1:-L-1:-1]
Kouho = ['maerd','remaerd','esare','resare']
ans = 0
for i in range(L):
    
    tmp += str(S[i])
    if tmp in Kouho:
        ans += len(tmp)
        tmp = ''
if ans == L:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
S = list(input())
tmp = ''
L = len(S)
S.append('0')
S.append('0')
ans = 0
for i in range(L):
    tmp += str(S[i])
    if tmp=='dream':
        if tmp+str(S[i+1])+str(S[i+2])+str(S[i+3])=='dreamera':
            ans += len(tmp)
            tmp = ''
        elif tmp+str(S[i+1])+str(S[i+2])=='dreamer':
            ans += len(tmp)+2
            tmp = ''
            i+=2
        else:
            ans += len(tmp)
            tmp = ''
    if tmp == 'erase':
        if tmp+str(S[i+1])=='eraser':
            ans += len(tmp)+1
            tmp  = ''
            i+=1
        else:
            ans += len(tmp)
            tmp = ''
if ans == L:
    print('YES')
else:
    print('NO')
Problem p02767 (python)

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
x.sort()
ans = float("inf")

for i in range(x[0], x[-1]+1):
    t = 0
    for q in range(n):
        t += (i - x[q]) ** 2
    else:
        if ans > t:
            ans = t

print(ans)

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

for i in range(n):
    if k ** (i - 1) <= n < k ** i:
        ans = i
        break
if ans == 0:
    ans += 1
print(ans)
Problem p02780 (python)

Fixed submission:
n,k = map(int, input().split())
p = list(map(int, input().split()))
ans = 0

for i in range(n-k+1):
    if i==0:
        t=sum(p[0:k])
    else:
        t=t-p[i-1]+p[i+k-1]
    ans=max(ans,t)

print((ans+k)/2)

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

for i in range(n-k+1):
    if i==0:
        t=sum(p[0:k])
    else:
        t=t-p[i-1]+p[i+k-1]
    ans=max(ans,ts)

print((ans+k)/2)
Problem p02843 (python)

Fixed submission:
n = int(input())
ni = n%100
da = n//100

if n < 100:
    print("0")
elif ni == 0:
    print("1")
else:
    for a in range(ni):
        for b in range(ni):
            for c in range(ni):
                for d in range(ni):
                    for e in range(ni):
                        if a + b*2 + c*3 + d*4 + e*5 == ni :
                            break
                    else:
                        continue
                    break
                else:
                    continue
                break
            else:
                continue
            break
        else:
            continue
        break
    if a+b+c+d+e <=da:
        print("1")
    else:
        print("0")

Buggy submission (verdict: Runtime Error):
n = int(input())
ni = n%100
da = n//100

for a in range(ni):
    for b in range(ni):
        for c in range(ni):
            for d in range(ni):
                for e in range(ni):
                    if a + b*2 + c*3 + d*4 + e*5 == ni :
                        break
                else:
                    continue
                break
            else:
                continue
            break
        else:
            continue
        break
    else:
        continue
    break
if a+b+c+d+e <=da:
    print("1")
else:
    print("0")
Problem p02953 (python)

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

for i in range(0,n-1):
    l = h[-(2+i)]
    r = h[-(1+i)]
    if l - r == 1:
        h[-(2+i)] = l-1
    elif l - r > 1 :
        print("No")
        break
else:
    print("Yes")

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

if h[-2] - h[-1] >1:
    print("No")

else:
    for i in range(1,n-1):
        l = h[-(2+i)]
        r = h[-(1+i)]
        if l - r < -1:
            print("No")
            break
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
if h[-2] - h[-1] >1:
    print("No")

else:
    for i in range(1,n-1):
        l = h[-(2+i)]
        r = h[-(1+i)]
        if l - r < -1:
            print("No")
            break
    else:
        print("Yes")
Problem p02995 (python)

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

x = (c*d)//fractions.gcd(c,d)
A = (a-1) - (a-1)//c - (a-1)//d + (a-1)//x
B = b - b//c - b//d + b//x
print(int(B-A))

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

x = c*d/math.gcd(c,d)
A = (a-1) - (a-1)//c - (a-1)//d +x
B = b - (b-1)//c - (b-1)//d +x
print(int(B-A))
Problem p03076 (python)

Fixed submission:
l =[]
for i in range(5):
    a = int(input())
    l.append(a)

x =[]
j=[]
for i in l:
    t = i%10
    if t != 0:
        x.append(t)
        j.append(i+10-t)
    else:
        j.append(i)

if len(x) == 0:
    print(sum(j))
else:
    print(sum(j)-10+min(x))

Buggy submission (verdict: Runtime Error):
l =[]
for i in range(5):
    a = int(input())
    l.append(a)

x =[]
j=[]
for i in l:
    t = i%10
    if t != 0:
        x.append(t)
        j.append(i+10-t)
    else:
        j.append(i)

print(sum(j)-10+min(x))
Problem p03164 (python)

Fixed submission:
n, mw = map(int, input().split())
w = []
v = []

for i in range(n):
    ww, vv = map(int, input().split())
    w.append(ww)
    v.append(vv)

dp = [[float("inf")] * (n*(10**3+1)) for i in range(n + 1)]
dp[0][0] = 0

for i in range(n):
    for j in range(n*1001):
        if j < v[i]:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]]+w[i])

for i in range(n * 1001):
    if dp[n][i] <= mw:
        ans = i

print(ans)

Buggy submission (verdict: Runtime Error):
n, mw = map(int, input().split())
w = []
v = []

for i in range(n):
    ww, vv = map(int, input().split())
    w.append(ww)
    v.append(vv)

dp = [[0] * (mw + 1) for i in range(n + 1)]

for i in range(n):
    for j in range(mw + 1):
        if j < w[i]:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])

print(dp[n][mw])
Problem p03497 (python)

Fixed submission:
import collections
n, k = map(int, input().split())
a = list(map(int, input().split()))
t = 0
ans = n

l = collections.Counter(a)
x = l.most_common(k)

for i in range(len(x)):
    t += x[i][1]

ans -= t
if ans < 0:
    ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n, k = map(int, input().split())
a = list(map(int, input().split()))
t = 0
ans = n

l = collections.Counter(a)
x = l.most_common(k)

for i in range(k):
    t += x[i][1]

ans -= t
if ans < 0:
    ans = 0
print(ans)
Problem p03284 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split());print([1,0][a%b==0]))
Problem p03337 (python)

Fixed submission:
A,B = map(int,input().split())
sum = A + B
dif = A - B
pro = A * B
if sum > dif:
    if sum > pro:
        print(sum)
    else:
        print(pro)
elif dif > pro:
    print(dif)
else:
    print(pro)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
c = 0
list_s = [sorted(list(set(s[:i]))) for i in range(1,n)]
list_l = [sorted(list(set(s[i:]))) for i in range(1,n)]
print(max([sum([1 if list_s[j][i] in list_l[j] else 0 for i in range(len(list_s[j]))]) for j in range(n-1)]))
Problem p03351 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
print( "Yes" if (abs(b-a) <=d and abs(c-b) <=d) or abs(c-a) <=d else "No")

Buggy submission (verdict: Runtime Error):
x = int(input())
print(max([max([i**j for j in range(2,x) if x >= i**j]) for i in range(2,x) if i**2 <=x]))
Problem p03369 (python)

Fixed submission:
S = list(input())
price = 700
for i in range(len(S)):
    if S[i] == "o":
        price += 100
print(price)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
m = []
for i in range(n):
    m += map(int,input().split())
print(n + (x - sum(m)) // min(m))

Buggy submission (verdict: Runtime Error):
S = list(input())
price = 700
for i in S:
    if S[i] == "○":
        price += 100
print(price)

Buggy submission (verdict: Runtime Error):
S = list(input())
price = 700
for i in S:
    if S[i] == "○":
        price += 100
print(price)
Problem p03377 (python)

Fixed submission:
A,B,X = map(int,input().split())
print("YES" if A <= X <=(A+B) else "NO")

Buggy submission (verdict: Runtime Error):
A,B,X = map(int,input().split())
print("Yes" if A < X and (A+B) > x else "No")
Problem p03473 (python)

Fixed submission:
print(24+(24-int(input())))

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
s = input().split("-")
print("Yes" if len(s[0])==a and len(s[1])==b else "No")

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
s = input().split("-")
print("Yes" if len(s[0])==a and len(s[1])==b else "No")
Problem p02760 (python)

Fixed submission:
a=[]
b=[]
nums=[]
ans="No"

for i in range(3):
    l=list(map(int,input().split()))
    a.append(l)

n=int(input())

for i in range(n):
    s=int(input())
    b.append(s)

for i in range(n):
    for j in range(3):
        for k in range(3):
            if b[i]==a[j][k]:
                a[j][k]=0
                num=10*(j+1)+k+1
                nums.append(num)

nums.sort()


if a[0][0]==a[0][1]==a[0][2]==0:
    ans="Yes"
if a[1][0]==a[1][1]==a[1][2]==0:
        ans="Yes"
if a[2][0]==a[2][1]==a[2][2]==0:
    ans="Yes"
if a[0][0]==a[1][0]==a[2][0]==0:
    ans="Yes"
if a[0][1]==a[1][1]==a[2][1]==0:
        ans="Yes"
if a[0][2]==a[1][2]==a[2][2]==0:
    ans="Yes"
        
if 11 in nums and 22 in nums and 33 in nums:
    ans="Yes"

if 13 in nums and 22 in nums and 31 in nums:
    ans="Yes"
    
print(ans)

Buggy submission (verdict: Runtime Error):
a=[]
b=[]
nums=[]
ans="No"

for i in range(3):
    l=list(map(int,input().split()))
    a.append(l)

n=int(input())

for i in range(n):
    s=int(input())
    b.append(s)

for i in range(n):
    for j in range(3):
        for k in range(3):
            if b[i]==a[j][k]:
                a[j][k]=0
                num=10*(j+1)+k+1
                nums.append(num)

nums.sort()


if A[0][0]==A[0][1]==A[0][2]==0:
    ans="Yes"
if A[1][0]==A[1][1]==A[1][2]==0:
        ans="Yes"
if A[2][0]==A[2][1]==A[2][2]==0:
    ans="Yes"
if A[0][0]==A[1][0]==A[2][0]==0:
    ans="Yes"
if A[0][1]==A[1][1]==A[2][1]==0:
        ans="Yes"
if A[0][2]==A[1][2]==A[2][2]==0:
    ans="Yes"
        
if 11 in nums and 22 in nums and 33 in nums:
    ans="Yes"

if 13 in nums and 22 in nums and 31 in nums:
    ans="Yes"
    
print(ans)
Problem p02887 (python)

Fixed submission:
n=int(input())
s=list(input())
cnt=1
s1=s[0]
for i in range(n-1):
    if s[i]!=s[i+1]:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(input())
cnt=len(s)
s1=s[1]
for i in range(1,n):
    if s[i]==s1:
        cnt-=1
    s1=s[i]
print(cnt)
Problem p02923 (python)

Fixed submission:
n=int(input())
h=list(map(int,input().split()))
cnt=0
ls=[0]*n
for i in range(n-1):
    if h[i]>=h[i+1]:
        cnt+=1
    else:
        ls[i]=cnt
        cnt=0
ls[-1]=cnt
print(max(ls))

Buggy submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))
cnt=0
ls=[]
i=0
while len(h)!=1:
    if h[i]>=h[i+1]:
        cnt+=1
        i+=1
        if i==len(h)-1:
          ls.append(cnt)
          cnt=0
          h.pop(0)
          i=0
          
    else:
        ls.append(cnt)
        cnt=0
        h.pop(0)
        i=0
print(max(ls))
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())
 
s=c*d//fractions.gcd(c, d)
bk=0
ak=0
ans=0
bc=b//c
ac=a//c    
bd=b//d
ad=a//d
bsa=b//s
asa=a//s
bk=b-bc-bd+bsa
ak=a-ac-ad+asa
ans=bk-ak
if a%c==0 or a%d==0 or a%s==0:
    ans=ans
else:
    ans+=1
print(ans)

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

s=c*d//fractions.gcd(c, d)
bk=0
ak=0
ans=0
bc=b//c
ac=a//c    
bd=b//d
ad=a//d
bsa=b//s
asa=a//s
bk=b-bc-bd+bsa
ak=a-ac-ad+asa
ans=bk-ak
if a%c!=0 or a%d!=0 or a%s!=0:
    ans+=1
elif:
  b%c==0 or b%d==0 or b%s==0
else:
  ans=ans
print(ans)
Problem p03331 (python)

Fixed submission:
N=input()
if int(N)%10==0:
    print(10)
else:
    ans = 0
    for i in range(len(N)):
        ans+= int(N[i])
    print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N%10==0:
    print(10)
else:
    ans = 0
    for i in range(len(N)):
        ans+= int(N[i])
        print(ans)

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

if N%10==0:
    print(10)
else:
    ans = 0
    for i in range(len(N)):
        ans+= int(N[i])
        print(ans)
Problem p03814 (python)

Fixed submission:
s=input()

a=s.find('A')

for i in range(a,len(s)):
    if s[i] == "Z":
        z=i
print(z-a+1)

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

for i in range(0,len(s)):
    if s[i] == "A":
        a = i
        break
for i in range(a,len(s)):
    if s[i] == "Z":
        z = i
        break
print(len(s[a:z+1])
Problem p02678 (python)

Fixed submission:
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10


# N個の部屋とM本の通路
N, M = [int(x) for x in stdin.readline().rstrip().split()]

route = [[] for _ in range(N+1)]

for _ in range(M):
    A, B = [int(x) for x in stdin.readline().rstrip().split()]
    route[A].append(B)
    route[B].append(A)


kyori_to_1 = [INF for _ in range(N+1)]
kyori_to_1[1] = 0

miti = [0 for _ in range(N+1)]
miti[0] = -1
miti[1] = -1

is_visited = [False for _ in range(N+1)]

# 幅優先探索
# 試すべき位置をキューで管理
que = deque([1])

# キューが空じゃなければ
while len(que) != 0:
    now = que.popleft()
    
    if is_visited[now]:
        continue

    is_visited[now] = True

    for place in route[now]:
        que.append(place)

        if kyori_to_1[now]+1 < kyori_to_1[place]:
            kyori_to_1[place] = kyori_to_1[now]+1
            miti[place] = now

if 0 in miti:
    print("No")
else:
    for i in range(1, N+1):
        if i == 1:
            print("Yes")
        else:
            print(miti[i])

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10


# N個の部屋とM本の通路
N, M = [int(x) for x in stdin.readline().rstrip().split()]

route = [[] for _ in range(M+1)]

for _ in range(M):
    A, B = [int(x) for x in stdin.readline().rstrip().split()]
    route[A].append(B)
    route[B].append(A)


kyori_to_1 = [INF for _ in range(N+1)]
kyori_to_1[1] = 0

miti = [0 for _ in range(N+1)]
miti[0] = -1
miti[1] = -1

is_visited = [False for _ in range(N+1)]

# 幅優先探索
# 試すべき位置をキューで管理
que = deque([1])

# キューが空じゃなければ
while len(que) != 0:
    now = que.popleft()
    
    if is_visited[now]:
        continue

    is_visited[now] = True

    for place in route[now]:
        que.append(place)

        if kyori_to_1[now]+1 < kyori_to_1[place]:
            kyori_to_1[place] = kyori_to_1[now]+1
            miti[place] = now

if 0 in miti:
    print("No")
else:
    for i in range(1, N+1):
        if i == 1:
            print("Yes")
        else:
            print(miti[i])