Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python

n, y = map(int, input().split())
# print(n, y)

found = False
for i in range(n+1):
    for j in range(n+1):
        if i + j > n:
            break
        for k in range(n+1):
            if i + j + k > n:
                break
            if 10000 * i + 5000 * j + 1000 * k == y and i + j + k == n:
                found = True
                print("{} {} {}".format(i, j, k))
                break
        if found:
            break
    if found:
        break

if not found:
    print("-1 -1 -1")


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

n, y = map(int, input().split())
# print(n, y)

found = False
for i in range(n+1):
    for j in range(n+1):
        if i + j > n:
            break
        k = n - (i + j)
        if 10000 * i + 5000 * j + 1000 * k == y and i + j + k == n:
            found = True
            print("{} {} {}".format(i, j, k))
            break
    if found:
        break

if not found:
    print("-1 -1 -1")

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python

n, y = map(int, input().split())
# print(n, y)

found = False
for i in range(n+1):
    for j in range(n+1):
        for k in range(n+1):
            if 10000 * i + 5000 * j + 1000 * k == y and i + j + k == n:
                found = True
                print("{} {} {}".format(i, j, k))
                break
        if found:
            break
    if found:
        break

if not found:
    print("-1 -1 -1")


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

n, y = map(int, input().split())
# print(n, y)

found = False
for i in range(n+1):
    for j in range(n+1):
        if i + j > n:
            break
        k = n - (i + j)
        if 10000 * i + 5000 * j + 1000 * k == y and i + j + k == n:
            found = True
            print("{} {} {}".format(i, j, k))
            break
    if found:
        break

if not found:
    print("-1 -1 -1")

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

n, y = map(int, input().split())
# print(n, y)

found = False
for i in range(n+1):
    for j in range(n+1):
        for k in range(n+1):
            if 10000 * i + 5000 * j + 1000 * k == y and i + j + k == n:
                found = True
                print(f"{i} {j} {k}")
                break
        if found:
            break
    if found:
        break

if not found:
    print("-1 -1 -1")


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

n, y = map(int, input().split())
# print(n, y)

found = False
for i in range(n+1):
    for j in range(n+1):
        if i + j > n:
            break
        k = n - (i + j)
        if 10000 * i + 5000 * j + 1000 * k == y and i + j + k == n:
            found = True
            print("{} {} {}".format(i, j, k))
            break
    if found:
        break

if not found:
    print("-1 -1 -1")

Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python

n, y = map(int, input().split())
# print(n, y)

flag = False
for i in range(n+1):
    for j in range(n+1):
        for k in range(n+1):
            if 10000 * i + 5000 * j + 1000 * k == y and i + j + k == n:
                flag = True
                print(f"{i} {j} {k}")
                break
        if flag:
            break
    if flag:
        break

if not flag:
    print("-1 -1 -1")


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

n, y = map(int, input().split())
# print(n, y)

found = False
for i in range(n+1):
    for j in range(n+1):
        if i + j > n:
            break
        k = n - (i + j)
        if 10000 * i + 5000 * j + 1000 * k == y and i + j + k == n:
            found = True
            print("{} {} {}".format(i, j, k))
            break
    if found:
        break

if not found:
    print("-1 -1 -1")