Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

ds = [(1, 0), (-1, 0), (0, 1), (0, -1)]

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            continue

        flag = False
        for dx, dy in ds:
            x, y = i + dx, j + dy
            if x < 0 or W <= x or y < 0 or H <= y:
                continue

            if S[x][y] == "#":
                flag = True
                break

        if not flag:
            print("No")
            exit()
print("Yes")


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

d = [(-1, 0), (1, 0), (0, -1), (0, 1)]

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            continue

        flag = False
        for dx, dy in d:
            i2, j2 = i+dx, j+dy
            if not (0 <= i2 < H and 0 <= j2 < W):
                continue

            if S[i2][j2] == "#":
                flag = True

        if not flag:
            print("No")
            exit()
print("Yes")

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

ds = [(1, 0), (-1, 0), (0, 1), (0, -1)]

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            continue

        flag = False
        for dx, dy in ds:
            x, y = i + dy, j + dx
            if x < 0 or W <= x or y < 0 or H <= y:
                continue

            if S[x][y] == "#":
                flag = True
                break

        if not flag:
            print("No")
            exit()
print("Yes")


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

d = [(-1, 0), (1, 0), (0, -1), (0, 1)]

for i in range(H):
    for j in range(W):
        if S[i][j] == ".":
            continue

        flag = False
        for dx, dy in d:
            i2, j2 = i+dx, j+dy
            if not (0 <= i2 < H and 0 <= j2 < W):
                continue

            if S[i2][j2] == "#":
                flag = True

        if not flag:
            print("No")
            exit()
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
ab = [i for i in range(A,B+1)]
if A-B > 200:
    for x in (ab[:K] + ab[-K:]):
        print(x)
else:
    for x in sorted(list(set(ab[:K] + ab[-K:]))):
        print(x)

Fixed submission:
A, B, K = map(int, input().split())
a = [i for i in range(A, min(A+K,B))]
b = [i for i in range(max(A,B-K+1), B+1)]

for x in sorted(list(set(a + b))):
    print(x)

Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())
ab = [i for i in range(A,B+1)]
for x in sorted(list(set(ab[:K] + ab[-K:]))):
    print(x)

Fixed submission:
A, B, K = map(int, input().split())
a = [i for i in range(A, min(A+K,B))]
b = [i for i in range(max(A,B-K+1), B+1)]

for x in sorted(list(set(a + b))):
    print(x)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations

N = int(input())
Sn = [input() for _ in range(N)]

Ln = []
for i in range(N):
    if Sn[i][0] not in {"M", "A", "R", "C", "H"}:
        continue
    Ln.append(Sn[i])


ans = 0
for a, b, c in combinations(Ln, 3):
    if len({a[0], b[0], c[0]}) != 3:
        continue
    ans += 1

print(ans)

Fixed submission:
from itertools import combinations

N = int(input())
Sn = [input() for _ in range(N)]

march = ["M", "A", "R", "C", "H"]
d = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0}
cnt = 0
for i in range(N):
    if Sn[i][0] not in march:
        continue
    d[Sn[i][0]] += 1
    cnt += 1

ans = 0
for a, b, c in combinations(march, 3):
    ans += d[a] * d[b] * d[c]

print(ans)
Buggy python submission (verdict: Runtime Error):
N = input()
left = len(set(list(N[1:]))) == 1
right = len(set(list(N[:3]))) == 1
print("Yes" if left or right "No")

