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

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

def f(b, n):
    if n < b:
        return n
    else:
        return f(b, n//b) + (n % b)

def solve(N, S):
    if S > N:
        return -1
    elif N == S:
        return N+1
    else:
        for b in range(2, int(N**(1/2))+1):
            if f(b, N) == S:
                return b
        for p in range(int(N**(1/2)), 0, -1):
            if (N - S) % p == 0:
                b = (N - S) // p + 1
                if f(b, N) == S:
                    return b
        return -1

print(solve(N, S))

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

def f(b, n):
    if n < b:
        return n
    else:
        return f(b, int(n/b)) + (n % b)

def solve(N, S):
    if N == S:
        return N+1
    else:
        for b in range(2, int(N**(1/2))+1):
            if f(b, N) == S:
                return b
        for p in range(1, int(N**(1/2))+1):
            b = int((N - S) / p + 1)
            if f(b, N) == S:
                return b
        return -1

print(solve(N, S))
Problem p04029 (python)

Fixed submission:
N = int(input())
print(sum([i for i in range(1, N+1)]))

Buggy submission (verdict: Runtime Error):
N = int(input())
print(sum([i for i in range(1, N+1)])
Problem p02684 (python)

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

passed = [-1] * (n+1)
route = []
v = 1
while passed[v] == -1:
    passed[v] = len(route)
    route.append(v)
    v = a[v-1]

c = len(route) - passed[v]
l = passed[v]

if k < l:
    print(route[k])
else:
    k -= l
    k %= c
    print(route[l+k])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
tmp = list(map(int, input().split()))
A = [1]
A.extend(tmp)

# 循環する場所を探す(最大N回)
used = [1, 1]
used.extend([0] * (N-1)) # すでに通った町は1にする
route = [1]
while used[A[route[-1]]] == 0:
    used[A[route[-1]]] = 1
    route.append(A[route[-1]])

if A.index(A[route[-1]]) == 0:
    print(route[K%(len(route))])
else:
    x = A.index(A[route[-1]]) - 1
    y = len(route) - x
    if y == 0:
        print(route[x])
    else:
        print(route[x + (K-x)%y])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
tmp = list(map(int, input().split()))
A = [1]
A.extend(tmp)

# 循環する場所を探す(最大N回)
used = [1, 1]
used.extend([0] * (N-1)) # すでに通った町は1にする
route = [1]
while used[A[route[-1]]] == 0:
    used[A[route[-1]]] = 1
    route.append(A[route[-1]])

if A.index(A[route[-1]]) == 0:
    print(route[K%(len(route))])
else:
    x = A.index(A[route[-1]]) - 1
    y = len(route) - x
    print(route[x + (K-x)%y])
Problem p03737 (python)

Fixed submission:
# -*- coding: utf-8 -*-

s1, s2, s3 = input().split()
print((''.join([s1[0], s2[0], s3[0]])).upper())

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

A = input()
B = input()
if len(A) > len(B):
    print('GREATER')
elif len(A) < len(B):
    print('LESS')
else:
    if A > B:
        print('GREATER')
    elif A < B:
        print('LESS')
    else:
        print('EQUAL')

Buggy submission (verdict: Runtime Error):
A = input()
B = input()
if len(A) == len(B):
    if A > B:
        print('GREATER')
    else:
        print('LESS')
elif len(A) > len(B):
    print('GREATER')
else:
    print('LESS')
Problem p03738 (python)

Fixed submission:
# -*- coding: utf-8 -*-

A = input()
B = input()
if len(A) > len(B):
    print('GREATER')
elif len(A) < len(B):
    print('LESS')
else:
    for i in range(len(A)):
        if A[i] > B[i]:
            print('GREATER')
            exit()
        elif A[i] < B[i]:
            print('LESS')
            exit()
        else:
            continue
    print('EQUAL')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

A = map(int, input())
B = map(int, input())
if A > B:
    print('GREATER')
elif A < B:
    print('LESS')
else:
    print('EQUAL')
Problem p03844 (python)

Fixed submission:
a, op, b = input().split()
a = int(a)
b = int(b)
if op == '+':
    print(a + b)
else:
    print(a - b)

Buggy submission (verdict: Runtime Error):
a, op, b = input().split()
a = int(a)
b = int(b)
print(a op b)
Problem p03061 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
def divi(a, b):
    rem = b % a
    if rem == 0:
        return a
    else:
        return divi(rem, a)
A.sort()
all_d = divi(A[0], A[1])
max_d = max(all_d, max(divi(A[1],A[2]), divi(A[0],A[2]))) if N > 2 else A[1]
for i in range(2,N):
    d = divi(all_d, A[i])
    max_d = divi(max_d, A[i])
    if max_d < all_d:
        max_d = all_d
    all_d = d
print(max_d)

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

A.sort()
all_d = A[0]
max_d = max(divi(A[0],A[1]), divi(A[0],A[2])) if N > 2 else A[1]
for i in range(1,N):
    all_d = divi(all_d, A[i])
    if max_d < all_d:
        max_d = all_d
print(max_d)
Problem p03126 (python)

Fixed submission:
N, M = map(int, input().split())
Fm = [0]*M
KA = [list(map(int, input().split())) for _ in range(N)]
for n in range(N):
  #KA = list(map(int, input().split()))
  for i in range(KA[n][0]):
    Fm[KA[n][i+1]-1] += 1
ans = 0
for m in range(M):
  if Fm[m] == N:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
Fm = [0]*M
KA = [list(map(int, input().split())) for _ in range(N)]
for n in range(N):
  for i in range(KA[n][0]):
    Fm[KA[n][i+1]] += 1
ans = 0
for m in range(M):
  if Fm[m] == N:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
Fm = [0]*M
for n in range(N):
  KA = list(map(int, input().split()))
  for i in range(KA[0]):
    Fm[KA[i+1]] += 1
ans = 0
for m in range(M):
  if Fm[m] == N:
    ans += 1
print(ans)
Problem p02714 (python)

Fixed submission:
N = int(input())
s = list(input())
r = 0;g = 0;b= 0
for i in s:
    if i=="R":
        r += 1
    elif i=="G":
        g += 1
    else:
        b += 1
all = r*g*b
sub = 0
for i in range(N-1):
    for j in range(i+1,N):
        if s[i]==s[j]:
            continue
        k = 2*j - i
        if k >= N:
            continue
        else:
            if (s[k]!=s[i] and s[k]!=s[j]):
                sub += 1
print(all-sub)

Buggy submission (verdict: Runtime Error):
N = int(input())
s = list(input())
counts = dict(Counter(s))
r = 0;g = 0;b= 0
for i in s:
    if i=="R":
        r += 1
    elif i=="G":
        g += 1
    else:
        b += 1
all = r*g*b
sub = 0
for i in range(N-1):
    for j in range(i+1,N):
        if s[i]==s[j]:
            continue
        k = 2*j - i
        if k >= N:
            continue
        else:
            if (s[k]!=s[i] and s[k]!=s[j]):
                sub += 1
print(all-sub)
Problem p02732 (python)

Fixed submission:
import collections
import math

def func(n):
    ans = math.factorial(n)//((math.factorial(n-2))*math.factorial(2))
    return ans

N = int(input())
a = input().split()
ans = dict(collections.Counter(a))
sums = 0
for i in ans.values():
        if i < 2:
            continue
        else:
            sums += func(i)
            
for j in range(N):  
    print(sums-(ans[a[j]]-1))

Buggy submission (verdict: Runtime Error):
import collections
N = int(input())
a = input().split()

for j in range(N):
    sums = 0
    a1 = a.copy()
    a1.pop(j)
    ans = dict(collections.Counter(a1))
    for i in ans.values():
        if i < 2:
            continue
        else:
            sums += func(i)
    print(sums)
    #print(a1)
    #print(ans)
Problem p02743 (python)

Fixed submission:
a,b,c = map(int,input().split())
x = c-a-b
if x <= 0:
    print('No')
else:
    if x*x > 4* a*b:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
import math
a,b,c = map(int,input().split())
ans = math.sqrt(c*a) - math.sqrt(c*b)
if 1 < ans/(a-b):
    print('Yes')
else:
    print('No')
Problem p02755 (python)

Fixed submission:
a,b = map(int,input().split())
if int(a/(0.08)) == int(b/(0.1)):
    mn = int(a/(0.08))
else:
    inter = abs(int(a/(0.08)) - int(b/(0.1)))
    mn = min(int(a/(0.08)) , int(b/(0.1)))
             
    for i in range(inter*2):
        if int(mn*(0.08))==a:
            if int(mn*(0.1))==b:
                break
        mn += 1
        if i ==inter*2-1:
            mn = -1
print(mn)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if int(a/(0.08)) == int(b/(0.1)):
    cost = int(a/(0.08))
else:
    inter = abs(int(a/(0.08)) - int(b/(0.1)))
    mn = min(int(a/(0.08)) , int(b/(0.1)))
             
    for i in range(inter*2):
        if int(cost*(0.08))==a:
            if int(cost*(0.1))==b:
                break
        mn += 1
        if i ==inter*2-1:
            cost = -1
print(cost)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if int(a/(0.08)) == int(b/(0.1)):
    cost = int(a/(0.08))
else:
    inter = abs(int(a/(0.08)) - int(b/(0.1)))
    mn = min(int(a/(0.08)) , int(b/(0.1)))
             
    for i in range(inter*2):
        if int(cost*(0.08))==a:
            if int(cost*(0.1))==b:
                break
        mn += 1
        if i ==inter:
            cost = -1
print(cost)
Problem p02756 (python)

Fixed submission:
s = input()
q = int(input())
ans_list1 = []
ans_list2 = []
flag = 1
for i in range(q):
    i = input().split()
    if i[0]=="1":
        flag *= -1
    else:
        if i[1]=='1':
            if flag==1:
                ans_list1.append(i[2])
            else:
                ans_list2.append(i[2])
        else:
            if flag==1:
                ans_list2.append(i[2])
            else:
                ans_list1.append(i[2])

if flag==1:
    print(''.join(ans_list1[::-1]) + s +''.join(ans_list2))
else:
    print(''.join(ans_list2[::-1]) + s[::-1] +''.join(ans_list1))

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
ans_list1 = []
ans_list2 = []
flag = 1
for i in range(q):
    i = input().split()
    if i[0]=="1":
        flag *= -1
    else:
        if i[1]=='1':
            if flag==1:
                ans_list1.append(i[2])
            else:
                ans_list2.append(i[2])
        else:
            if flag==1:
                ans_list2.append(i[2])
            else:
                ans_list1.append(i[2])
    
    if flag==1:
        print(''.join(ans_list1[::-1]) + s +''.join(ans_list2))
    else:
        print(''.join(ans_list2[::-1]) + s[::-1] +''.join(ans_list1))

if flag==1:
    print(''.join(ans_list1[::-1]) + s +''.join(ans_list2))
else:
    print(''.join(ans_list2[::-1]) + s[::-1] +''.join(ans_list1))

Buggy submission (verdict: Runtime Error):
s = input()
q = int(input())
q_lists = [input().split() for _ in range(q)]
hanten = 0
for i in q_lists:
    if len(i)==1:
        hanten += 1
    else:
        f = i[1]
        c = i[2]
        if hanten%2==0:
            if f=='1':
                s = c + s
            else:
                s.append(c)
        else:
            if f=="1":
                s.append(c)
            else:
                s = c + s
print(s if hanten%2==0 else s[::-1])

Buggy submission (verdict: Runtime Error):
s = [input()]
q = int(input())
for i in range(q):
    inp = input().split()
    if len(inp) == 1:
        s = s[::-1]
        print(s)
    else:
        if int(inp[1])==1:
            s.insert(0,inp[2])
        else:
            s.append(inp[2])
        print(s)
print(''.join(s))
Problem p02780 (python)

Fixed submission:
n,k = map(int,input().split())
p = [(int(i)+1)/2 for i in input().split()] #期待値にして格納

#累積和を求める
for i in range(1,n):
    p[i]=p[i-1]+p[i]
mx = p[k-1]
for i in range(k,n):
    a = p[i] - p[i-k]
    if a > mx:
        mx = a
        
print(mx)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
p = [(int(i)+1)/2 for i in input().split()] #期待値にして格納

#累積和を求める
for i in range(1,n):
    p[i]=p[i-1]+p[i]
mx = p[k]
for i in range(k,n):
    a = p[i] - p[i-k]
    print(a)
    if a > mx:
        mx = a
        
print(mx)
Problem p02791 (python)

Fixed submission:
n = int(input())
num = [int(i) for i in input().split()]
count1 = 0
minv = 0

for i in range(len(num)):
    if i ==0:
        count1 +=1
        minv = num[i]
        
    elif minv >= num[i]:
        minv = num[i]
        count1 +=1
print(count1)

Buggy submission (verdict: Runtime Error):
import  heapq
n = int(input())
num = [int(i) for i in input().split()]
count1 = 0

for i in range(len(num)):
    num1 = num[:i+1].copy()
    heapq.heapify(num1)
    if heapq.heappop(num1) == num[i]:
        count1 += 1
        
        

print(count1)
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
count = 0

for i in range(n-2):
    #print(s[i],s[i+1],s[i+2])
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
count = 0

for i in range(n-1):
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
count = 0

for i in range(n-2):
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
count = 0

for i in range(n):
    if s[i] == "A":
        if s[i+1] == "B":
            if s[i+2] == "C":
                count += 1
print(count)
Problem p02813 (python)

Fixed submission:
import itertools
n = int(input())
p =[int(i) for i in input().split()]
q =[int(i) for i in input().split()]
a = 0
b = 0
cnt = 0
p1= p.copy()
p1.sort()
n_list = list(itertools.permutations(p1))
for i in n_list:
    if list(i)==p:
        a = cnt +1
    if list(i)==q:
        b = cnt +1
    cnt += 1
        
print(abs(a-b))

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
p =[int(i) for i in input().split()]
q =[int(i) for i in input().split()]
a = 0
b = 0
cnt = 0
p1= p.copy()
p1.sort()
n_list = list(itertools.permutations(p1))
for i in n_list:
    if list(i)==p:
        a = cnt +1
    if list(i)==q:
        b = cnt +1
    cnt += 1
        
print(abs(a-b))

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
p =[int(i) for i in input().split()]
q =[int(i) for i in input().split()]
a = 0
b = 0
cnt = 0
p1= p.copy()
p1.sort()
n_list = list(itertools.permutations(p1))
for i in n_list:
    if list(i)==p:
        a = cnt +1
    elif list(i)==q:
        b = cnt +1
    cnt += 1
        
print(abs(a-b))

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
p =[int(i) for i in input().split()]
q =[int(i) for i in input().split()]
a = 0
b = 0
cnt = 0

n_list = list(itertools.permutations(p1))
for i in n_list:
    if list(i)==p:
        a = cnt +1
    elif list(i)==q:
        b = cnt +1
    cnt += 1
        
print(abs(a-b))
Problem p02900 (python)

Fixed submission:
def prime(n):
    res =set()
    while n% 2==0:
        res.add(2)
        n //= 2
    i  = 3
    while i*i <= n:
        if n % i==0:
            res.add(i)
            n //= i
        else:
            i += 2
    if n != 1:
        res.add(n)
    return res
a,b = map(int,input().split())
a = prime(a)
b = prime(b)
print(len(a&b)+1)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
minv = min(a,b)
maxv = max(a,b)
kouyaku = []
ans = kouyaku.copy()
#公約数を求める
for i in range(1,(minv//2)+1):
    if a%i==0  and b%i==0:
        kouyaku.append(i)
print(*kouyaku)
#互いに素になる数字を探す
i = 0
j = 1
kouyaku.pop()
while len(kouyaku)==i:
    while len(kouyaku)==j:
        if j%i==0:
            kouyaku.remove(j)
print(*kouyaku)
Problem p02923 (python)

Fixed submission:
n = int(input())
h = [int(i) for i in input().split()]
ans = []
i = 0
if n ==1:
    ans.append(0)
else:
    while i < n-1:
        count_min = 0
        while i<n-1 and h[i]<h[i+1]:
            i += 1
        while i<n-1 and h[i]>=h[i+1]:
            count_min += 1
            i += 1 
        ans.append(count_min)
print(max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
ans = []
i = 0
while i < n-1:
    count_min = 0
    while i<n-1 and h[i]<h[i+1]:
        i += 1
    while i<n-1 and h[i]>=h[i+1]:
        count_min += 1
        i += 1
    ans.append(count_min)
print(max(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
ans = []
i = 0
while i < n-1:
    count_min = 0
    while i<n-1 and h[i]<h[i+1]:
        i += 1
    while i<n-1 and h[i]>=h[i+1]:
        count_min += 1
        i += 1
    ans.append(count_min)
print(max(ans))
Problem p02971 (python)

Fixed submission:
n = int(input())
num = []
for i in range(n):
    num.append(int(input()))
#ここまで入力
num1 = num.copy()
num1.sort(reverse=True)
mx1 = num1[0]
mx2 = num1[1]
for i in num:
    if i==mx1:
        ans = mx2
        print(ans)
    else:
        ans = mx1
        print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
num = []
for i in range(n):
    num.append(int(input()))
#ここまで入力
num1 = num.copy()
num1.sort(reverse=True)
mx1 = num1[0]
mx2 = num1[1]
for i in num:
    if i==mx1:
        ans = mx2
        print(ans)
    else:
        ans = mx1
        print(ans)
Problem p02995 (python)

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

def count_q(a,b,m):
    if a%m==0:
        q = b//m -a//m +1
    else:
        q = b//m - a//m
    return q


def lcm(c,d):
    return (c*d)//(fractions.gcd(c,d))

da = lcm(c,d)

qc = count_q(a,b,c)
qd = count_q(a,b,d)
qe = count_q(a,b,da)
ans = (b-a+1)-(qc+qd-qe)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
dev = b- a +1
if dev % c==0:
    count = dev//c
else:
    if ((a%c)+(b%c)) < c:
        count = dev//c +1
    else:
        count = dev//c

if dev % d==0:
    count += dev//d
else:
    if ((a%d)+(b%d)) < d:
        count += dev//d +1
    else:
        count += dev//d

def lcm(c,d):
    return (c*d)//(math.gcd(c,d))
da = lcm(c,d)
if dev % (da)==0:
    count -= int(dev/(da))
else:
    if ((a%c)+(b%c)) < (da):
        count -= int(dev/(da)) 
    else:
        count -= int(dev/(da))
print(int(dev-count))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
dev = b- a +1
if dev % c==0:
    count = dev//c
else:
    if ((a%c)+(b%c)) < c:
        count = dev//c +1
    else:
        count = dev//c

if dev % d==0:
    count += dev//d
else:
    if ((a%d)+(b%d)) < d:
        count += dev//d +1
    else:
        count += dev//d

def lcm(c,d):
    return (c*d)//(math.gcd(c,d))
da = lcm(c,d)
if dev % (da)==0:
    count -= int(dev/(da))
else:
    if ((a%c)+(b%c)) < (da):
        count -= int(dev/(da)) 
    else:
        count -= int(dev/(da))
print(int(dev-count))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
dev = b- a +1
if dev % c==0:
    count = dev//c
else:
    if ((a%c)+(b%c)) < c:
        count = dev//c +1
    else:
        count = dev//c

if dev % d==0:
    count += dev//d
else:
    if ((a%d)+(b%d)) < d:
        count += dev//d +1
    else:
        count += dev//d
        
da = lcm(c,d)
if dev % (da)==0:
    count -= int(dev/(da))
else:
    if ((a%c)+(b%c)) < (da):
        count -= int(dev/(da)) 
    else:
        count -= int(dev/(da))
print(int(dev-count))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int,input().split())
dev = b- a +1
if dev % c==0:
    count = dev//c
else:
    if ((a%c)+(b%c)) < c:
        count = dev//c +1
    else:
        count = dev//c

if dev % d==0:
    count += dev//d
else:
    if ((a%d)+(b%d)) < d:
        count += dev//d +1
    else:
        count += dev//d
        
da = lcm(c,d)
if dev % (da)==0:
    count -= int(dev/(da))
else:
    if ((a%c)+(b%c)) < (da):
        count -= int(dev/(da)) 
    else:
        count -= int(dev/(da))
print(int(dev-count))
Problem p03076 (python)

Fixed submission:
s = 0
rests = [None]*5

for i in range(5):
    t_num = int(input())
    s += t_num
    rests[i] = (10 - (t_num % 10)) % 10 

print(s + sum(rests)- max(rests))

Buggy submission (verdict: Runtime Error):
cook = []
for i in range(5):
    cook.append(int(input()))
mn = 10
time = 0
for i in range(5):
    if cook[i]%10 < mn and cook[i]%10!=0:
        ans = i
        mn = cook[i]%10
for i in range(5):
    if i==ans:
        continue
    else:
        if cook[i]%10==0:
            time += cook[i]
        else:
            time += cook[i] + 10-(cook[i]%10)
time += cook[ans]
print(time)

Buggy submission (verdict: Runtime Error):
cook = []
for i in range(5):
    cook.append(int(input()))
mn = 10
time = 0
for i in range(5):
    if cook[i]%10 < mn and cook[i]%10!=0:
        ans = i
        mn = cook[i]%10
for i in range(5):
    if i==ans:
        continue
    else:
        if cook[i]%10==0:
            time += cook[i]
        else:
            time += cook[i] + 10-(cook[i]%10)
time += cook[ans]
print(time)

Buggy submission (verdict: Runtime Error):
cook = []
for i in range(5):
    cook.append(int(input()))
mn = 10
time = 0
for i in range(5):
    if cook[i]%10 < mn and cook[i]%10!=0:
        ans = i
for i in range(5):
    if i==ans:
        continue
    else:
        if cook[i]%10==0:
            time += cook[i]
        else:
            time += cook[i] + 10-(cook[i]%10)
    print(time)
time += cook[ans]
print(time)

Buggy submission (verdict: Runtime Error):
cook = []
for i in range(5):
    cook.append(int(input()))
mn = 10
time = 0
for i in cook:
    if i%10 < mn and i%10!=0:
        mn = i%10
for i in cook:
    if (i%10)==mn:
        ans = i
        continue
    else:
        if i%10==0:
            time += i
        else:
            time += i + 10-(i%10)
time += ans
print(time)

Buggy submission (verdict: Runtime Error):
cook = []
for i in range(5):
    cook.append(int(input()))
mn = 10
time = 0
for i in cook:
    if i%10 < mn and i%10!=0:
        mn = i%10
for i in cook:
    if (i%10)==mn:
        ans = i
        continue
    else:
        if i%10==0:
            time += i
        else:
            time += i + 10-(i%10)
    print(time)
time += ans
print(time)
Problem p03262 (python)

Fixed submission:
import fractions
N,X = map(int,input().split())
x = [int(i) for i in input().split()]
ans = abs(x[0]-X)
if len(x) != 1:
    for i in range(N):
        ans1 = abs(X-x[i])
        ans = fractions.gcd(ans,ans1) 
print(ans)

Buggy submission (verdict: Runtime Error):
from fractions import Fraction
N,X = map(int,input().split())
x = [int(i) for i in input().split()]
minus = []
if len(x)==1:
    ans = x[0]-X

else:
    ans = abs(x[0]-X)
    for i in range(len(x)-1):
        ans1 = abs(x[i+1]-x[i])
        ans = fractions.gcd(ans,ans1) 
print(ans)
Problem p03282 (python)

Fixed submission:
s = list(input())
k = int(input())
flag = False
for i in range(k):
    if s[i]!='1':
        ans = s[i]
        break
        
    if i==k-1:
        flag = True
print(1 if flag==True else ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
k = int(input())
flag = False
for i in range(k):
    if s[i]!='1':
        ans = s[i]
        break
    else:
        continue
        
    if i==k-1:
        flag = True
print(1 if flag==True else ans)