Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())

answer = '-1 -1 -1'
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y and z >= 0:
            answer = f'{x} {y} {z}'
            break
print(answer)


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

answer = '-1 -1 -1'
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y and z >= 0:
            answer = str(x) + ' ' + str(y) + ' ' + str(z) 
            break
print(answer)

Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())

answer = '-1 -1 -1'
for x in range(0,N+1):
    for y in range(0,N+1):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y and z >= 0:
            answer = f'{x} {y} {z}'
            break
print(answer)





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

answer = '-1 -1 -1'
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y and z >= 0:
            answer = str(x) + ' ' + str(y) + ' ' + str(z) 
            break
print(answer)

Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())

answer = '-1 -1 -1'
for x in range(0,N+1):
    for y in range(0,N+1):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y and x + y + z == N and z >= 0:
            answer = f'{x} {y} {z}'
            break
    else:
        continue
    break
print(answer)





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

answer = '-1 -1 -1'
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y and z >= 0:
            answer = str(x) + ' ' + str(y) + ' ' + str(z) 
            break
print(answer)

Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())

answer = '-1 -1 -1'
for x in range(0,N+1):
    for y in range(0,N+1):
        for z in range(0,N+1):
            if 10000*x + 5000*y + 1000*z == Y and x + y + z == N:
                answer = f'{x} {y} {z}'
                break
        else:
            continue
        break
    else:
        continue
    break
print(answer)

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

answer = '-1 -1 -1'
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y and z >= 0:
            answer = str(x) + ' ' + str(y) + ' ' + str(z) 
            break
print(answer)

Buggy python submission (verdict: Runtime Error):
N, Y = map(int, input().split())

answer = '-1 -1 -1'
for x in range(0,N+1):
    for y in range(0,N+1):
        for z in range(0,N+1):
            if 10000*x + 5000*y + 1000*z == Y and x + y + z == N:
                answer = f'{x} {y} {z}'
                break
        else:
            continue
        break
    else:
        continue
    break
print(answer)





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

answer = '-1 -1 -1'
for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        if 10000*x + 5000*y + 1000*z == Y and z >= 0:
            answer = str(x) + ' ' + str(y) + ' ' + str(z) 
            break
print(answer)