Fixed submission:
N = input()
left = len(set(list(N[1:]))) == 1
right = len(set(list(N[:3]))) == 1
print("Yes" if left or right else "No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = input().split()

offset = 0 if N % 2 == 0 else 1
ans = A[0]
for i in range(1, N):
    if (i+offset) % 2 == 0:
        ans = ans + " " + A[i]
    else:
        ans = A[i] + " " + ans

print(ans)


Fixed submission:
from collections import deque

N = int(input())
A = input().split()

offset = 0 if N % 2 == 0 else 1
ans = deque([A[0]])
for i in range(1, N):
    if (i+offset) % 2 == 0:
        ans.append(A[i])
    else:
        ans.appendleft(A[i])

print(" ".join(ans))
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

ans = 0
while N > 0 and M > 0:
    if M < 2:
        break
    N -= 1
    M -= 2
    ans += 1

while M >= 4:
    M -= 4
    ans += 1

print(ans)


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

s, c = N, M // 2

ans = 0
if s > c:
    ans = c
else:
    ans = (M - s*2) // 4 + s
print(ans)
Buggy python submission (verdict: Runtime Error):
S = {
    'a' : input(),
    'b' : input(),
    'c' : input()
}
ans = None
prv, nxt = None, 'a'
while True:
    if len(S[nxt]) != 1:
        prv = nxt
        nxt = S[nxt][1]
    else:
        ans = prv.upper()
        break
    S[prv] = S[prv][1:]
print(ans)

Fixed submission:
Sa = list(input())
Sb = list(input())
Sc = list(input())

now = Sa.pop(0)
ans = ""

while True:
    if now == "a":
        if not Sa:
            ans = "A"
            break
        now = Sa.pop(0)
    elif now == "b":
        if not Sb:
            ans = "B"
            break
        now = Sb.pop(0)
    else:
        if not Sc:
            ans = "C"
            break
        now = Sc.pop(0)
print(ans)
Buggy python submission (verdict: Runtime Error):
n, k =  input().split()
ds = list(map(int, input().split()))

nums = []
for x in range(10):
    if x in ds:
        nums.append(1)
    else:
        nums.append(0)

for x in range(n, n*10):
    ys = list(map(int,list(str(x))))
    flag = False
    for y in ys:
        if nums[y]:
            flag = True
            break
    if flag:
        continue
    else:
        print(x)
        exit

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

nums = []
for x in range(10):
    if x in ds:
        nums.append(1)
    else:
        nums.append(0)

res = 0
for x in range(n, n*10):
    ys = list(map(int,list(str(x))))
    flag = False
    for y in ys:
        if nums[y]:
            flag = True
            break
    if flag:
        continue
    else:
        res = x
        break
print(res)
Buggy python submission (verdict: Runtime Error):
import sys

def digits_sum(x):
    return sum(map(int, str(x)))

def solve(n):
    ans = sys.maxint
    for a in range(2, n//2):
        b = n - a
        ans = min(ans, digits_sum(a) + digits_sum(b))

    return ans

if __name__ == '__main__':
    n = int(input())
    print(solve(n))


Fixed submission:
import sys

def digits_sum(x):
    return sum(list(map(int, str(x))))

def solve(n):
    ans = sys.maxsize
    for a in range(1, n):
        b = n - a
        ans = min(ans, digits_sum(a) + digits_sum(b))

    return ans

if __name__ == '__main__':
    n = int(input())
    print(solve(n))
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())

is_true = False
for i in range(10**7):
    if a == int(i * 0.08) and b == int(i * 0.1):
        is_true = True
        break
if is_true:
    print(i)
else:
    print('-1')


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

is_true = False
for i in range(10**7):
    if a == int(i * 0.08) and b == int(i * 0.1):
        is_true = True
        break
if is_true:
    print(i)
else:
    print('-1')
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())

# 毎回反転させていたら時間切れになる
is_reverse = False
for _ in range(q):
    query = input().split()
    if len(query) == 1:
        if is_reverse:
            is_reverse = False
        else:
            is_reverse = True
    else:
        _, f, c = query
        if f == '1':
            if is_reverse:
                s = s + c
            else:
                s = c + s
        else:
            if is_reverse:
                s = c + s
            else:
                s = s + c

if is_reverse:
    print(s[::-1])
else:
    print(s)


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

# 毎回反転させていたら時間切れになる
is_reverse = False
forward = dict()  # あとで別のデータ構造に変更する
backward = dict()  # あとで別のデータ構造に変更する
# forward = list()
# backward = list()
forward_num = 0
backward_num = 0

for _ in range(q):
    query = input().split()
    if len(query) == 1:
        if is_reverse:
            is_reverse = False
        else:
            is_reverse = True
    else:
        _, f, c = query
        if f == '1':
            if is_reverse:
                backward[backward_num] = c
                backward_num += 1
                # s = s + c
                # backward.append(c)
            else:
                forward[forward_num] = c
                forward_num += 1
                # s = c + s
                # forward.insert(0, c)
        else:
            if is_reverse:
                forward[forward_num] = c
                forward_num += 1
                # forward.insert(0, c)
                # s = c + s
            else:
                backward[backward_num] = c
                backward_num += 1
                # backward.append(c)
                # s = s + c

# print(forward)
# print(backward)
forward = list(forward.values())[::-1]
backward = list(backward.values())
# print(is_reverse)
# print(forward)
# print(backward)

