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

Fixed submission:
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_cum, B_cum = [0], [0]
for i, a in enumerate(A):
    A_cum.append(A_cum[i] + a)
for i in range(m):
    B_cum.append(B_cum[i] + B[i])

ans = 0
best = m
for i in range(n+1):
    a_time = A_cum[i]
    for j in range(best, -1, -1):
        if B_cum[j] <= k - a_time:
            ans = max(ans, i + j)
            break
    best = j
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
i, j = 0, 0
time = 0
while time <= k:
    if i < n and A[i] < B[j]:
        time += A[i]
        i += 1
    elif j < m:
        time += B[j]
        j += 1
    if i >= n and j >= m:
        break
ans = i + j
if time > k:
    ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
i, j = 0, 0
time = 0
while time <= k:
    print(i, j)
    if i < n and A[i] < B[j]:
        time += A[i]
        i += 1
    elif j < m:
        time += B[j]
        j += 1
    if i >= n and j >= m:
        break
ans = i + j
if time > k:
    ans -= 1
print(ans)
Problem p02762 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 6 + 10)

n, m, k = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(m)]
CD = [list(map(int, input().split())) for _ in range(k)]
group = []  # 連結成分ごとのサイズ
person_group = [-1] * n  # 人ごとの属するグループ
person_unable= [0] * n  # 人ごとの候補に入らない人の人数
graph = [[] for _ in range(n)]  # 連結リスト
for ab in AB:
    ab[0] -= 1
    ab[1] -= 1
    graph[ab[0]].append(ab[1])
    graph[ab[1]].append(ab[0])

seen = [False] * n
# その節の連結成分のサイズを返す
def dfs(n, group_id):
    global size
    seen[n] = True
    person_group[n] = group_id
    for v in graph[n]:
        if seen[v]:
            continue
        size = dfs(v, group_id)
    size += 1
    return size
    
    
group_id = 0
for i in range(n):
    if seen[i]:
        continue
    size = 0
    group.append(dfs(i, group_id))
    group_id += 1

# unable計算。まず友達の人
for i in range(n):
    person_unable[i] += len(graph[i])
# 次にブロックの人
for i in range(k):
    CD[i][0] -= 1
    CD[i][1] -= 1
    if person_group[CD[i][0]] == person_group[CD[i][1]]:
        person_unable[CD[i][0]] += 1
        person_unable[CD[i][1]] += 1

for i in range(n):
    print(group[person_group[i]] - person_unable[i] - 1, "", end="")

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(m)]
CD = [list(map(int, input().split())) for _ in range(k)]
group = []  # 連結成分ごとのサイズ
person_group = [-1] * n  # 人ごとの属するグループ
person_unable= [0] * n  # 人ごとの候補に入らない人の人数
graph = [[] for _ in range(n)]  # 連結リスト
for ab in AB:
    ab[0] -= 1
    ab[1] -= 1
    graph[ab[0]].append(ab[1])
    graph[ab[1]].append(ab[0])

seen = [False] * n
# その節の連結成分のサイズを返す
def dfs(n, group_id):
    global size
    seen[n] = True
    person_group[n] = group_id
    for v in graph[n]:
        if seen[v]:
            continue
        size = dfs(v, group_id)
    size += 1
    return size
    
    
group_id = 0
for i in range(n):
    if seen[i]:
        continue
    size = 0
    group.append(dfs(i, group_id))
    group_id += 1

# unable計算。まず友達の人
for i in range(n):
    person_unable[i] += len(graph[i])
# 次にブロックの人
for i in range(k):
    CD[i][0] -= 1
    CD[i][1] -= 1
    if person_group[CD[i][0]] == person_group[CD[i][1]]:
        person_unable[CD[i][0]] += 1
        person_unable[CD[i][1]] += 1

for i in range(n):
    print(group[person_group[i]] - person_unable[i] - 1, "", end="")
Problem p02550 (python)

Fixed submission:

N, X, M = map(int,input().split())

ans_list = [X]
if N == 1:
    print(X)
else:
    for i in range(1,N):
        ans = ans_list[-1]**2%M
        if ans in ans_list:
            break
        else:
            ans_list.append(ans)

    st_index = ans_list.index(ans)

    if st_index == N-1:
        print(sum(ans_list))
    else:
        total = sum(ans_list[:st_index])
        N -= st_index
        syo = N//(i-st_index)
        mod = N%(i-st_index)

        total += sum(ans_list[st_index:])*syo
        total += sum(ans_list[st_index:st_index+mod])
        print(total)

Buggy submission (verdict: Runtime Error):

N, X, M = map(int,input().split())

