Buggy python submission (verdict: Runtime Error):
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N+a):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z > 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)

Fixed submission:
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)

Buggy python submission (verdict: Runtime Error):
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N+a):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z > 0 and oto_sum == Y:
            lmn[0] = x
            lmn[1] = y
            lmn[2] = z

print(lmn[0], lmn[1], lmn[2])

Fixed submission:
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)

Buggy python submission (verdict: Runtime Error):
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    flag = 0
    Y_rem = Y - x * 10000
    N_rem = N - x

    if Y_rem >= 0 and N_rem >= 0:
        flag = 1

    if flag = 1:
        for y in range(N_rem+1):
            flag_2  = 0
            Y_rem_2 = Y_rem - y * 5000
            z       = N_rem - y
            if Y_rem_2 >= 0 and z >= 0:
                flag_2 = 1
            if Y_rem_2 == z *1000 and flag_2 == 1:
                lmn[0] = x
                lmn[1] = y
                lmn[2] = z

Fixed submission:
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)

Buggy python submission (verdict: Runtime Error):
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [[-1, -1, -1]]

for x in range(N+1):
    for y in range(N+1):
        flag = 0
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and Y == oto_sum:
            lmn.append([x, y, z])
print(lmn[1][0],lmn[1][1],lmn[1][2])

Fixed submission:
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)

Buggy python submission (verdict: Runtime Error):
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [[-1, -1, -1]]

for x in range(N+1):
    for y in range(N+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if Y == oto_sum:
            lmn.append([x, y, z])
print(lmn[1][0],lmn[1][1],lmn[1][2])

Fixed submission:
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)

Buggy python submission (verdict: Runtime Error):
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [[-1, -1, -1]]

for x in range(N+1):
    flag = 0
    Y_rem = Y - x * 10000
    N_rem = N - x

    if Y_rem >= 0 and N_rem >= 0:
        flag = 1

    if flag == 1:
        for y in range(N_rem+1):
            flag_2  = 0
            Y_rem_2 = Y_rem - y * 5000
            z       = N_rem - y
            if Y_rem_2 >= 0 and z >= 0:
                flag_2 = 1
            if Y_rem_2 == z *1000 and flag_2 == 1:
                lmn.append([x, y, z])
print(lmn[1][0],lmn[1][1],lmn[1][2])

Fixed submission:
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)

Buggy python submission (verdict: Runtime Error):
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [[-1, -1, -1]]

for x in range(N+1):
    flag = 0
    Y_rem = Y - x * 10000
    N_rem = N - x

    if Y_rem >= 0 and N_rem >= 0:
        flag = 1

    if flag = 1:
        for y in range(N_rem+1):
            flag_2  = 0
            Y_rem_2 = Y_rem - y * 5000
            z       = N_rem - y
            if Y_rem_2 >= 0 and z >= 0:
                flag_2 = 1
            if Y_rem_2 == z *1000 and flag_2 == 1:
                lmn.append([x, y, z])
print(lmn[1][0],lmn[1][1],lmn[1][2])

Fixed submission:
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)

Buggy python submission (verdict: Runtime Error):
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [[-1, -1, -1]]

for x in range(N+1):
    Y_rem = Y - x * 10000
    N_rem = N - x
    if Y_rem >= 0 and N_rem >= 0:
        for y in range(N_rem+1):
            Y_rem_2 = Y_rem - y * 5000
            z = N_rem - y
            flag = Y_rem_2 * z
            if Y_rem_2 == z *1000 and flag >= 0:
                lmn.append([x, y, z])
print(lmn[1][0],lmn[1][1],lmn[1][2])

Fixed submission:
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)

Buggy python submission (verdict: Runtime Error):
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [[-1, -1, -1]]

for x in range(N+1):
    Y_rem = Y - x * 10000
    N_rem = N - x
    if Y_rem >= 0:
        for y in range(N_rem+1):
            Y_rem_2 = Y_rem - y * 5000
            z = N_rem - y
            if Y_rem_2 == z *1000:
                lmn.append([x, y, z])
print(lmn[1][0],lmn[1][1],lmn[1][2])

Fixed submission:
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)

Buggy python submission (verdict: Runtime Error):
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [[-1, -1, -1]]

for x in range(N+1):
    Y_rem = Y - x * 10000
    N_rem = N - x
    if Y_rem >= 0:
        for y in range(N_rem+1):
            Y_rem = Y - x * 10000 - y * 5000
            N_rem = N - x - y
            z     = N_rem
            if Y_rem == z *1000:
                lmn.append([x, y, z])
print(lmn[1][0],lmn[1][1],lmn[1][2])

Fixed submission:
inr = lambda: list(map(int, input().split()))

N, Y = inr()

lmn = [-1, -1, -1]

for x in range(N+1):
    for y in range(N-x+1):
        z = N - x - y
        oto_sum = 10000 * x + 5000 * y + 1000 * z
        if z >= 0 and oto_sum == Y:
            print(x, y, z)
            exit()

print(-1, -1, -1)