Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
x = int(input())

dp = [0] * (x + 1)
cost = [100, 101, 102, 103, 104, 105]

dp[0] = 1
for _x in range(1, x + 1):
    for c in cost:
        if dp[_x - c] == 1:
            dp[_x] = 1
            continue

if dp[-1]:
    print('1')
else:
    print('0')


Fixed submission:
x = int(input())

dp = [0] * (x + 1)
cost = [100, 101, 102, 103, 104, 105]

if x < 100:
    print('0')
elif x <= 105:
    print('1')
else:
    dp[0] = 1
    for _x in range(1, x + 1):
        for c in cost:
            if dp[_x - c] == 1:
                dp[_x] = 1
                continue

    if dp[-1]:
        print('1')
    else:
        print('0')
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

from collections import Counter
left = Counter('')
right = Counter(s[1:])

ans = set()
for i in range(10):
    lefts[str(i)] = []
    rights[str(i)] = []

for i in range(1, n-1):
    left[s[i-1]] += 1
    right[s[i]] -= 1
    # print(left, right)

    left_u = []
    for k in left.keys():
        if left[k] >= 1:
            left_u.append(k)
    right_u = []
    for k in right.keys():
        if right[k] >= 1:
            right_u.append(k)

    for l in left_u:
        for r in right_u:
            tmp = l + s[i] + r
            ans.add(tmp)

print(len(ans))


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

from collections import Counter
left = Counter('')
right = Counter(s[1:])

ans = set()
for i in range(1, n-1):
    left[s[i-1]] += 1
    right[s[i]] -= 1
    # print(left, right)

    left_u = []
    for k in left.keys():
        if left[k] >= 1:
            left_u.append(k)
    right_u = []
    for k in right.keys():
        if right[k] >= 1:
            right_u.append(k)

    for l in left_u:
        for r in right_u:
            tmp = l + s[i] + r
            ans.add(tmp)

print(len(ans))
Buggy python submission (verdict: Time Limit Exceeded):
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

ans = 0
d0 = 0
while True:
    d1 = d0 + (T1 * A1 - T1 * B1)
    d2 = d1 + (T2 * A2 - T2 * B2)
    # print(d0, d1, d2)

    if d2 == 0:
        ans = 'infinity'
        break

    c = 0
    if d0 == 0:
        if d1 == 0:
            c = 1
        elif d1 * d2 < 0:
            c = 1
    else:
        if d1 == 0:
            c = 1
        else:
            if d0 * d1 < 0:
                c += 1
            if d1 * d2 < 0:
                c += 1

    if c == 0:
        break
    else:
        ans += c
        d0 = d2

print(ans)


Fixed submission:
T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())

d = (T1 * A1 - T1 * B1) + (T2 * A2 - T2 * B2)
d1 = (T1 * A1 - T1 * B1)

import math
if d == 0:
    ans = 'infinity'
else:
    ans = 0

    # T1
    if d1 == 0:
        ans += 1
    elif d * d1 < 0:
        ans += abs(d1) // abs(d)

    # T2
    if d1 * d < 0:
        ans += math.ceil(abs(d1) / abs(d))

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n - 1)]

from collections import defaultdict
g = defaultdict(list)
for i in range(len(ab)):
    g[ab[i][0]].append(ab[i][1])
    g[ab[i][1]].append(ab[i][0])

k = 0
for key in g.keys():
    k = max(k, len(g[key]))
print(k)

from bisect import bisect_left

ans_d = dict()
for key in g.keys():
    ans_d[key] = [0] * len(g[key])

used_all = dict()
for key in g.keys():
    used_all[key] = []

for key in g.keys():
    used = used_all[key]

    unused = []
    for j in range(1, k+1):
        idx = bisect_left(used, j)
        if idx < len(used) and used[idx] == j:
            continue
        else:
            unused.append(j)
    # print(unused)

    idx = 0
    for j in range(len(g[key])):
        if ans_d[key][j] == 0:
            ans_d[key][j] = unused[idx]

            target = g[key][j]
            idx2 = bisect_left(g[target], key)
            ans_d[target][idx2] = unused[idx]
            used_all[key].append(unused[idx])
            used_all[target].append(unused[idx])
            idx += 1

# print(ans_d)

