Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
i = list(map(int, input().split()))

A = i[0]
B = i[1]

k = (A + B) / 2

if k.is_integer() == False:
	print(IMPOSSIBLE)
else:
	print(int(k))


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

A = i[0]
B = i[1]

k = (A + B) / 2

if k.is_integer() == False:
	print("IMPOSSIBLE")
else:
	print(int(k))

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

if B>A:    
    if (B-A)%2==0:
        print(int((B-A)/2+A)
    else:
        print("IMPOSSIBLE")
else:
    if (A-B)%2==0:
        print(int((A-B)/2+B)
    else:
        print("IMPOSSIBLE")

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

if B>A:    
    if (B-A)%2==0:
        print(int((B-A)/2+A))
    else:
        print("IMPOSSIBLE")
else:
    if (A-B)%2==0:
        print(int((A-B)/2+B))
    else:
        print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]
n = A.index(max(A))

for i in range(n):    
    print(max(A)) 
print(sorted(A)[-2])
for i in range(N-n-1):
    print(max(A))   

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
n = A.index(max(A))
m = max(A)
A.remove(max(A))

for i in range(n):    
    print(m)
print(max(A))
for i in range(N-n-1):
    print(m)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for i in range(N)]

for i in range(N): 
    if A.index(max(A))==i:
        print(sorted(A)[-2])
    else:    
        print(max(A)) 
   

Fixed submission:
N = int(input())
A = [int(input()) for i in range(N)]
n = A.index(max(A))
m = max(A)
A.remove(max(A))

for i in range(n):    
    print(m)
print(max(A))
for i in range(N-n-1):
    print(m)
Buggy python submission (verdict: Runtime Error):
L, R = [int(i) for i in input().split()]
min = 2018
if (R-L)>=2019:
    a = (R-L)/2019
    R = R-2019*a
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j)%2019
        if(mod<min):
            min = mod
print("{}".format(min))

Fixed submission:
L, R = [int(i) for i in input().split()]
min = 2018
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j)%2019
        if mod<min:
            min = mod
        if mod==0:
            print("{}".format(mod))
            exit()
print("{}".format(min))

Buggy python submission (verdict: Runtime Error):
L, R = [int(i) for i in input().split()]
min = 2018
if (R-L)>=2019:
    a = R/2019
    R = R-2019*a
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j)%2019
        if(mod<min):
            min = mod
print("{}".format(min))

Fixed submission:
L, R = [int(i) for i in input().split()]
min = 2018
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j)%2019
        if mod<min:
            min = mod
        if mod==0:
            print("{}".format(mod))
            exit()
print("{}".format(min))

Buggy python submission (verdict: Time Limit Exceeded):
L, R = [int(i) for i in input().split()]
min = 2018
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j)%2019
        if(mod<min):
            min = mod
print("{}".format(min))

Fixed submission:
L, R = [int(i) for i in input().split()]
min = 2018
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j)%2019
        if mod<min:
            min = mod
        if mod==0:
            print("{}".format(mod))
            exit()
print("{}".format(min))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
A = [int(i) for i in input().split()]
total = sum(A)
X = np.zeros(N)
for i in range(total+1):
    X[0] = i
    for j in range(1,N):
        X[j] = 2*A[j-1] - X[j-1]
    if sum(X)==total:
        break

for i in range(N):
    print("{}".format(int(X[i])),end=" ") 

Fixed submission:
import numpy as np
N = int(input())
A = [int(i) for i in input().split()]
total = sum(A)
X = np.zeros(N)
X[0] = total 

n =int((N-1)/2 )
for i in range(1,n+1):
    X[0] = X[0] - 2*A[2*i-1]
for j in range(1,N):
    X[j] = 2*A[j-1] - X[j-1]
for i in range(N):
    print("{}".format(int(X[i])),end=" ")

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = [int(i) for i in input().split()]
B = np.array(A)

X = np.identity(N)
for i in range(N-1):
    X[i,i+1] = 1
X[N-1,0] = 1

ans = np.linalg.solve(X,B)
for i in range(N):
    print("{}".format(2*int(ans[i])),end=" ") 

Fixed submission:
import numpy as np
N = int(input())
A = [int(i) for i in input().split()]
total = sum(A)
X = np.zeros(N)
X[0] = total 