ans_list = [X]

for i in range(1,N):
    ans = ans_list[-1]**2%M
    if ans in ans_list:
        break
    else:
        ans_list.append(ans)

st_index = ans_list.index(ans)

if st_index == N-1:
    print(sum(ans_list))
else:
    total = sum(ans_list[:st_index])
    N -= st_index
    syo = N//(i-st_index)
    mod = N%(i-st_index)

    total += sum(ans_list[st_index:])*syo
    total += sum(ans_list[st_index:st_index+mod])
    print(total)
Problem p02659 (python)

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

A = int(A)
ans = str(A*int(B[0])*10**2+A*int(B[2])*10**1+A*int(B[3]))
if len(ans) <=2:
    print(0)
else:
    print(ans[:-2])

Buggy submission (verdict: Runtime Error):
A,B = map(int, input().split())
print(int(A*B))
Problem p02771 (python)

Fixed submission:
A,B,C = input().split(' ')

if A== B:
    if B != C:
        print('Yes')
    else:
        print('No')
else:
    if B == C or A ==C:
        print('Yes')
    else:
        print('No')

Buggy submission (verdict: Runtime Error):
A,B,C = input().split(' ')

if A== B:
    if B =!C:
        print('Yes')
    else:
        print('No')
else:
    if B == C or A ==C:
        print('Yes')
    else:
        print('No')
Problem p02773 (python)

Fixed submission:
from collections import Counter


N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res_max= counted.most_common()[0][1]
ans = []
for k, v in counted.items():
    if v == res_max:
        ans.append(k)

ans.sort()
print(*ans, sep="\n")

Buggy submission (verdict: Runtime Error):
from collections import Counter
import numpy as np
import pandas as pd
N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res_max= counted.most_common()[0][1]

ans = []
for k, v in counted.items():
    if k == v:
        ans.append(k)

ans.sort()
print(*ans, sep="\n")

Buggy submission (verdict: Runtime Error):
from collections import Counter
import numpy as np
import pandas as pd
N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res= counted.most_common()

res = pd.DataFrame(res)
[print(i) for i in res[0][res[1] == res[1].max()]]

Buggy submission (verdict: Runtime Error):
from collections import Counter
import numpy as np
import pandas as pd
N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res= counted.most_common()

res = pd.DataFrame(res)
[print(i) for i in res[0][res[1] == res[1].max()]]
Problem p02833 (python)

Fixed submission:
N = int(input())

if N%2==1:
    print(0)
else:
    i = 10
    count = 0
    while i <= N:
        count += N//i
        i = i*5

    print(count)

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

if N%2==1:
    print(0)
else:
    i = 10
    count = 0
    while i <= N:
        count += N//i
        i = i*5

print(count)
Problem p02862 (python)

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

total = (X+Y)/3
k = (2*X-Y)//3

if (total == int(total)) and (k>=0):
    total = (X+Y)//3

    mod = 10 ** 9 + 7

    modinv_table = [-1] * (k + 1)
    for i in range(1, k + 1):
        modinv_table[i] = pow(i, -1, mod)


    def binomial_coefficients(n, k):
        ans = 1
        for i in range(k):
            ans *= n - i
            ans *= modinv_table[i + 1]
            ans %= mod
        return ans

    print(binomial_coefficients(total,k))
else:
    print(0)

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

dp =[[0]*(X+1) for i in range(Y+1)]
dp[0][0] = 1
mod = 10**9 +7
for x in range(X+1):
    for y in range(Y+1):
        if (x>1 and y>0) or (x>0 and y>1):

            dp[x][y] = (dp[x-1][y-2]+dp[x-2][y-1])%mod

print(dp[X][Y])
Problem p02912 (python)

Fixed submission:
import heapq
N,M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(N):
    A[i] = -A[i]
heapq.heapify(A)

for i in range(M):
    trgt = -heapq.heappop(A)//2
    heapq.heappush(A,-trgt)
print(-sum(A))

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

for i in range(M):
    ind = A.index(max(A))
    A[ind] = A[ind]//2

print(sum(A))
Problem p02990 (python)

Fixed submission:
from scipy.special import comb
mod = 10**9 + 7
N, K = map(int,input().split())
for i in range(1,K+1):
    a = K-i
    b = i-1
    c = N-(i-1)-K
    d = i
    print(comb(a+b,b,exact=True)*comb(c+d,d,exact=True)%mod)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
mod = 10**9 + 7
N, K = map(int,input().split())
for i in range(1,K+1):
    a = K-i
    b = i-1
    c = N-(i-1)-K
    d = i
    print(comb(a+b,b,exact=True)*comb(c+d,d,exact=True)%mod)