for i in range(len(ab)):
    idx = bisect_left(g[ab[i][0]], ab[i][1])
    print(ans_d[ab[i][0]][idx])


Fixed submission:
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n - 1)]

from collections import defaultdict
g = defaultdict(list)
for a, b in ab:
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)

k = 0
for key in g:
    k = max(k, len(g[key]))
print(k)

ans = dict()
q = [(0, -1)] # (pos, used_color)
visited = set([0])
while q:
    cur, col = q.pop()

    if col == 0:
        tmp = 1
    else:
        tmp = 0

    for target in g[cur]:
        if target not in visited:
            q.append((target, tmp))
            visited.add(target)
            ans[(cur, target)] = tmp

            if tmp + 1 == col:
                tmp += 2
            else:
                tmp += 1

for a, b in ab:
    key = (a-1, b-1)
    print(ans[key] + 1)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))

a.sort()
f.sort()
f = f[::-1]

import heapq
af = []
heapq.heapify(af)
for i in range(len(a)):
    heapq.heappush(af, [a[i] * f[i] * -1, f[i]])

for i in range(k):
    tmp = heapq.heappop(af)
    tmp[0] = (tmp[0] // tmp[1] + 1) * tmp[1]
    heapq.heappush(af, tmp)

print(max(heapq.heappop(af)[0] * -1, 0))


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

a = sorted(aa, reverse=True)
f = sorted(ff)

def C(x):
    ret = 0
    for i in range(n):
        ret += max(0, a[i] - x // f[i])
    return ret

lb = -1
ub = 10 ** 12 + 1
while (ub - lb) > 1:
    mid = (ub + lb) // 2

    if C(mid) > k:
        lb = mid
    else:
        ub = mid
print(ub)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l2 = list(map(int, input().split()))

from collections import Counter
c = Counter(l2)
k = list(c.keys())
k.sort()

from bisect import bisect_left, bisect_right
l2.sort()

ans = 0
for i in range(len(k)):
    for j in range(i+1, len(k)):
        c_min = k[j] - k[i]
        c_max = k[i] + k[j]

        idx = bisect_right(l2, k[j])
        tmp = l2[idx:]

        idx_min = bisect_right(tmp, c_min)
        idx_max = bisect_left(tmp, c_max)

        ans += max(0, idx_max - idx_min) * c[k[i]] * c[k[j]]

for _k in k:
    if c[_k] >= 2:
        idx = bisect_right(l2, _k)
        tmp = l2[idx:]
        idx_min = bisect_right(tmp, 0)
        idx_max = bisect_left(tmp, _k * 2)

        ans += max(0, idx_max - idx_min) * (c[_k] - 1) * c[k] // 2

print(ans)


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

l.sort()
from bisect import bisect_left
ans = 0
for i in range(n):
    for j in range(i):
        idx = bisect_left(l, l[i] + l[j])
        ans += idx - i - 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int, input().split()))

from bisect import bisect_left, bisect_right
l.sort()
ans = 0
for i in range(len(l)):
    for j in range(i+1, len(l)):
        c_min = l[j] - l[i]
        c_max = l[i] + l[j]
        tmp = l[j+1:]

        idx_min = bisect_left(tmp, c_min)
        idx_max = bisect_left(tmp, c_max)

        if idx_min < len(tmp) and tmp[idx_min] == c_min:
            idx_min += 1

        ans += max(0, idx_max - idx_min)

print(ans)


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

l.sort()
from bisect import bisect_left
ans = 0
for i in range(n):
    for j in range(i):
        idx = bisect_left(l, l[i] + l[j])
        ans += idx - i - 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

