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

Fixed submission:
a, b, x = map(int, input().split())
import math
if x == (a**2)*b:
    print(0)
elif x >= (a**2)*b/2:
    z = math.atan((a**3)/(2*(b*(a**2)-x)))
    print(90-math.degrees(z))
else:
    z = math.atan(2*x/(a*(b**2)))
    print(90-math.degrees(z))

Buggy submission (verdict: Runtime Error):
a, b, x = map(int, input().split())
import math
if x >= (a**2)*b/2:
    z = math.atan((a**3)/(2*(b*(a**2)-x)))
else:
    z = math.atan(2*x/(a*(b**2)))

print(90-math.degrees(z))
Problem p02900 (python)

Fixed submission:
import sys 
input = sys.stdin.readline
a, b = map(int, input().split())
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

A = set(prime_factorize(a))
B = set(prime_factorize(b))
ans = A&B
print(len(ans)+1)

Buggy submission (verdict: Runtime Error):
def prime(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
a, b = map(int, input().split())
if a == 1 or b == 1:
  print(1)
else:
	print(len(set(prime(a))&set(prime(b))))

Buggy submission (verdict: Runtime Error):
if a == 1 or b == 1:
  print(1)
def prime(n):
  pf=[1]
  for i in range(2,int(n**0.5)+1):
    while n%i==0:
      pf.append(i)
      n//=i
  list(set(pf))
  return pf
a, b = map(int, input().split())
if a == 1 or b == 1:
  print(1)
else:
  print(len(set(prime(a)+prime(b))))

Buggy submission (verdict: Runtime Error):
ans = 1
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
x1, x2 = map(int, input().split())
list = primes(min(x1,x2)+1)
for i in list:
  if x1 % i == 0 and x2 % i == 0:
    ans += 1
    while x1%i == x2%i == 0:
      x1 //= i
      x2 //= i
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
Z = primes(max(a, b))
ans = 1
for i in range(len(Z)):
  if a%Z[i] == b%Z[i] == 0:
    ans += 1
print(ans)
Problem p02934 (python)

Fixed submission:
n = input()
a = list(map(int, input().split()))
a = [1/i for i in a]
b = sum(t for t in a )
print(1/b)

Buggy submission (verdict: Runtime Error):
n = input()
a = list(map(int, input()))
for i in a:
    i = 1/i
print(sum(i) for i in a)
Problem p02945 (python)

Fixed submission:
a, b = map(int, input().split())
s = a + b
t = a - b
u = a * b
x = sorted([s, t, u])
print(x[-1])

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = a + b
t = a - b
u = a * b
x = [s, t, u].sort()
print(x[-1])

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
s = a + b
t = a - b
u = a * b
x = [s, t, u].sort()
print(x[-1])
Problem p02952 (python)

Fixed submission:
n = int(input())
m = 0
for i in range(1,n+1):
  if (len(str(i))-1)%2 == 0:
    m += 1
print(m)

Buggy submission (verdict: Runtime Error):
n = int(input())
m == 0
for i in range(n):
  if len(str(i))%2 != 0:
    m += 1
print(m)
Problem p02975 (python)

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
A.sort()
B = list(set(A))
if len(B) >= 4:
  print('No')
else:
  if B[-1] == 0:
    print('Yes')
  elif A.count(0) == n/3 and len(B) == 2:
    print('Yes')
  elif len(B) == 3 and B[0]^B[1]^B[2] == 0 and A.count(B[0]) == A.count(B[1]) == n/3:
    print('Yes')
  else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
A.sort()
B = list(set(A))
if len(B) >= 4:
  print('No')
else:
  if B[-1] == 0:
    print('Yes')
  elif A.count(0) == n/3 and len(B) == 2:
    print('Yes')
  elif B[0]^B[1]^B[2] == 0 and A.count(B[0]) == A.count(B[1]) == n/3:
    print('Yes')
  else:
    print('No')
Problem p02983 (python)

Fixed submission:
l, r = map(int, input().split())
m = []
if r-l >= 2018:
  print(0)
else:
  L = l%2019
  R = r%2019
  if L == 0 or R == 0:
    print(0)
  elif L>R:
    print(0)
  else:
    for i in range(L, R+1):
      for j in range(i+1, R+1):
        m.append(i*j%2019)
    print(min(m))

Buggy submission (verdict: Runtime Error):
L. R = map(int, input().split())
a = []
b = []
flag = False
if R - L >= 2019:
    print(0)
else:
    for i in range(L,R):
        for j in range(i+1, R+1):
            mod = (i*j)%2019
            if mod != 1:
                 a.append(mod)
            else:
                flag = True
                break
        if flag:
            break
        else:
            b.append(min(a))
    if flag:
        print(1)
    else:
        print(min(b))
Problem p02993 (python)

Fixed submission:
s = input()
m = 0
for i in range(3):
    if s[i] == s[i+1]:
        m += 1
if m == 0:
    print('Good')
else:
    print('Bad')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
m=0
for i in range(a,b+1):
    if (i%c == 0 or i%d == 0):
        continue
    m += 1
print(m)
Problem p02995 (python)

Fixed submission:
from fractions import gcd
a, b, c, d = map(int, input().split())

e = (c*d)//gcd(c,d)

def calc(x):
    return x - (x//c)-(x//d)+(x//e)

print(calc(b)-calc(a-1))

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())
e = (c*d)/math.gcd(c,d)
bb = b-(int(b/c) + int(b/d)- int(b/e))
aa = a-1-(int((a-1)/c)+int((a-1)/d)-int((a-1)/e))
z = bb-aa
print(z)

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d = map(int, input().split())
m=0
e = c * d/math.gcd(c,d)
num_c = int(b/c)-int((a-1)/c)
num_d = int(b/d)-int((a-1)/d)
num_e = int(b/e)-int((a-1)/e)
m = num_c + num_d - num_e
print(b-a+1-m)

Buggy submission (verdict: Runtime Error):
import fraction
a, b, c, d = map(int, input().split())
m=0
e = c * d/fraction.gcd(c,d)
num_c = int(b/c)-int((a-1)/c)
num_d = int(b/d)-int((a-1)/d)
num_e = int(b/e)-int((a-1)/e)
m = num_c + num_d - num_e
print(b-a+1-m)

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
m=0
for i in range(a,b+1):
    if i%c == 0　or i % d == o:
        continue
    m += 1
print(m)
Problem p03030 (python)

Fixed submission:
n = int(input())
sp = []
for i in range(n):
    sp.append(input().split())
    sp[i].append(i)
    sp[i][1] = int(sp[i][1])
sp = sorted(sp, key = lambda x : x[1], reverse = True)
sp = sorted(sp, key = lambda x : x[0])
for i in range(n):
    print(sp[i][2]+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
sp = []
for i in range(n):
    sp.append(input().split())
    sp[i].append(i)
    sp[i][1] = int(sp[i][1])
sp = sorted(sp, key = lambda x : x[1], reverse = True)
sp = sorted(sp, key = lambda x : x[0])
fo ri in range(n):
    print(sp[i][2]+1)
Problem p03239 (python)

Fixed submission:
n, t = map(int, input().split())
A = []
for i in range(n):
  a = list(map(int, input().split()))
  if a[1] <= t:
    A.append(a[0])
if len(A) == 0:
  print('TLE')
else:
  print(min(A))

Buggy submission (verdict: Runtime Error):
n, t = map(int, input().split())
A = []
for i in range(n):
  a = list(map(int, input().split()))
  if a[1] =< t:
    A.append(a[0])
if len(A) == 0:
  print('TLE')
else:
  print(min(A))

Buggy submission (verdict: Runtime Error):
n, t = map(int, input().split())
A = []
for i in range(n):
  a = list(map(int, input().split()))
  if a[1] < t:
    A.append(a[0])
print(min(A))
Problem p03244 (python)

Fixed submission:
import numpy as np
n = int(input())
v = list(map(int, input().split()))
v_odd = []
v_even = []
for i in range(n):
  if i%2 == 0:
    v_odd.append(v[i])
  else:
    v_even.append(v[i])

vs_odd = np.array(v_odd)
vs_even = np.array(v_even)
count_odd = np.bincount(vs_odd)
count_even = np.bincount(vs_even)
mode_odd = np.argmax(count_odd)
mode_even = np.argmax(count_even)
a = v_odd.count(mode_odd)
b = v_even.count(mode_even)
if mode_odd != mode_even:
  print(n-a-b)
else:
  if len(v_odd) != v_odd.count(mode_odd):
    v_odd2 = [i for i in v_odd if i != mode_odd]
    vs_odd2 = np.array(v_odd2)
    count_odd2 = np.bincount(vs_odd2)
    mode_odd2 = np.argmax(count_odd2)
    a2 = v_odd.count(mode_odd2)
  else:
    a2 = 0
  if len(v_even) != v_even.count(mode_even):
    v_even2 = [i for i in v_even if i != mode_even]
    vs_even2 = np.array(v_even2)
    count_even2 = np.bincount(vs_even2)
    mode_even2 = np.argmax(count_even2)
    b2 = v_even.count(mode_even2)
  else:
    b2 = 0
  if a2 > b2:
    print(n-a2-b)
  else:
    print(n-a-b2)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
v = list(map(int, input().split()))
v_odd = []
v_even = []
for i in range(n):
  if i%2 == 0:
    v_odd.append(v[i])
  else:
    v_even.append(v[i])

vs_odd = np.array(v_odd)
vs_even = np.array(v_even)
count_odd = np.bincount(vs_odd)
count_even = np.bincount(vs_even)
mode_odd = np.argmax(count_odd)
mode_even = np.argmax(count_even)
a = v_odd.count(mode_odd)
b = v_even.count(mode_even)
if mode_odd != mode_even:
  print(n-a-b)
else:
  if len(v_odd) != v_odd.count(mode_odd):
    v_odd2 = [i for i in v_odd if i != mode_odd]
    vs_odd2 = np.array(v_odd2)
    count_odd2 = np.bincount(vs_odd2)
    mode_odd2 = np.argmax(count_odd2)
    a2 = v_odd.count(mode_odd2)
  else:
    a2 = 0
    if len(v_even) != v_even.count(mode_even):
      v_even2 = [i for i in v_even if i != mode_even]
      vs_even2 = np.array(v_even2)
      count_even2 = np.bincount(vs_even2)
      mode_even2 = np.argmax(count_even2)
      b2 = v_even.count(mode_even2)
    else:
      b2 = 0
  if a2 > b2:
    print(n-a2-b)
  else:
    print(n-a-b2)
Problem p02720 (python)

Fixed submission:
from collections import deque
K = int(input())

que = deque(['1', '2', '3', '4', '5', '6', '7', '8', '9'])

while K:
    if K == 1:
        ans = que.popleft()
        break
    K -= 1
    v = que.popleft()
    if v[-1] == '0':
        que.append(v + '0')
        que.append(v + '1')
    elif v[-1] == '9':
        que.append(v + '8')
        que.append(v + '9')
    else:
        que.append(v + str(int(v[-1]) - 1))
        que.append(v + str(int(v[-1])))
        que.append(v + str(int(v[-1]) + 1))

print(ans)

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

def main():
  	K = int(input())
    que = deque(['1', '2', '3', '4', '5', '6', '7', '8', '9'])

    while K:
        if K == 1:
            ans = que.popleft()
            break
        K -= 1
        v = que.popleft()
        if v[-1] == '0':
            que.append(v + '0')
            que.append(v + '1')
        elif v[-1] == '9':
            que.append(v + '8')
            que.append(v + '9')
        else:
            que.append(v + str(int(v[-1]) - 1))
            que.append(v + str(int(v[-1])))
            que.append(v + str(int(v[-1]) + 1))

    print(ans)

if __name__ == '__main__':
    main()
Problem p02787 (python)

Fixed submission:
INF = 10 ** 9

def main():
    H, N = map(int, input().split())
    dp = [INF] * (H+1)
    dp[0] = 0
    for _ in range(N):
        a, b = map(int, input().split())
        for j in range(H):
            nj = min(j+a, H)
            dp[nj] = min(dp[nj], dp[j]+b)

    print(dp[H])

    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
INF = 10 ** 10


def main():
    H, N = map(int, readline().rstrip().split())
    dp = [INF] * (H + 1)  # HPを減らすのに必要な最小のMP
    dp[0] = 0

    for _ in range(N):
        hp, mp = map(int, readline().rstrip().split())

        for i in range(hp):
            dp[i] = min(dp[i], mp)

        for i in range(hp, H+1):
            dp[i] = min(dp[i-hp] + mp, dp[i])

    print(dp[-1])


if __name__ == '__main__':
    main()
Problem p02848 (python)

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

alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
di = {}
for i in range(len(alp)):
    di[alp[i]] = i
alp = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'
# N = N % len(S)

ans = []
for s in S:
    ans.append(alp[di[s]+N])

print(''.join(ans))

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

ans = []
for i in range(N, len(S)):
    ans.append(S[i])

for i in range(N):
    ans.append(S[i])

print(''.join(ans))
Problem p02947 (python)

Fixed submission:
import sys 
from collections import Counter
from math import factorial

def combinations_count(n, r):
  return factorial(n) // (factorial(n - r) * factorial(r))
 
def main():
  inpurt = sys.stdin.readline
  N = int(input())
  texts = [''.join(sorted(list(input().rstrip()))) for _ in range(N)]
  c = Counter(texts)
  cnt = 0
  for t in c.values():
    if t > 1:
      cnt += combinations_count(t, 2)
  print(cnt)
 
if __name__ == '__main__':
  main()

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

def combinations_count(n, r):
  return factorial(n) // (factorial(n - r) * factorial(r))
 
def main():
  inpurt = sys.stdin.readline
  N = int(input())
  texts = [''.join(sorted(list(input().rstrip()))) for _ in range(N)]
  c = Counter(texts)
  print(sum([combinations_count(t, 2) for t in  c.values()]))
 
if __name__ == '__main__':
  main()
Problem p02983 (python)

Fixed submission:
def main():
    L, R = map(int, input().split())
    if R // 2019 > L // 2019:
        print(0)
        return
    retval = 2019
    for i in range(L, R):
        for j in range(i+1, R+1):
            retval = min(retval, (i % 2019 * j % 2019) % 2019)
    print(retval)
    return
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    L, R = map(int, input().split())
    start = time.time()
    if R // 2019 > L // 2019:
        print(0)
        return
    retval = 2019
    for i in range(L, R):
        for j in range(i+1, R+1):
            retval = min(retval, (i % 2019 * j % 2019) % 2019)
            if retval == 0:
                print(0)
                return
            
    print(retval)
    return
    
if __name__ == '__main__':
    main()
Problem p03000 (python)

Fixed submission:
def main():
    N, X = map(int, input().split())
    L = list(map(int, input().split()))
    D = 0
    i = 0
    while True:
        D += L[i]
        i += 1
        if D > X:
            print(i)
            return
        if i == N:
            print(i+1)
            return

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))
D = 0
i = 0
while D <= X:
    D += L[i]
    i += 1