if is_reverse:
    s = s[::-1]
    print(''.join(backward)[::-1] + s + ''.join(forward)[::-1])
else:
    print(''.join(forward) + s + ''.join(backward))
Buggy python submission (verdict: Time Limit Exceeded):
h, n = map(int, input().split())

dp = [float('inf')] * (h+1)

for _ in range(n):
    damage, mp = map(int, input().split())
    for i in range(h+1):
        if i <= damage:
            dp[i] = min(dp[i], mp)
        else:
            dp[i] = min(dp[i], dp[i-damage] + mp)
print(dp[h])


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

dp = [float('inf')] * (h+1)

for _ in range(n):
    damage, mp = map(int, input().split())
    for i in range(h+1):
        if i <= damage:
            dp[i] = min(dp[i], mp)
        else:
            dp[i] = min(dp[i], dp[i-damage] + mp)
print(dp[h])
Buggy python submission (verdict: Runtime Error):
A, B, K = [int(i) for i in input().split()]

a = max(A - K, 0)
print(f"{a} {B - max(K - A, 0)}")

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

a = max(A - K, 0)
k = max(K - A, 0)
b = max(B - k, 0)
print(str(a) + ' ' + str(b))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()

ans = []
for i in range(1, N):
    if S[i-1] != S[i]:
        ans.append(S[i-1])
if S[-1] != S[-2]:
    ans.append(S[-1])
if len(set(S)) == 1:
    ans.append(S[0])
print(len(ans))


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

ans = [S[0]]
for i in range(1, N):
    curr = S[i]
    if ans[-1] != curr:
        ans.append(curr)

print(len(ans))
Buggy python submission (verdict: Runtime Error):
N = int(input())
Hs = [int(i) for i in input().split()]

ans = []
cnt = 0
for i in range(1, N):
    if Hs[i-1] >= Hs[i]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
if cnt != 0:
    ans.append(cnt)
print(max(ans))


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

ans = []
cnt = 0
for i in range(1, N):
    if Hs[i-1] >= Hs[i]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
if cnt != 0:
    ans.append(cnt)
if N == 1:
    ans = [0]
print(max(ans))
Buggy python submission (verdict: Runtime Error):
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
dishes = a + b
# print(sum(dishes))
#
print(1)


Fixed submission:
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
if len(b) > 0:
    b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))

Buggy python submission (verdict: Runtime Error):
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))

Fixed submission:
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
if len(b) > 0:
    b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))

Buggy python submission (verdict: Runtime Error):
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
b = [dish + 10 - dish % 10 for dish in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))


Fixed submission:
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
if len(b) > 0:
    b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))

Buggy python submission (verdict: Runtime Error):
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
b = [dish + 10 - dish % 10 for dish in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))


Fixed submission:
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
if len(b) > 0:
    b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))
Buggy python submission (verdict: Runtime Error):
S = input()

d = set(['A', 'T', 'C', 'G'])
ans = 0
nums = list()
for s in S:
    if s in d:
        ans += 1
    else:
        nums.append(ans)
        ans = 0
print(max(nums))


Fixed submission:
S = input()

d = set(['A', 'T', 'C', 'G'])
len_ = 0
ans = 0
for s in S:
    if s in d:
        len_ += 1
    else:
        if len_ > ans:
            ans = len_
        len_ = 0
if len_ > ans:
    ans = len_
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
hs = sorted([int(input()) for _ in range(N)])

min_diff = 10 ** 10
for i in range(N-K+1):
    tmp = hs[i:i+K]
    min_diff = min(min_diff, tmp[-1] - tmp[0])

print(min_diff)


Fixed submission:
N, K = map(int, input().split())
hs = sorted([int(input()) for _ in range(N)])

min_diff = 10 ** 10
for i in range(N-K+1):
    min_diff = min(min_diff, hs[i+K-1] - hs[i])

print(min_diff)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
hs = sorted([int(input()) for _ in range(N)])[::-1]
 
min_diff = 10 ** 10
for i in range(0, N-K+1):
    tmp = hs[i:i+K]
    min_diff = min(min_diff, tmp[0] - tmp[-1])
 
print(min_diff)

Fixed submission:
N, K = map(int, input().split())
hs = sorted([int(input()) for _ in range(N)])

