Buggy python submission (verdict: Runtime Error):
N,Y = map(int, input().split(" "))
f = False
t = int(Y/10000)
for a in range(t+1):
    for b in range(N+1):
        if a+b>N:
            break
        c=N-a-b
        num = a*10000+b*5000+c*1000
        if num==Y:
            print(str(a)+" "+ str(b)+" "+str(c)')
            f=True
            break
    if f:
        break
if f==False:
    print('-1 -1 -1')


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

t = int(Y/10000)
end=False
for x in range(0,t+1):
    for y in range(0,N+1):
        if x+y>N:
            break
        z = N-x-y
        num = x*10000+y*5000+z*1000
        if num==Y:
            print(str(x)+" "+str(y)+" "+str(z))
            end=True
            break
    if end:
        break
if end==False:
    print("-1 -1 -1")

Buggy python submission (verdict: Runtime Error):
N,Y = map(int, input().split(" "))
f = False
t = int(Y/10000)
for a in range(t+1):
    for b in range(N+1):
        if a+b>N:
            break
        c=N-a-b
        tot = a*10000+b*5000+c*1000
        if tot==Y:
            print(f'{a} {b} {c}')
            f=True
            break
    if f:
        break
if f==False:
    print('-1 -1 -1')

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

t = int(Y/10000)
end=False
for x in range(0,t+1):
    for y in range(0,N+1):
        if x+y>N:
            break
        z = N-x-y
        num = x*10000+y*5000+z*1000
        if num==Y:
            print(str(x)+" "+str(y)+" "+str(z))
            end=True
            break
    if end:
        break
if end==False:
    print("-1 -1 -1")

Buggy python submission (verdict: Runtime Error):
N,Y = map(int, input().split(" "))
flag = False
t = int(Y/10000)
for a in range(t+1):
    for b in range(N+1):
        if a+b>N:
            break
        c=N-(a+b)
        tot = a*10000+b*5000+c*1000
        if tot==Y:
            flag=True
            break
    if flag:
        break
if flag:
    print(f'{a} {b} {c}')
else:
    print('-1 -1 -1')


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

t = int(Y/10000)
end=False
for x in range(0,t+1):
    for y in range(0,N+1):
        if x+y>N:
            break
        z = N-x-y
        num = x*10000+y*5000+z*1000
        if num==Y:
            print(str(x)+" "+str(y)+" "+str(z))
            end=True
            break
    if end:
        break
if end==False:
    print("-1 -1 -1")

Buggy python submission (verdict: Runtime Error):
N,Y = map(int, input().split(" "))
flag = False
t = int(Y/10000)
for a in range(t+1):
    for b in range(N+1):
        c=N-(a+b)
        if c<0:
            break
        tot = a*10000+b*5000+c*1000
        if tot==Y:
            flag=True
            break
    if flag:
        break
if flag:
    print(f'{a} {b} {c}')
else:
    print('-1 -1 -1')

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

t = int(Y/10000)
end=False
for x in range(0,t+1):
    for y in range(0,N+1):
        if x+y>N:
            break
        z = N-x-y
        num = x*10000+y*5000+z*1000
        if num==Y:
            print(str(x)+" "+str(y)+" "+str(z))
            end=True
            break
    if end:
        break
if end==False:
    print("-1 -1 -1")

Buggy python submission (verdict: Runtime Error):
N,Y = map(int, input().split(" "))
flag = False
for a in range(N+1):
    for b in range(N+1):
        c=N-(a+b)
        if c<0:
            break
        tot = a*10000+b*5000+c*1000
        if tot==Y:
            flag=True
            break
    if flag:
        break
if flag:
    print(f'{a} {b} {c}')
else:
    print('-1 -1 -1')

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

t = int(Y/10000)
end=False
for x in range(0,t+1):
    for y in range(0,N+1):
        if x+y>N:
            break
        z = N-x-y
        num = x*10000+y*5000+z*1000
        if num==Y:
            print(str(x)+" "+str(y)+" "+str(z))
            end=True
            break
    if end:
        break
if end==False:
    print("-1 -1 -1")

Buggy python submission (verdict: Time Limit Exceeded):
N,Y = map(int,input().split(" "))

t = int(Y/10000)
end=False
for x in range(0,t+1):
    for y in range(0,N+1):
        for z in range(0,N+1):
            ans = x*10000+y*5000+z*1000
            if ans==Y and x+y+z==N:
                print(str(x)+" "+str(y)+" "+str(z))
                end=True
                break
        if end:
            break
    if end:
        break
if end==False:
    print("-1 -1 -1")


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

t = int(Y/10000)
end=False
for x in range(0,t+1):
    for y in range(0,N+1):
        if x+y>N:
            break
        z = N-x-y
        num = x*10000+y*5000+z*1000
        if num==Y:
            print(str(x)+" "+str(y)+" "+str(z))
            end=True
            break
    if end:
        break
if end==False:
    print("-1 -1 -1")

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

t = int(Y/10000)
end=False
for x in range(1,t+1):
    for y in range(1,20001):
        for z in range(1,20001):
            ans = x*10000+y*5000+z*1000
			if ans==Y and x+y+z==N:
                print(str(x)+" "+str(y)+" "+str(z))
                end=True
                break
        if end:
            break
    if end:
        break
if end==False:
    print("-1 -1 -1")

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

t = int(Y/10000)
end=False
for x in range(0,t+1):
    for y in range(0,N+1):
        if x+y>N:
            break
        z = N-x-y
        num = x*10000+y*5000+z*1000
        if num==Y:
            print(str(x)+" "+str(y)+" "+str(z))
            end=True
            break
    if end:
        break
if end==False:
    print("-1 -1 -1")