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

N,Y = map(int,input().split())

for i in range(N+1):
    if Y < i * 10000:
        continue
    for j in range(N+1):
        if N == i + j + k and Y == i * 10000 + j * 5000 + k * 1000:
            print(i,j,k)
            sys.exit()
print("-1 -1 -1")


Fixed submission:
import sys

N,Y = map(int,input().split())

for i in range(N+1):
    for j in range(N+1):
        k = N - i - j

        if k >= 0 and Y == i * 10000 + j * 5000 + k * 1000:
            print(i,j,k)
            sys.exit()
print("-1 -1 -1")

Buggy python submission (verdict: Time Limit Exceeded):
import sys

N,Y = map(int,input().split())

for i in range(N+1):
    if Y < i * 10000:
        continue
    for j in range(N+1):
        if N < i + j or Y < i * 10000 + 5000 * j:
            break
        for k in range(N+1):
            if N < i + j + k or Y < i * 10000 + j * 5000 + k * 1000:
                break
            if N == i + j + k and Y == i * 10000 + j * 5000 + k * 1000:
                print(i,j,k)
                sys.exit()
print("-1 -1 -1")


Fixed submission:
import sys

N,Y = map(int,input().split())

for i in range(N+1):
    for j in range(N+1):
        k = N - i - j

        if k >= 0 and Y == i * 10000 + j * 5000 + k * 1000:
            print(i,j,k)
            sys.exit()
print("-1 -1 -1")

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

N,Y = map(int,input().split())

for i in range(N+1):
    if Y < i * 10000:
        continue
    for j in range(N+1):
        if N < i + j or Y < i * 10000 + 5000 * j:
            break
        for k in range(N+1):
          	if N < i + j + k or Y < i * 10000 + j * 5000 + k * 1000:
                break
            if N == i + j + k and Y == i * 10000 + j * 5000 + k * 1000:
				print(i,j,k)
                sys.exit()
print("-1 -1 -1")

Fixed submission:
import sys

N,Y = map(int,input().split())

for i in range(N+1):
    for j in range(N+1):
        k = N - i - j

        if k >= 0 and Y == i * 10000 + j * 5000 + k * 1000:
            print(i,j,k)
            sys.exit()
print("-1 -1 -1")

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

N,Y = map(int,input().split())

for i in range(N+1):
    if Y < i * 10000:
        continue
    for j in range(N+1):
        if N < i + j or Y < i * 10000 + 5000 * j:
            break
        for k in range(N+1):
          	if N < i + j + k or Y < i * 10000 + j * 5000 + k * 1000:
            if N == i + j + k and Y == i * 10000 + j * 5000 + k * 1000:
				print(i,j,k)
                sys.exit()
print("-1 -1 -1")


Fixed submission:
import sys

N,Y = map(int,input().split())

for i in range(N+1):
    for j in range(N+1):
        k = N - i - j

        if k >= 0 and Y == i * 10000 + j * 5000 + k * 1000:
            print(i,j,k)
            sys.exit()
print("-1 -1 -1")

Buggy python submission (verdict: Time Limit Exceeded):
import sys

N,Y = map(int,input().split())

for i in range(N+1):
    for j in range(N+1):
        for k in range(N+1):
            if N == i + j + k:
                if Y == i * 10000 + j * 5000 + k * 1000:
                    print(i,j,k)
                    sys.exit()
print("-1 -1 -1")


Fixed submission:
import sys

N,Y = map(int,input().split())

for i in range(N+1):
    for j in range(N+1):
        k = N - i - j

        if k >= 0 and Y == i * 10000 + j * 5000 + k * 1000:
            print(i,j,k)
            sys.exit()
print("-1 -1 -1")