min_diff = 10 ** 10
for i in range(N-K+1):
    min_diff = min(min_diff, hs[i+K-1] - hs[i])

print(min_diff)

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
hs = sorted([int(input()) for _ in range(N)])[::-1]

min_diff = 10 ** 10
for i in range(0, N-K+1):
    tmp = hs[i:i+K]
    min_diff = min(min_diff, tmp[0] - tmp[-1])

print(min_diff)


Fixed submission:
N, K = map(int, input().split())
hs = sorted([int(input()) for _ in range(N)])

min_diff = 10 ** 10
for i in range(N-K+1):
    min_diff = min(min_diff, hs[i+K-1] - hs[i])

print(min_diff)
Buggy python submission (verdict: Runtime Error):
N, i = map(int, input())
print(N-i+1)


Fixed submission:
N, i = map(int, input().split())
print(N-i+1)
Buggy python submission (verdict: Runtime Error):
import functools
import numpy as np
H, W = map(int, input().split())
mat = np.array([list(input()) for _ in range(H)])


def get_bool(x, value, axis):
    return np.where(x == value, True, False).all(axis=axis)


custom_get_bool = functools.partial(mat, '.')
mat = mat[:, ~custom_get_bool(0)]
mat = mat[~custom_get_bool(1)]
print('\n'.join([''.join(row) for row in mat]))


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

# 列から確認
ans = []
for i in range(H):
    row = mat[i]
    if all(['.' == r for r in row]):
        continue
    ans.append(row)

columns = [''.join([a[w] for a in ans]) for w in range(W)]
tmp = len(ans)
columns = [c for c in columns if '.' * tmp != c]

ans = [''.join([c[i] for c in columns]) for i in range(len(columns[0]))]
print('\n'.join(ans))

Buggy python submission (verdict: Runtime Error):
import functools
import numpy as np
H, W = map(int, input().split())
mat = np.array([list(input()) for _ in range(H)])


def get_bool(x, value, axis):
    return np.where(x == value, True, False).all(axis=axis)


custom_get_bool = functools.partial((mat, '.'))
mat = mat[:, ~custom_get_bool(0)]
mat = mat[~custom_get_bool(1)]
print('\n'.join([''.join(row) for row in mat]))


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

# 列から確認
ans = []
for i in range(H):
    row = mat[i]
    if all(['.' == r for r in row]):
        continue
    ans.append(row)

columns = [''.join([a[w] for a in ans]) for w in range(W)]
tmp = len(ans)
columns = [c for c in columns if '.' * tmp != c]

ans = [''.join([c[i] for c in columns]) for i in range(len(columns[0]))]
print('\n'.join(ans))
Buggy python submission (verdict: Runtime Error):
S = input()
K = int(input())

if S[0] == '1':
    print(S[1])
else:
    print(S[0])


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

if len(S) > K:
    print(S[K-1])
else:
    num = '1'
    for s in S:
        if s != '1':
            num = s
            break
    print(num)
Buggy python submission (verdict: Runtime Error):
N = input()
sn = sum([int(i) for i in str(N)])
if N % sn == 0:
    print('Yes')
else:
    print('No')


Fixed submission:
N = input()
sn = sum([int(i) for i in str(N)])
if int(N) % sn == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
 
tmp = list(range(a, b+1))
for a in sorted(set(tmp[:k] + tmp[-k:])):
    print(a)

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

a_list = list(range(A, min(B, A+K)))
b_list = list(range(max(A, B-K+1), B+1))
for i in sorted(list(set(a_list + b_list))):
    print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
 
tmp = range(a, b+1)
for a in sorted(list(set(tmp[:k] + tmp[-k:]))):
    print(a)

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

a_list = list(range(A, min(B, A+K)))
b_list = list(range(max(A, B-K+1), B+1))
for i in sorted(list(set(a_list + b_list))):
    print(i)

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

tmp = list(range(a, b+1))
for a in sorted(list(set(tmp[:k] + tmp[-k:]))):
    print(a)


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

a_list = list(range(A, min(B, A+K)))
b_list = list(range(max(A, B-K+1), B+1))
for i in sorted(list(set(a_list + b_list))):
    print(i)

Buggy python submission (verdict: Runtime Error):
a, b, k = [int(i) for i in input().split()]

tmp = list(range(a, b+1))
for a in sorted(list(set(tmp[:k] + tmp[::-1][:k]))):
    print(a)


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