n =int((N-1)/2 )
for i in range(1,n+1):
    X[0] = X[0] - 2*A[2*i-1]
for j in range(1,N):
    X[j] = 2*A[j-1] - X[j-1]
for i in range(N):
    print("{}".format(int(X[i])),end=" ")
Buggy python submission (verdict: Runtime Error):
from collections import Counter
s = input()
s_list = list(s)
counter = Counter(s_list)
values = list(counter.values())
if values[0]==values[1]:
    print("Yes")
else:
    print("No")

Fixed submission:
s = input()
a = [i for i in s]
a.sort()
if a[0]==a[1] and a[2]==a[3] and a[0]!=a[2]:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a = str(input())

if a[0]=="A":
    if "C" in a[2:len(a)-1]:
        if len(ad)==len(a)-2:
            ad = a[1:].replace("C","")
            if ad.islower():
                print("AC")
            else:
                print("WA")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")
            

Fixed submission:
a = str(input())

if a[0]=="A":
    if "C" in a[2:len(a)-1]:
        ad = a[1:].replace("C","")
        if len(ad)==len(a)-2:
            if ad.islower():
                print("AC")
            else:
                print("WA")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")
Buggy python submission (verdict: Runtime Error):
import sys
 
n = 0

S = input()

for i in range(1,5):
    if S[i]=="+": n+=1
    else: n-=1
 
print(n)

Fixed submission:
import sys
 
n = 0
 
S = input()

for i in range(0,4):
    if S[i]=="+": n+=1
    else: n-=1
 
print(n)

Buggy python submission (verdict: Runtime Error):
import sys

n = 0

S = sys.argv[1]

for i in range(len(S)):
    if S[i]=="+": n+=1
    else: n-=1

print(n)



Fixed submission:
import sys
 
n = 0
 
S = input()

for i in range(0,4):
    if S[i]=="+": n+=1
    else: n-=1
 
print(n)
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)

# Override `input` function because `stdin.readline()` is 10x faster than built-in `input()`
input = sys.stdin.readline


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h(typ) if m > 1 else typ(input()) for _ in range(n)]


def main():
    n, = read_h()
    a = read_v(n)

    for i in range(n):
        arr = a[:i] + a[i + 1:]
        print(max(arr))


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)

# Override `input` function because `stdin.readline()` is 10x faster than built-in `input()`
input = sys.stdin.readline


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h(typ) if m > 1 else typ(input()) for _ in range(n)]


def main():
    n, = read_h()
    arr = read_v(n)

    max_asc = [0]
    for a in arr[:n - 1]:
        max_asc.append(max(max_asc[-1], a))
    #  print(max_asc)

    max_desc = [0]
    for a in arr[::-1][:n - 1]:
        max_desc.append(max(max_desc[-1], a))
    max_desc = max_desc[::-1]
    #  print(max_desc)

    #  assert len(max_asc) == len(max_desc)
    #  print(len(max_asc))

    for a, d in zip(max_asc, max_desc):
        print(max(a, d))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)

# Override `input` function because `stdin.readline()` is 10x faster than built-in `input()`
input = sys.stdin.readline


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h(typ) if m > 1 else typ(input()) for _ in range(n)]


def main():
    n, = read_h()
    arr = sorted(read_h(), reverse=True)
    #  print(arr)

    cnts = {}
    for a in arr:
        cnts[a] = cnts.get(a, 0) + 1
    #  print(cnts)

    rem = sum(cnts.values())
    for i in range(n - 1):
        a = arr[i]
        if cnts[a] <= 0:
            continue

        cnts[a] -= 1
        rem -= 1
        if rem == 0:
            break

        tmp_rem = rem
        for j in range(i + 1, n):
            b = arr[j]
            if cnts[b] <= 0:
                continue

            xor = a ^ b
            if xor not in cnts or cnts[xor] <= 0:
                continue

            cnts[b] -= 1
            cnts[xor] -= 1
            rem -= 2
            #  print(a, b, xor)
            #  print('remain:', cnts)
            break

        if tmp_rem == rem:
            print('No')
            return

    print('Yes')


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)

# Override `input` function because `stdin.readline()` is 10x faster than built-in `input()`
input = sys.stdin.readline


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h(typ) if m > 1 else typ(input()) for _ in range(n)]


