Buggy python submission (verdict: Time Limit Exceeded):
input_list = list(map(int, input().split()))
count = input_list[0]
y = input_list[1]

from math import floor

l_lim = floor(y / 10000)
m_lim = floor(y / 5000)
n_lim = floor(y / 1000)

flag = False
for l in range(l_lim + 1):
    for m in range(count - l + 1):
        for n in range(count - l - m + 1):
            if (l+m+n == count)&(10000 * l + 5000 * m + 1000 * n == y):
                print(l, m, n)
                flag = True
                break
        if flag:
            break
    if flag:
        break
if flag == False:
    print(-1, -1, -1)

Fixed submission:
input_list = list(map(int, input().split()))
count = input_list[0]
y = input_list[1]
flag = False
for l in range(count + 1):
    for m in range(count - l + 1):
        n = count - l - m
        if 10000 * l + 5000 * m + 1000 * n == y:
            print(l, m, n)
            flag = True
            break
        if flag:
            break
    if flag:
        break
if flag == False:
    print(-1, -1, -1)

Buggy python submission (verdict: Time Limit Exceeded):
input_list = list(map(int, input().split()))
count = input_list[0]
y = input_list[1]

from math import floor

l_lim = floor(y / 10000)
m_lim = floor(y / 5000)
n_lim = floor(y / 1000)

flag = False
for l in range(l_lim + 1):
    for m in range(m_lim + 1):
        for n in range(n_lim + 1):
            if (l+m+n == count)&(10000 * l + 5000 * m + 1000 * n == y):
                print(l, m, n)
                flag = True
                break
        if flag:
            break
    if flag:
        break
if flag == False:
    print(-1, -1, -1)

Fixed submission:
input_list = list(map(int, input().split()))
count = input_list[0]
y = input_list[1]
flag = False
for l in range(count + 1):
    for m in range(count - l + 1):
        n = count - l - m
        if 10000 * l + 5000 * m + 1000 * n == y:
            print(l, m, n)
            flag = True
            break
        if flag:
            break
    if flag:
        break
if flag == False:
    print(-1, -1, -1)

Buggy python submission (verdict: Runtime Error):
count = list(map(int, input().split()))[0]
y = list(map(int, input().split()))[1]
from math import floor

l_lim = floor(y / 10000)
m_lim = floor(y / 5000)
n_lim = floor(y / 1000)

flag = False
for l in range(l_lim + 1):
    for m in range(m_lim + 1):
        for n in range(n_lim + 1):
            if (l+m+n == count)&(10000 * l + 5000 * m + 1000 * n == y):
                print(l, m, n)
                flag = True
                break
        if flag:
            break
    if flag:
        break
if flag == False:
    print(-1, -1, -1)

Fixed submission:
input_list = list(map(int, input().split()))
count = input_list[0]
y = input_list[1]
flag = False
for l in range(count + 1):
    for m in range(count - l + 1):
        n = count - l - m
        if 10000 * l + 5000 * m + 1000 * n == y:
            print(l, m, n)
            flag = True
            break
        if flag:
            break
    if flag:
        break
if flag == False:
    print(-1, -1, -1)

Buggy python submission (verdict: Runtime Error):
count = list(map(int, input().split()))[0]
y = list(map(int, input().split()))[1]
from math import floor
import sys

l_lim = floor(y / 10000)
m_lim = floor(y / 5000)
n_lim = floor(y / 1000)

for l in range(l_lim + 1):
    for m in range(m_lim + 1):
        for n in range(n_lim + 1):
            if (l+m+n == count)&(10000 * l + 5000 * m + 1000 * n == y):
                print(l, m, n)
                sys.exit()
print(-1, -1, -1)

Fixed submission:
input_list = list(map(int, input().split()))
count = input_list[0]
y = input_list[1]
flag = False
for l in range(count + 1):
    for m in range(count - l + 1):
        n = count - l - m
        if 10000 * l + 5000 * m + 1000 * n == y:
            print(l, m, n)
            flag = True
            break
        if flag:
            break
    if flag:
        break
if flag == False:
    print(-1, -1, -1)