a_list = list(range(A, min(B, A+K)))
b_list = list(range(max(A, B-K+1), B+1))
for i in sorted(list(set(a_list + b_list))):
    print(i)
Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())  
 
def judge(n, target):
    for x in range(n+1):
        for y in range(n+1-x):
            # z = n - x - y
            tmp = Y - 10000 * x - 5000 * y
            if z == tmp / 1000:
                return '{} {} {}'.format(x, y, z)
    return '-1 -1 -1'
 
 
print(judge(N, Y))

Fixed submission:
N, Y = map(int, input().split())
# N = 9
# Y = 45000


def judge(n, target):
    for x in range(n+1):
        for y in range(n+1-x):
            z = n - x - y
            total = 10000 * x + 5000 * y + 1000 * z
            if total == target:
                return '{} {} {}'.format(x, y, z)
    return '-1 -1 -1'


print(judge(N, Y))

Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())  
 
def judge(n, target):
    for x in range(n+1):
        for y in range(n+1-x):
            # z = n - x - y
            tmp = total - 10000 * x - 5000 * y
            if z == tmp / 1000:
                return '{} {} {}'.format(x, y, z)
    return '-1 -1 -1'
 
 
print(judge(N, Y))

Fixed submission:
N, Y = map(int, input().split())
# N = 9
# Y = 45000


def judge(n, target):
    for x in range(n+1):
        for y in range(n+1-x):
            z = n - x - y
            total = 10000 * x + 5000 * y + 1000 * z
            if total == target:
                return '{} {} {}'.format(x, y, z)
    return '-1 -1 -1'


print(judge(N, Y))

Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())
# N = 9
# Y = 45000
  

def judge(n, target):
    for x in range(n+1):
        for y in range(n+1-x):
            # z = n - x - y
            tmp = total - 10000 * x + 5000 * y
            if z == tmp / 1000:
                return '{} {} {}'.format(x, y, z)
    return '-1 -1 -1'
 
 
print(judge(N, Y))

Fixed submission:
N, Y = map(int, input().split())
# N = 9
# Y = 45000


def judge(n, target):
    for x in range(n+1):
        for y in range(n+1-x):
            z = n - x - y
            total = 10000 * x + 5000 * y + 1000 * z
            if total == target:
                return '{} {} {}'.format(x, y, z)
    return '-1 -1 -1'


print(judge(N, Y))
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

print(min(N * A), B)


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

print(min(N * A, B))
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
n = int(input())
times = [int(input()) for _ in range(n)]

if n == 1:
    print(times[0])
else:
    prev_lcm = times[0]
    for t in times[1:]:
        tmp = gcd(prev_lcm, t)
        lcm = int(prev_lcm * t / tmp)
        prev_lcm = lcm
    print(lcm)


Fixed submission:
from fractions import gcd
n = int(input())
times = [int(input()) for _ in range(n)]

if n == 1:
    print(times[0])
else:
    prev_lcm = times[0]
    for t in times[1:]:
        tmp = gcd(prev_lcm, t)
        lcm = prev_lcm * (t // tmp)
        prev_lcm = lcm
    print(lcm)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
n = int(input())
times = [int(input()) for _ in range(n)]

prev_lcm = times[0]
for t in times[1:]:
    tmp = gcd(prev_lcm, t)
    lcm = int(prev_lcm * t / tmp)
    prev_lcm = lcm
if n == 1:
    print(times[0])
else:
    print(lcm)


Fixed submission:
from fractions import gcd
n = int(input())
times = [int(input()) for _ in range(n)]

if n == 1:
    print(times[0])
else:
    prev_lcm = times[0]
    for t in times[1:]:
        tmp = gcd(prev_lcm, t)
        lcm = prev_lcm * (t // tmp)
        prev_lcm = lcm
    print(lcm)

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
n = int(input())
times = [int(input()) for _ in range(n)]

prev_lcm = times[0]
for t in times[1:]:
    tmp = gcd(prev_lcm, t)
    lcm = int(prev_lcm * t / tmp)
    prev_lcm = lcm
print(lcm)


Fixed submission:
from fractions import gcd
n = int(input())
times = [int(input()) for _ in range(n)]

if n == 1:
    print(times[0])
else:
    prev_lcm = times[0]
    for t in times[1:]:
        tmp = gcd(prev_lcm, t)
        lcm = prev_lcm * (t // tmp)
        prev_lcm = lcm
    print(lcm)