Buggy python submission (verdict: Time Limit Exceeded):
n, y = map(int, input().split())

for k in range(int(round(y/1000, 0)) + 1):
    for j in range(int(round(y/5000, 0)) + 1):
        for i in range(int(round(y/10000, 0)) + 1):
            if (10000*i) + (5000*j) + (1000*k) > y or i+j+k > n:
                break
            elif (10000*i) + (5000*j) + (1000*k) == y and i+j+k == n:
                print(i, j, k)
                exit()

print("-1 -1 -1")

Fixed submission:
n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if (10000*i) + (5000*j) + (1000*(n-i-j)) == y:
            print(i, j, n-i-j)
            exit()

print("-1 -1 -1")

Buggy python submission (verdict: Time Limit Exceeded):
n, y = map(int, input().split())

for k in range(int(round(y/1000, 0)) + 1):
    for j in range(int(round(y/5000, 0)) + 1):
        for i in range(int(round(y/10000, 0)) + 1):
            if (10000*i) + (5000*j) + (1000*k) > y and i+j+k > n:
                break
            elif (10000*i) + (5000*j) + (1000*k) == y and i+j+k == n:
                print(i, j, k)
                exit()

print("-1 -1 -1")

Fixed submission:
n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if (10000*i) + (5000*j) + (1000*(n-i-j)) == y:
            print(i, j, n-i-j)
            exit()

print("-1 -1 -1")

Buggy python submission (verdict: Time Limit Exceeded):
n, y = map(int, input().split())

for i in range(int(round(y/10000, 0)) + 1):
    for j in range(int(round(y/5000, 0)) + 1):
        for k in range(int(round(y/1000, 0)) + 1):
            if i+j+k > n:
                break
            elif (10000*i) + (5000*j) + (1000*k) == y and i+j+k == n:
                print(i, j, k)
                exit()

print("-1 -1 -1")

Fixed submission:
n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if (10000*i) + (5000*j) + (1000*(n-i-j)) == y:
            print(i, j, n-i-j)
            exit()

print("-1 -1 -1")

Buggy python submission (verdict: Time Limit Exceeded):
n, y = map(int, input().split())

for i in range(int(round(y/10000, 0)) + 1):
    for j in range(int(round(y/5000, 0)) + 1):
        for k in range(int(round(y/1000, 0)) + 1):
            if i+j+k > n:
                break
            elif (10000*i) + (5000*j) + (1000*k) == y and i+j+k == n:
                print(i, j, k)
                exit()

print("-1 -1 -1")

Fixed submission:
n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if (10000*i) + (5000*j) + (1000*(n-i-j)) == y:
            print(i, j, n-i-j)
            exit()

print("-1 -1 -1")

Buggy python submission (verdict: Time Limit Exceeded):
n, y = map(int, input().split())

for i in range(int(round(y/10000, 0)) + 1):
    for j in range(int(round(y/5000, 0)) + 1):
        for k in range(int(round(y/1000, 0)) + 1):
            if (10000*i) + (5000*j) + (1000*k) == y and i+j+k == n:
                print(i, j, k)
                exit()

print("-1 -1 -1")

Fixed submission:
n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if (10000*i) + (5000*j) + (1000*(n-i-j)) == y:
            print(i, j, n-i-j)
            exit()

print("-1 -1 -1")

Buggy python submission (verdict: Time Limit Exceeded):
n, y = map(int, input().split())

for i in range(int(round(y / 10000, 0))+1):
    for j in range(int(round(y / 5000, 0))+1):
        for k in range(int(round(y / 1000, 0))+1):
            if (10000*i) + (5000*j) + (1000*k) == y and i+j+k == n:
                print(i, j, k)
                exit()

print("-1 -1 -1")

Fixed submission:
n, y = map(int, input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if (10000*i) + (5000*j) + (1000*(n-i-j)) == y:
            print(i, j, n-i-j)
            exit()

print("-1 -1 -1")