Problem p03804 (python)

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

A = [input() for i in range(N)]
B = [input() for i in range(M)]


for i in range(N-M+1):
    for j in range(N-M+1):
        flg = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l] == B[k][l]:
                    pass
                else:
                    flg=False
                    break
            if flg==False:
                break

        if flg:
            break
    if flg:
        break
if flg:
    print('Yes')
else:
    print('No')

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

A = [input() for i in range(N)]
B = [input() for i in range(M)]


for i in range(N-M):
    for j in range(N-M):
        flg = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l] == B[k][l]:
                    pass
                else:
                    flg=False
                    break
            if flg==False:
                break

        if flg:
            break
    if flg:
        break
if flg:
    print('Yes')
else:
    print('No')
Problem p02627 (python)

Fixed submission:
s = input()

if s == s.upper():
    print('A')
else:
    print('a')

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

ans = ''

while n > 0:
    n -= 1
    ans += chr(ord('a') + n % 26)
    n //= 26

print(ans[::-1])
Problem p03127 (python)

Fixed submission:
import fractions
N = int(input())
A = list(map(int, input().split()))
a = 0
for i in range(N):
    a = fractions.gcd(a, A[i])
print(a)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
A = list(map(int, input().split()))
a = 0
for i in range(N):
    a = math.gcd(a, A[i])
print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if all(A[0]==a for a in A):
    print(A[0])
else:
    B = []
    D = []
    for a in A:
        for i in range(len(A)):
            if A[i]%a != 0:
                B = append(A[i]%a)
                C = list(set(B))
    for i in range(len(C)-1):
        D.append(abs(C[i]-C[i+1]))
    print(min(min(C),min(D)))
Problem p02577 (python)

Fixed submission:
n = input()
ans = 0
for i in range(len(n)):
    ans += int(n[i])
if(ans%9==0):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = 0
#print('start')
while n!=0:
    ans += n%10
    n = int(n/10)
    #print(ans)
    #print(n)
if ans%9==0:
    print("Yes")
else:
    print("No")
Problem p02577 (python)

Fixed submission:
n = int(input())
nst = str(n)
keta= len(nst)
answer = 0
for i in range(keta):
    answer += int(nst[i])
if answer % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
x = int(input())
answer = 0
while x >= 10:
    answer += x%10
    x = int(x/10)
answer += x
if answer % 9 == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
x = int(input())
answer = 0
while x >= 10:
    answer += x%10
    x = int(x/10)
answer += x
if answer % 9 == 0:
    print('Yes')
elif answer == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
x = int(input())
import math
answer = 0
while x >= 10:
    answer += x%10
    x = math.floor(x/10)
answer += x
if answer % 9 == 0:
    print('Yes')
elif answer == 0:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
x = int(input())
answer = 0
while x >= 10:
    answer += x%10
    x = int(x/10)
answer += x
if answer % 9 == 0:
    print('Yes')
elif answer == 0:
    print('Yes')
else:
    print('No')
Problem p02699 (python)

Fixed submission:
score = list(map(int,input().split()))
if score[0] <= score[1]:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):
scnum = int(input())
score = []
answer = 0
for i in range(scnum):
    word = input()
    if word in score:
        answer += 0
    else:
        score.append(word)
        answer += 1

print(answer)
Problem p02785 (python)

Fixed submission:
number = list(map(int,input().split()))
score = list(map(int,input().split()))
score.sort()
answer = 0
if number[1] > number [0]:
    number[1] = number[0]
for i in range(number[1]):
    score[number[0]-1-i] = 0
for j in range(number[0]):
    answer += score[j]
print(answer)

Buggy submission (verdict: Runtime Error):
number = list(map(int,input().split()))
score = list(map(int,input().split()))
score.sort()
answer = 0
for i in range(number[1]):
    score[number[0]-1-i] = 0
for j in range(number[0]):
    answer += score[j]
print(answer)
Problem p02625 (python)

Fixed submission:
N, M = map(int, input().split())
mod = 10**9 + 7

def comb(n, r, mod):
    if r<0 or r>n:
        return 0
    r = min(r, n-r)
    return fac[n] * (finv[r] * finv[n-r] % mod) % mod

def perm(n, r, mod):
    if r<0 or r>n:
        return 0
    return (fac[n] * finv[n-r]) % mod

fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, max(N + 1, M + 1)):
    fac.append((fac[-1] * i) % mod)
    inv.append((-inv[mod%i] * (mod//i)) % mod)
    finv.append((finv[-1] * inv[-1]) % mod)
c = comb(M, N, mod)
ans = ((fac[N] * c % mod) ** 2) % mod

for i in range(1, N+1):
    ans += (-1)**i * ((comb(N, i, mod) * perm(M, i, mod))%mod * (perm(M-i, N-i, mod)**2)%mod)%mod
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
mod = 10**9 + 7

def comb(n, r, mod):
    if r<0 or r>n:
        return 0
    r = min(r, n-r)
    return fac[n] * (finv[r] * finv[n-r] % mod) % mod

def perm(n, r, mod):
    if r<0 or r>n:
        return 0
    return (fac[n] * finv[n-r]) % mod

fac = [1, 1]
finv = [1, 1]
inv = [0, 1]
for i in range(2, max(N + 1, M + 1)):
    fac.append((fac[-1] * i) % mod)
    inv.append((-inv[mod%i] * (mod//i)) % mod)
    finv.append((finv[-1] * inv[-1]) % mod)
for i in range(N+1):
    ans += (-1)**i * ((comb(N, i, mod) * perm(M, i, mod))%mod * (perm(M-i, N-i, mod)**2)%mod)%mod
    ans %= mod
print(ans)
Problem p02627 (python)

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
    a = input().rstrip()
    if a.isupper():
        print("A")
    else:
        print("a")

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
a = input()
if a.isupper():
  print("A)
else:
  print("a")
Problem p02757 (python)

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

s = input()

if 10 % p == 0:
    ans = sum(i + 1 for i, x in enumerate(s) if int(x) % p == 0)
    print(ans)
else:
    counter = [0] * p
    counter[0] = 1
    cur = 0
    p10 = 1
    ans = 0
    for x in s[::-1]:
        cur = (cur + int(x) * p10) % p
        ans += counter[cur]
        counter[cur] += 1
        p10 *= 10
        p10 %= p
    print(ans)

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

s = input()

if 10 % p == 0:
    ans = sum(i + 1 for i, x in enumerate(s) if int(x) % p == 0)
    print(ans)
else:
    li = [0] * (n + 1)
    counter = {}
    for i, x in enumerate(s[::-1]):
        li[i+1] = (li[i] + (int(x) * (10**(i+1)) % p)) % p
        counter[li[i+1]] = counter.get(li[i+1], 0) + 1
    ans = 0
    ans = sum(v * (v - 1) for v in counter.values()) // 2
    ans += counter[0]
    print(ans)

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

n, p = map(int, input().split())

s = input()

if 10 % p == 0:
    ans = sum(i + 1 for i, x in enumerate(s) if x % p == 0)
    print(ans)
else:
    li = [0] * (n + 1)
    for i, x in enumerate(s[::-1]):
        li[i+1] = (li[i] + (int(x) * (10**(i+1)) % p)) % p

    ans = 0
    c = Counter(li[1:])
    ans = sum(v * (v - 1) for v in c.values()) // 2
    ans += c[0]
    print(ans)
Problem p02819 (python)

Fixed submission:
import math
from sys import exit
X = int(input())

while True:
    flag = True
    for i in range(2, math.floor(math.sqrt(X) + 1)):
        if X % i == 0:
            flag = False
            break
    if flag:
        print(X)
        exit()
    X += 1

Buggy submission (verdict: Runtime Error):
import math
from sys import exit
X = int(input())

while True:
    for i in range(2, math.floor(math.sqrt(X) + 1)):
        flag = True
        if X % i == 0:
            flag = False
            break
    if flag:
        print(X)
        exit()
    X += 1
Problem p02831 (python)

Fixed submission:
a, b = map(int, input().split())
if a < b:
    a, b = b, a
A = a
B = b
while a % b != 0:
    a, b = b, a % b
print((A*B)//b)

Buggy submission (verdict: Runtime Error):
from fracitons import gcd
a, b = map(int, input().split())
print((a*b)//gcd(a,b))

Buggy submission (verdict: Runtime Error):
from fracitons import gcd
a, b = map(int, input().split())
print((a*b)//gcd(a,b))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print((a*b)//math.gcd(a,b))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print((a*b)//math.gcd(a,b))
Problem p03017 (python)

Fixed submission:
N, A, B, C, D = map(int, input().split())
S = list(input())
A -= 1
B -= 1
C -= 1
D -= 1

def check_one_people_can(start, end):
    s = S[start+1: end]
    before_sharp = False
    for x in s:
        if x == "#":
            if before_sharp:
                return False
            before_sharp = True
        else:
            before_sharp = False
    return True

def check_triple_dots(start, end):
    s = S[start-1: end+2]
    continuous_dots = 0
    for x in s:
        if x == ".":
            continuous_dots += 1
            if continuous_dots == 3:
                return True
        else:
            continuous_dots = 0
    return False

if D > C:
    if check_one_people_can(A, C) and check_one_people_can(C, D):
        print("Yes")
    else:
        print("No")
else:
    if check_triple_dots(B, D) and check_one_people_can(A, C):
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N, A, B, C, D = map(int, input().split())
S = list(input())
A -= 1
B -= 1
C -= 1
D -= 1

def check_one_people_can(start, end):
    s = S[start+1: end]
    for x in s:
        if x == "#":
            if before_sharp:
                return False
            before_sharp = True
        else:
            before_sharp = False
    return True

def check_triple_dots(start, end):
    s = S[start-1: end+1]
    continuous_dots = 0
    for x in s:
        if x == ".":
            continuous_dots += 1
            if continuous_dots == 3:
                return True
        else:
            continuous_dots = 0
    return False

if D > C:
    if check_one_people_can(A, C) and check_one_people_can(C, D):
        print("Yes")
    else:
        print("No")
else:
    if check_triple_dots(B, D) and check_one_people_can(A, C):
        print("Yes")
    else:
        print("No")
Problem p03038 (python)

Fixed submission:
import heapq
from sys import exit
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = sorted([tuple(map(int, input().split())) for _ in range(M)], key=lambda x: x[1], reverse=True)
heapq.heapify(A)

ans = sum(A)
for b, c in BC:
    for _ in range(b):
        if len(A) == 0:
            print(ans)
            exit()
        a = heapq.heappop(A)
        if a < c:
            ans += c - a
        else:
            print(ans)
            exit()
print(ans)

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    input = sys.stdin.readline
    N, M = map(int, input().split())
    A = sorted(list(map(int, input().split())))
    BC = sorted([tuple(map(int, input().split())) for _ in range(M)], key=lambda x: x[1], reverse=True)
    ind = 0
    for b, c in BC:
        for i in range(b):
            if A[ind] >= c:
                break
            A[ind] = c
            ind += 1
    print(sum(A))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import heapq
from sys import exit
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = sorted([tuple(map(int, input().split())) for _ in range(M)], key=lambda x: x[1], reverse=True)
heapq.heapify(A)

ans = sum(A)
for b, c in BC:
    for _ in range(b):
        a = heapq.heappop(A)
        if a < c:
            ans += c - a
        else:
            print(ans)
            exit()
print(ans)
Problem p03075 (python)

Fixed submission:
A = int(input())
_ = input()
_ = input()
_ = input()
E = int(input())
k = int(input())

if (E-A) > k:
    print(":(")
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
A = input()
_ = input()
_ = input()
_ = input()
E = input()
k = input()

if (E-A) > k:
  print(":(")
else:
  print("Yay!")
Problem p03077 (python)

Fixed submission:
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

min_city = min([A, B, C, D, E])

print(4+(N+min_city-1)//min_city)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

class Transporter():
    def __init__(self, cap_out, temp=0):
        self.temp_num = temp
        self.cap_out = cap_out

    def transport(self):
        if self.temp_num < self.cap_out:
            num = self.temp_num
            self.temp_num = 0
            return num
        else:
            self.temp_num -= self.cap_out
            return self.cap_out

A_ = Transporter(A, temp=N)
B_ = Transporter(B)
C_ = Transporter(C)
D_ = Transporter(D)
E_ = Transporter(E)

time = 0
while (A_.temp_num!=0):
    time += 1
    a=A_.transport()
    b=B_.transport()
    c=C_.transport()
    d=D_.transport()
    e=E_.transport()
    B_.temp_num+=a
    C_.temp_num+=b
    D_.temp_num+=c
    E_.temp_num+=d

while (B_.temp_num!=0):
    time += 1
    b=B_.transport()
    c=C_.transport()
    d=D_.transport()
    e=E_.transport()
    C_.temp_num+=b
    D_.temp_num+=c
    E_.temp_num+=d

while (C_.temp_num!=0):
    time += 1
    c=C_.transport()
    d=D_.transport()
    e=E_.transport()
    D_.temp_num+=c
    E_.temp_num+=d

while (D_.temp_num!=0):
    time += 1
    d=D_.transport()
    e=E_.transport()
    E_.temp_num+=d

whileD(E_.temp_num!=0):
    time += 1
    E_.transport()
print(time)
Problem p03127 (python)

Fixed submission:
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

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

print(gcd_list(A))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

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

print(gcd_list(A))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)

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

print(gcd(A))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(numbers):
    return reduce(math.gcd, numbers)

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

print(gcd(A))