print(i)
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(int, input().split())

if W % 2 == 0 and H % 2 == 0 and x == W // 2 and y == H // 2:
    is_mullt_ans = 1
else:
    is_mullt_ans = 0

print(W * H / 2, is_mullt_ans)

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(int, input().split())

divide_x = (x * H, (W-x) * H)
divide_y = (W * y, W * (H-y))
max_value = max(min(divide_x), min(divide_y))
if min(divide_x) == min(divide_y):
    is_mullt_ans = 1
else:
     is_mullt_ans = 0

print(max_value, is_mult_ans)
Problem p03032 (python)

Fixed submission:
import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop

def main():
    N, K = map(int, readline().rstrip().split())
    V = list(map(int, readline().rstrip().split()))
    V_rev = V[::-1]
    res = 0
    for x in range(min(N, K)+1):
        for y in range(min(N, K)-x+1):
            z = K - x - y
            temp = V[:x] + V_rev[:y]
            heapify(temp)
            for _ in range(z):
                if temp:
                    m = heappop(temp)
                    if m >= 0:
                        heappush(temp, m)
                        break
                else:
                    break

            res = max(res, sum(temp))
    
    print(res)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
from heapq import heapify, heappush, heappop

def main():
    N, K = map(int, readline().rstrip().split())
    V = list(map(int, readline().rstrip().split()))
    V_rev = V[::-1]
    res = 0
    for x in range(K+1):
        for y in range(K-x+1):
            z = K - x - y
            if z > x + y:
                continue
            temp = V[:x] + V_rev[:y]
            heapify(temp)
            for _ in range(z):
                heappop(temp)

            res = max(res, sum(temp))
    
    print(res)