import math
g = math.gcd(a, b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

gg = prime_factorize(g)
print(len(list(set(gg))) + 1)


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

from fractions import gcd
g = gcd(a, b)

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

gg = prime_factorize(g)
print(len(list(set(gg))) + 1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

import numpy as np
import math
A = np.array(A)
b = np.zeros(N)
for i in reversed(range(1, N + 1)):
    a = A[i - 1]
    idxs = np.arange(1, math.floor(N / i) + 1) * i
    s = np.sum(b[idxs - 1])
    if (s % 2 == 0 and a == 1) or (s % 2 == 1 and a == 0):
        b[i - 1] = 1
    # print(i, idxs, s, b)


if len(b) == 0:
    print(0)
else:
    counter = 0
    res = ''
    for i in range(len(b)):
        if b[i] == 1:
            if res == '':
                res += str(i + 1)
            else:
                res += ' ' + str(i + 1)
            counter += 1
    print(counter)
    print(res)


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

ans = [0] * n

for i in reversed(range(1, n+1)):
    count = 0
    for j in range(2 * i, n + 1, i):
        count += ans[j-1]

    if count % 2 != a[i-1]:
        ans[i-1] = 1

print(sum(ans))
for i in range(n):
    if ans[i] == 1:
        print(i + 1)

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

import numpy as np
baisuu_count = np.zeros(N)
b = []
for i in reversed(range(N)):
    a = A[i]
    if (baisuu_count[i] // 2 == 1 and a == 0) or (baisuu_count[i] // 2 == 0 and a == 1):
        b.append(i + 1)
        divisors = np.array(make_divisors(i + 1))
        baisuu_count[divisors] += 1


if len(b) == 0:
    print(0)
else:
    print(len(b))
    for _b in range(len(b)):
        print(_b + 1)


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

ans = [0] * n

for i in reversed(range(1, n+1)):
    count = 0
    for j in range(2 * i, n + 1, i):
        count += ans[j-1]

    if count % 2 != a[i-1]:
        ans[i-1] = 1

print(sum(ans))
for i in range(n):
    if ans[i] == 1:
        print(i + 1)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

import heapq
from collections import defaultdict, deque
g1 = defaultdict(set)
for u, v in uv:
    g1[u-1].add(v-1)

s -= 1
t -= 1

dist = [[float('inf')] * 3 for _ in range(n)]
dist[s][0] = 0

q = [(0, s, 0)] # (dist, pos, kenken)
heapq.heapify(q)

while q:
    du, u, c = heapq.heappop(q)
    if dist[u][c] < du:
        continue
    c2 = (c + 1) % 3
    for v in g1[u]:
        if du + 1 < dist[v][c2]:
            dist[v][c2] = du + 1
            heapq.heappush(q, (dist[v][c2], v, c2))

if dist[t][0] != float('inf'):
    print(d)
else:
    print(-1)


Fixed submission:
n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

import heapq
from collections import defaultdict
g1 = defaultdict(set)
for u, v in uv:
    g1[u-1].add(v-1)

s -= 1
t -= 1

dist = [[float('inf')] * 3 for _ in range(n)]
dist[s][0] = 0

q = [(0, s, 0)] # (dist, pos, kenken)
heapq.heapify(q)

while q:
    du, u, c = heapq.heappop(q)
    if dist[u][c] < du:
        continue
    c2 = (c + 1) % 3
    for v in g1[u]:
        if du + 1 < dist[v][c2]:
            dist[v][c2] = du + 1
            heapq.heappush(q, (dist[v][c2], v, c2))

if dist[t][0] != float('inf'):
    print(dist[t][0] // 3)
else:
    print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

from collections import defaultdict, deque
g1 = defaultdict(set)
for u, v in uv:
    g1[u-1].add(v-1)

s -= 1
t -= 1

f = False
visited = set([s])
q = deque([(s, 0)])
while q:
    cur, d = q.popleft()

    if cur == t:
        f = True
        break
    for target1 in g1[cur]:
        for target2 in g1[target1]:
            for target3 in g1[target2]:
                if target3 not in visited:
                    q.append((target3, d + 1))

if f:
    print(d)
else:
    print(-1)


Fixed submission:
n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

import heapq
from collections import defaultdict
g1 = defaultdict(set)
for u, v in uv:
    g1[u-1].add(v-1)

s -= 1
t -= 1

dist = [[float('inf')] * 3 for _ in range(n)]
dist[s][0] = 0

q = [(0, s, 0)] # (dist, pos, kenken)
heapq.heapify(q)

while q:
    du, u, c = heapq.heappop(q)
    if dist[u][c] < du:
        continue
    c2 = (c + 1) % 3
    for v in g1[u]:
        if du + 1 < dist[v][c2]:
            dist[v][c2] = du + 1
            heapq.heappush(q, (dist[v][c2], v, c2))

if dist[t][0] != float('inf'):
    print(dist[t][0] // 3)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
n, l = map(int, input().split())

import numpy as np
taste = np.arange(n)
taste = taste + l

idx = np.argmin(np.abs(taste))

s = 0
for i in range(n):
    if i != idx:
        s += taste[i]

print(s)


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

import numpy as np
taste = np.arange(n)
taste = taste + l

idx = np.argmin(np.abs(taste))

s = 0
for i in range(n):
    if i != idx:
        s += taste[i]

print(s)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())
l = list(map(int, input().split()))

i = 0
total = 0
while total <= x:
    total += l[i]
    i += 1
print(i)


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

coutner = 1
d = 0

for i in range(n):
    d += l[i]

    if d > x:
        break
    else:
        coutner += 1


print(coutner)
Buggy python submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())

if x > w / 2:
    x = w - x
if y > h / 2:
    y = h - y


if x / w > y / h:
    a = []
    a.append(w * w * y / x / 2)
    a.append(h * h * x / (h - y) / 2)
    a.append(w * w * y / (w - x) / 2)
    a.append(h * h  * (w - x) / (h - y) / 2)
    a.append(x * h)
    a.append(y * w)
else:
    a = []
    a.append(h * h * x / y / 2)
    a.append(h * (h - y) * x / y / 2)
    a.append(w * w * y / (w - x) / 2)
    a.append(w * w * (h - y) / (w - x) / 2)
    a.append(x * h)
    a.append(y * w)

m = max(a)

counter = 0
for i in range(6):
    if a[i] == m:
        counter += 1
if counter >= 2:
    flag = 1
else:
    flag = 0

print(m, flag)


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

m = w * h / 2
if x == w / 2 and y == h / 2:
    flag = 1
else:
    flag = 0
print(m, flag)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
lr = [list(map(int, input().split())) for _ in range(m)]

tmp = [0] * n

def add_one(x):
    return x + 1

for i in range(m):
    l = lr[i][0] - 1
    r = lr[i][1] - 1
    tmp[l: r+1] = list(map(add_one, tmp[l: r + 1]))

counter = 0
for j in range(n):
    if tmp[j] == m:
        counter += 1

print(counter)


Fixed submission:
n, m = list(map(int, input().split()))
lr = [list(map(int, input().split())) for _ in range(m)]

l_list = [_lr[0] for _lr in lr]
r_list = [_lr[1] for _lr in lr]

a = min(r_list)
b = max(l_list)
print(max(a - b + 1, 0))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
lr = [list(map(int, input().split())) for _ in range(m)]

import numpy as np
tmp = np.zeros(n)

for i in range(m):
    l = lr[i][0] - 1
    r = lr[i][1] - 1
    tmp[l: r+1] = tmp[l: r+1] + 1

counter = 0
for j in range(n):
    if tmp[j] == m:
        counter += 1

print(counter)


Fixed submission:
n, m = list(map(int, input().split()))
lr = [list(map(int, input().split())) for _ in range(m)]

l_list = [_lr[0] for _lr in lr]
r_list = [_lr[1] for _lr in lr]

a = min(r_list)
b = max(l_list)
print(max(a - b + 1, 0))

Buggy python submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
lr = [list(map(int, input().split())) for _ in range(m)]

import numpy as np
tmp = np.zeros(n)

for i in range(m):
    l = lr[i][0] - 1
    r = lr[i][1] - 1
    tmp[l: r+1] = tmp[l: r+1] + 1

counter = 0
for j in range(n):
    if tmp[j] == m:
        counter += 1

print(counter)


Fixed submission:
n, m = list(map(int, input().split()))
lr = [list(map(int, input().split())) for _ in range(m)]

l_list = [_lr[0] for _lr in lr]
r_list = [_lr[1] for _lr in lr]

a = min(r_list)
b = max(l_list)
print(max(a - b + 1, 0))
Buggy python submission (verdict: Time Limit Exceeded):
m, k = map(int, input().split())

if m == 0:
    if k == 0:
        print('0 0')
    else:
        print('-1')
elif m == 1:
    if k == 0:
        print('0 0 1 1')
    elif k >= 1:
        print('-1')
else:
    if k < 2 ** m:
        l = []
        for i in range(2 ** m):
            if i != k:
                l.append(i)

        ans = l + [k] + l[::-1] + [k]

        ans2 = ''
        for a in ans:
            ans2 += str(a) + ' '
        print(ans2[:-1])
    else:
        print(-1)


Fixed submission:
m, k = map(int, input().split())

if m == 0:
    if k == 0:
        print('0 0')
    else:
        print('-1')
elif m == 1:
    if k == 0:
        print('0 0 1 1')
    elif k >= 1:
        print('-1')
else:
    if k < 2 ** m:
        l = list(range(2 ** m))
        l.pop(k)
        ans = l + [k] + l[::-1] + [k]
        print(' '.join(map(str, ans)))
    else:
        print(-1)
Buggy python submission (verdict: Runtime Error):
n, k = list(map(int, input()))

print(n - k + 1)


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

print(nk[0] - nk[1] + 1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

import fractions
from functools import reduce

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

f1 = gcd_list(a)
b = [int(_a / f1) for _a in a]

f2_list = []
for i in range(len(b)):
    tmp = b[i]
    b.pop(i)
    f2_list.append(gcd_list(b))
    b.insert(i, tmp)

print(f1 * max(f2_list))


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

import fractions
left, right = [], []
for arr, l in zip([a, a[::-1]], [left, right]):
    l.append(arr[0])
    for i in range(1, n):
        l.append(fractions.gcd(l[-1], arr[i]))

left = [right[-1], right[-2]] + left
right = right[::-1] + [left[-2], left[-1]]

ans = 0
for (l, r) in zip(left, right):
    ans = max(ans, fractions.gcd(l, r))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

def add_one(x):
    return x + 1

w_counter_before = [0] * n
w_counter_all = 0
for i in range(n):
    if s[i] == '.': # white
        w_counter_before[i:] = list(map(add_one, w_counter_before[i:]))
        w_counter_all += 1

if w_counter_all == 0:
    print(0)
else:
    counters = []
    for i in range(n):
        cost1 = i - w_counter_before[i] + 1
        cost2 = w_counter_all - w_counter_before[i]
        counters.append(cost1 + cost2)
    print(min(counters))


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

w_counter_all = 0
for i in range(n):
    if s[i] == '.': # white
        w_counter_all += 1

if s[0] == '.':
    cost1 = 0
else:
    cost1 = 1
cost1_list = [cost1]
for i in range(1, n):
    if s[i] == '#':
        # black
        cost1 += 1
    cost1_list.append(cost1)


cost_all = [w_counter_all]
for i in range(n):
    cost_all.append(n - i - 1 - cost1_list[-1] + cost1_list[i] * 2)
print(min(cost_all))
Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort()
b.sort()
c.sort()

from bisect import bisect_left, bisect_right

def C(x):
    # count "abc <= x"
    ret = 0
    for aa in a:
        for bb in b:
            idx = bisect_right(c, x - aa - bb)
            ret += idx
    return ret

kk = x * y * z - k + 1
lb = 0
ub = (10 ** 10) * 4
while ub - lb > 1:
    mid = (ub + lb) // 2
    if C(mid) >= kk:
        ub = mid
    else:
        lb = mid

kth = ub


l = []
for aa in a:
    for bb in b:
        idx = bisect_left(c, kth - aa - bb)
        # print(aa, bb, idx)
        for i in range(idx, z):
            l.append(aa + bb + c[i])


l.sort(reverse=True)
for ll in l:
    print(ll)


Fixed submission:


if __name__ == '__main__':
    x, y, z, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))

    bc = []
    for bb in b:
        for cc in c:
            bc.append(bb + cc)
    bc.sort()

    from bisect import bisect_left

    def C(x):
        # count "abc >= x"
        ret = 0
        for aa in a:
            idx = bisect_left(bc, x - aa)
            ret += len(bc) - idx
        return ret

    lb = 0
    ub = (10 ** 10) * 3 + 1
    while ub - lb > 1:
        mid = (ub + lb) // 2
        if C(mid) >= k:
            lb = mid
        else:
            ub = mid

    kth = lb

    l = []
    for aa in a:
        idx = bisect_left(bc, kth - aa)
        for i in range(idx, len(bc)):
            l.append(aa + bc[i])

    l.sort(reverse=True)
    l = l[:k]
    for ll in l:
        print(ll)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd

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

print(gcd(a))


Fixed submission:
from fractions import gcd
from functools import reduce

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

print(reduce(gcd, a))