def main():
    n, = read_h()
    arr = read_h()
    #  print(arr)

    s = 0
    for a in arr:
        s ^= a

    if s == 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    L, R = read_h()

    if R % 2019 == 0 or L % 2019 == 0 or (R - L) % 2019 == 0:
        print(0)
        return

    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, (i % 2019) * (j % 2019) % 2019)

    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    L, R = read_h()

    ans = 3000
    for di in range(R - L + 1 if R - L < 2019 else 2019):
        i = L + di
        for dj in range(1, R - i + 1 if R - i < 2019 else 2019):
            j = i + dj
            ans = min(ans, ((i % 2019) * (j % 2019)) % 2019)

    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    N, = read_h()
    A = read_h()

    import numpy as np

    a = np.asarray([[1 if i == j or i - 1 == j or i + N - 1 == j else 0
                     for j in range(N)]
                    for i in range(N)])
    b = np.asarray(A) * 2
    inv_a = np.linalg.pinv(a)
    x = list(map(int, map(np.round, np.dot(inv_a, b))))

    print(x[-1], *x[:-1])


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def main():
    N, = read_h()
    A = read_h()

    x1 = sum(A) - 2 * sum(a for i, a in enumerate(A) if i % 2 != 0)
    ans = [x1]

    for i in range(N - 1):
        ans.append(2 * A[i] - ans[i])

    print(*ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


MOD = 10**9 + 7


def dfs(colors, graph, parent, current):
    if colors < len(graph[current]):
        return 0

    num_avail_colors = colors - 1 if parent < 0 else colors - 2
    num_cases = 1
    neighbors = graph[current]
    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= num_avail_colors
        num_avail_colors -= 1
        num_cases %= MOD

    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= dfs(colors, graph, current, neighbor)
        num_cases %= MOD

    return num_cases


def main():
    N, K = read_h()
    graph = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = read_h()
        graph[a - 1].append(b - 1)
        graph[b - 1].append(a - 1)

    ans = K * dfs(K, graph, -1, 0) % MOD
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


MOD = 10**9 + 7


def dfs(colors, graph, parent, current):
    if colors < len(graph[current]):
        return 0

    num_avail_colors = colors - 1 if parent < 0 else colors - 2
    num_cases = 1
    neighbors = graph[current]
    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= num_avail_colors
        num_avail_colors -= 1
        num_cases %= MOD

    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= dfs(colors, graph, current, neighbor)
        num_cases %= MOD

    return num_cases


def main():
    N, K = read_h()
    graph = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = read_h()
        graph[a - 1].append(b - 1)
        graph[b - 1].append(a - 1)

    ans = K * dfs(K, graph, -1, 0) % MOD
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import itertools as it

X, Y, Z, K = [int(n) for n in input().strip().split(' ')]
A = sorted([int(s) for s in input().strip().split(' ')], reverse=True)
B = sorted([int(s) for s in input().strip().split(' ')], reverse=True)
C = sorted([int(s) for s in input().strip().split(' ')], reverse=True)

AB_best = sorted([sum(e) for e in it.product(A, B)], reverse=True)[:K]
best = sorted([sum(e) for e in it.product(AB_best, C)], reverse=True)[:K]
for s in best:
    print(s)


Fixed submission:
import heapq as hq

X, Y, Z, K = [int(n) for n in input().strip().split(' ')]
A = sorted([int(s) for s in input().strip().split(' ')], reverse=True)
B = sorted([int(s) for s in input().strip().split(' ')], reverse=True)
C = sorted([int(s) for s in input().strip().split(' ')], reverse=True)

q = []
i, j, k = 0, 0, 0
hq.heappush(q, (-(A[0] + B[0] + C[0]), i, j, k))
pushed = {(0, 0, 0)}

for _ in range(K):
    s, *idx = hq.heappop(q)
    idx = tuple(idx)

    print(-s)

    i, j, k = idx
    if i < X - 1 and (i + 1, j, k) not in pushed:
        hq.heappush(q, (-(A[i + 1] + B[j] + C[k]), i + 1, j, k))
        pushed.add((i + 1, j, k))
    if j < Y - 1 and (i, j + 1, k) not in pushed:
        hq.heappush(q, (-(A[i] + B[j + 1] + C[k]), i, j + 1, k))
        pushed.add((i, j + 1, k))
    if k < Z - 1 and (i, j, k + 1) not in pushed:
        hq.heappush(q, (-(A[i] + B[j] + C[k + 1]), i, j, k + 1))
        pushed.add((i, j, k + 1))
Buggy python submission (verdict: Time Limit Exceeded):
_, Q = [int(s) for s in input().strip().split(' ')]
S = input().strip()
ls = []
for i in range(Q):
    l, r = [int(s) for s in input().strip().split(' ')]
    ls.append((l, r))

for l, r in ls:
    cnt = 0
    s = S[l - 1:r]
    for j in range(len(s) - 1):
        if s[j] == 'A' and s[j + 1] == 'C':
            cnt += 1

    print(cnt)


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

t = [0] * (N + 1)

for i in range(N):
    t[i + 1] = t[i] + (1 if S[i:i + 2] == 'AC' else 0)

for i in range(Q):
    l, r = map(int, input().split())
    print(t[r - 1] - t[l - 1])

Buggy python submission (verdict: Time Limit Exceeded):
_, Q = [int(s) for s in input().strip().split(' ')]
S = input().strip()

for i in range(Q):
    l, r = [int(s) for s in input().strip().split(' ')]

    cnt = 0
    s = S[l - 1:r]
    for j in range(len(s) - 1):
        t = s[j:j + 2]
        if t == 'AC':
            cnt += 1

    print(cnt)


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

t = [0] * (N + 1)

for i in range(N):
    t[i + 1] = t[i] + (1 if S[i:i + 2] == 'AC' else 0)

for i in range(Q):
    l, r = map(int, input().split())
    print(t[r - 1] - t[l - 1])

Buggy python submission (verdict: Time Limit Exceeded):
_, Q = [int(s) for s in input().strip().split(' ')]
S = input().strip()

for i in range(Q):
    l, r = [int(s) for s in input().strip().split(' ')]

    cnt = 0
    s = S[l - 1:r]
    for j in range(len(s) - 1):
        t = s[j:j + 2]
        if t == 'AC':
            cnt += 1

    print(cnt)


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

t = [0] * (N + 1)

for i in range(N):
    t[i + 1] = t[i] + (1 if S[i:i + 2] == 'AC' else 0)

for i in range(Q):
    l, r = map(int, input().split())
    print(t[r - 1] - t[l - 1])
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def calc_num_op(cumul, a):
    assert cumul != 0
    tmp_cumul = cumul + a
    #  print('current cumul:', cumul)
    #  print('current a:', a)
    #  print('bare cumul:', tmp_cumul)
    if (cumul < 0 and tmp_cumul <= 0):
        return abs(-cumul - a + 1), 1
    if (cumul > 0 and tmp_cumul >= 0):
        return abs(-cumul - a - 1), -1
    return 0, tmp_cumul


def solve(arr, sign):
    num_op = 0
    cumul = arr[0]
    for a in arr[1:]:
        delta, cumul = calc_num_op(cumul, a)
        #  print('delta:', delta)
        #  print('modified cumul:', cumul)
        num_op += delta
        sign = '+' if sign == '-' else '-'
    return num_op


def main():
    _ = read_h()
    arr = read_h()

    op_plus = solve(arr, '+')
    #  print('op plus:', op_plus)
    op_minus = solve(arr, '-')
    #  print('op minus:', op_minus)

    print(min(op_plus, op_minus))


if __name__ == '__main__':
    main()


Fixed submission:
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def solve(arr, positive):
    num_op = 0
    cumul = 0
    #  print('current cumul:', cumul)

    for a in arr:
        cumul += a

        if positive and cumul >= 0:
            num_op += 1 + cumul
            cumul = -1
        elif not positive and cumul <= 0:
            num_op += 1 - cumul
            cumul = 1

        positive = not positive

    return num_op


def main():
    read_h()
    arr = read_h()

    op_plus = solve(arr, True)
    #  print('op plus:', op_plus)
    op_minus = solve(arr, False)
    #  print('op minus:', op_minus)

    print(min(op_plus, op_minus))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a, b =[int(input() for i in range(2))]
c = a//500
if c <= b:
  print("Yes")
else:
  print("No")


Fixed submission:
n = int(input())
a = int(input())
 
if n % 500  <=a:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a, b =int(input() for i in range(2))
c = a//500
if c <= b:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
a = int(input())
 
if n % 500  <=a:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N =input()
A = input()
M = N//500
if M >= A:
  print("Yes")
else:
  print("No")


Fixed submission:
n = int(input())
a = int(input())
 
if n % 500  <=a:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N,A =map(int,input().split())
M = N//500
if M >= A:
  print("Yes")
else:
  print("No")

Fixed submission:
n = int(input())
a = int(input())
 
if n % 500  <=a:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
n,y = map(int,input().split())
for i,j,k in itertools.product(range(0,n+1),range(0,n+1),range(0,n+1)):
  sum_y = 10000*i + 5000*j + 1000*k
  sum_n = i+j+k
  if sum_y == y and sum_n == n:     
    print(i,j,k)
    break
else:
  print(-1,-1,-1)



Fixed submission:
import itertools
n,y = map(int,input().split())
for i,j in itertools.product(range(0,n+1),range(0,n+1)):
  c = n-i-j
  sum_y = 10000*i + 5000*j + 1000*c
  if sum_y == y and c>=0:     
    print(i,j,c)
    break
else:
  print(-1,-1,-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,y = map(int,input().split())
for i in range(0,n+1):
  for j in range(0,n+1):
    for k in range(0,n+1):
      sum_y = 10000*i + 5000*j + 1000*k
      sum_n = i + j + k
      if sum_y == y and sum_n == n:
        print(i, j ,k)
        break
    else:
      continue
    break
  else:
    continue
  break
if sum_y !=y and sum_n != n:
  print(-1,-1,-1)


Fixed submission:
import itertools
n,y = map(int,input().split())
for i,j in itertools.product(range(0,n+1),range(0,n+1)):
  c = n-i-j
  sum_y = 10000*i + 5000*j + 1000*c
  if sum_y == y and c>=0:     
    print(i,j,c)
    break
else:
  print(-1,-1,-1)

Buggy python submission (verdict: Time Limit Exceeded):
n,y = map(int,input().split())
for i in range(0,n+1):
  for j in range(0,n+1):
    for k in range(0,n+1):
      sum_y = 10000*i + 5000*j + 1000*k
      sum_n = i + j + k
      if sum_y == y and sum_n == n:
        print(i, j ,k)
        break
    else:
      continue
    break
  else:
    continue
  break
if sum_y !=y and sum_n:
  print(-1,-1,-1)


Fixed submission:
import itertools
n,y = map(int,input().split())
for i,j in itertools.product(range(0,n+1),range(0,n+1)):
  c = n-i-j
  sum_y = 10000*i + 5000*j + 1000*c
  if sum_y == y and c>=0:     
    print(i,j,c)
    break
else:
  print(-1,-1,-1)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
x = int((a+b)//2 + 1)
print(x)

Fixed submission:
a,b=map(int,input().split())
print((a+b+1)//2)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
x = (a+b)//2 + 1
print(x)

Fixed submission:
a,b=map(int,input().split())
print((a+b+1)//2)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
x = -(-(a+b)//2)
print(x)

Fixed submission:
a,b=map(int,input().split())
print((a+b+1)//2)

Buggy python submission (verdict: Runtime Error):
import math

input_data = input()

for line in input_data:
    datas = line.split(" ")
    datas = [int(x) for x in datas]
    print(int(math.floor((datas[0] + datas[1]) / 2)))

Fixed submission:
import math
x,y=[int(i) for i in input().split()]
print(int(math.ceil((x + y) / 2)))
Buggy python submission (verdict: Runtime Error):
  inputdata=input().split()
  n=int(inputdata[0])
  k=int(inputdata[1])
  pointer=1
  while pointer +k <= n:
    pointer = pointer +1
  print(pointer)

Fixed submission:
#def solver():
inputdata=input().split()
n=int(inputdata[0])
k=int(inputdata[1])
pointer=1
while pointer +k <= n:
  pointer = pointer +1

if n < k:
  print("0")
else:
  print(pointer)
Buggy python submission (verdict: Runtime Error):
input_n=input()
input_s=input()
tmp=0
x = 0
for i in input_s:
  if i == "I":
    x=x+1
  else:
    x=x-1
  tmp=max(tmp,x)

print(tmp)

Fixed submission:
input_data=input().split()


first_area = int(input_data[0]) * int(input_data[1])
second_area = int(input_data[2]) * int(input_data[3])

if first_area >= second_area :
  print(first_area)
else:
  print(second_area)