if __name__ == '__main__':
    main()
Problem p03076 (python)

Fixed submission:
times = [int(input()) for i in range(5)]
cost = 0
p_times = [time % 10 for time in times]

if (sum([i % 10 for i in p_times]) == 0) & (min(times) > 0):
    last_order = False
else:
    last_order = min([i for i in p_times if i > 0])
    last_order_idx = p_times.index(last_order)

if last_order:
    cost = times.pop(last_order_idx)

for time in times:
    if time % 10 == 0:
        cost += time
    else:
        cost += time + (10 - time % 10)

print(cost)

Buggy submission (verdict: Runtime Error):
times = [int(input()) for i in range(5)]
cost = 0
p_times = [time % 10 for time in times]
if sum(p_times) == 0 and min(p_times) > 0:
    last_order = False
else:
    last_order = min([i for i in p_times if i > 0])
    last_order_idx = p_times.index(last_order)

if last_order:
    cost = times.pop(last_order_idx)

for time in times:
    if time % 10 == 0:
        cost += time
    else:
        cost += time + (10 - time % 10)

print(cost)
Problem p03106 (python)

Fixed submission:
import sys
A, B, K = map(int, input().split())
cnt = 0
if min(A, B) == 1:
    print(1)
    sys.exit()
    
for i in range(min(A, B), 0, -1):
    if A % i == 0 and B % i == 0:
        cnt += 1
        if cnt == K:
            print(i)
            break

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

ans = [1]
for i in range(2, A):
    if A % i == 0 and B % i == 0:
        ans.append(i)

print(ans[-K])
Problem p03409 (python)

Fixed submission:
import sys
readline = sys.stdin.readline
from operator import itemgetter

def main():
    N = int(readline())
    R = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]
    B = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]

    B.sort(key=itemgetter(0))
    R.sort(key=itemgetter(1), reverse=True)
    ans = 0
    for c, d in B:
        for a, b in R:
            if a < c and b < d:
                ans += 1
                R.remove((a, b))
                break
    
    print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
import networkx as nx
from networkx.algorithms import bipartite

def main():
    N = int(readline())
    R = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]
    B = [tuple(map(int, readline().rstrip().split())) for _ in range(N)]

    g = nx.Graph()  # 空の無向グラフを作成
    g.add_nodes_from([i for i in range(N)], bipartite=0)
    g.add_nodes_from([N + i for i in range(N)], bipartite=1)
    edge = []
    for i, (a, b) in enumerate(R):
        for j, (c, d) in enumerate(B):
            if a < c and b < d:
                g.add_edge(i, N+j, weight=1)

    d = nx.max_weight_matching(g)
    for (i, j) in g.edges():
        if ((i, j) not in d) and ((j, i) not in d):
            g.remove_edge(i, j)

    print(len(g.edges()))

if __name__ == '__main__':
    main()
Problem p03455 (python)

Fixed submission:
input_line = list(map(int, input().split()))
if ((input_line[0] * input_line[1]) % 2) == 0:
    print('Even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if ((a * b % 2) == 0:
    print('Even')
else:
    print('Odd')
Problem p03457 (python)

Fixed submission:
import sys
N = int(input())
t, x, y = 0, 0, 0
for i in range(N):
    in_t, in_x, in_y = map(int, input().split())
    t = in_t - t
    x = abs(in_x - x)
    y = abs(in_y - y)
    if (t >= x + y) & ((t - (x + y)) % 2 == 0):
        continue
    print('No')
    sys.exit()
print('Yes')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if ((a * b % 2) == 0:
    print('Even')
else:
    print('Odd')
Problem p03471 (python)

Fixed submission:
import sys
num_bill, y = map(int, input().split())
bills = [1000, 5000, 10000]

num_1000, num_5000, num_10000 = 0, 0, 0

for num_10000 in range(y // 10000 + 1):
    if (num_1000 * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
        print(num_10000, num_5000, num_1000)
        sys.exit()
        
    iter_num = min(((y - num_10000 * 10000) // 5000 + 1), (num_bill - num_10000 + 1))
    for num_5000 in range(iter_num):
        if (num_1000 * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
            print(num_10000, num_5000, num_1000)
            sys.exit()
        
        num_1000 = num_bill - num_10000 - num_5000
        if (num_1000 * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
            print(num_10000, num_5000, num_1000)
            sys.exit()

print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
import sys
num_bill, y = map(int, input().split())

for num_10000 in range(y // 10000 + 1):
    for num_5000 in range(min((y - num_10000 * 10000) // 5000 + 1, num_bill - num_10000 + 1)):
        if ((num_bill - num_10000 - num_5000) * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
            print(num_10000, num_5000, (num_bill - num_10000 - num_5000))
            sys.exit()

print('-1 -1 -1')

Buggy submission (verdict: Runtime Error):
import sys
num_bill, y = map(int, input().split())

for num_10000 in range(y // 10000 + 1):
    for num_5000 in range(min((y - num_10000 * 10000) // 5000 + 1, num_bill - num_10000 + 1)):
        (num_bill - num_10000 - num_5000)
        if ((num_bill - num_10000 - num_5000) * 1000 + num_5000 * 5000 + num_10000 * 10000 == y) & (num_10000 + num_5000 + num_1000 == num_bill):
            print(num_10000, num_5000, (num_bill - num_10000 - num_5000))
            sys.exit()

print('-1 -1 -1')