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


a = Y//10000
b = Y//5000

flag = False

for i in range(a+1):
    if flag == True:
        break
    for j in range(b+1):
        if N-i-j<0:
            break:
        if i*10000+j*5000+(N-i-j)*1000 == Y:
            flag = True
            s = i
            t = j
            u = N-i-j
            break

if flag == True:
    print(s,t,u)
else:
    print(-1,-1,-1)

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


a = Y//10000
b = Y//5000

flag = False

for i in range(a+1):
    if flag == True:
        break
    for j in range(b+1):
        if N-i-j<0:
            break
        if i*10000+j*5000+(N-i-j)*1000 == Y:
            flag = True
            s = i
            t = j
            u = N-i-j
            break

if flag == True:
    print(s,t,u)
else:
    print(-1,-1,-1)

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


a = Y//10000
b = Y//5000
c = Y//1000

flag = False

for i in range(a+1):
    if flag == True:
        break
    if i>N:
        break
    for j in range(b+1-2*i):
        if flag == True:
            break
        if i+j > N:
            break
        for k in range(c+1-10*i-5*j):
            if (i + j + k) > N:
                break
            if i+j+k == N:
                if i*10000+j*5000+k*1000 == Y:
                    flag = True
                    s = i
                    t = j
                    u = k

if flag == True:
    print(s,t,u)
else:
    print(-1,-1,-1)

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


a = Y//10000
b = Y//5000

flag = False

for i in range(a+1):
    if flag == True:
        break
    for j in range(b+1):
        if N-i-j<0:
            break
        if i*10000+j*5000+(N-i-j)*1000 == Y:
            flag = True
            s = i
            t = j
            u = N-i-j
            break

if flag == True:
    print(s,t,u)
else:
    print(-1,-1,-1)

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


a = Y//10000
b = Y//5000
c = Y//1000

flag = False

for i in range(a+1):
    if flag == True:
        break
    for j in range(b+1-2*i):
        if flag == True:
            break
        for k in range(c+1-10*i-5*j):
            if i+j+k == N:
                if i*10000+j*5000+k*1000 == Y:
                    flag = True
                    s = i
                    t = j
                    u = k

if flag == True:
    print(s,t,u)
else:
    print(-1,-1,-1)

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


a = Y//10000
b = Y//5000

flag = False

for i in range(a+1):
    if flag == True:
        break
    for j in range(b+1):
        if N-i-j<0:
            break
        if i*10000+j*5000+(N-i-j)*1000 == Y:
            flag = True
            s = i
            t = j
            u = N-i-j
            break

if flag == True:
    print(s,t,u)
else:
    print(-1,-1,-1)

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


a = Y//10000
b = Y//5000
c = Y//1000

flag = False

for i in range(a+1):
    if flag == True:
        break
    for j in range(b+1):
        if flag == True:
            break
        for k in range(c+1):
            if i+j+k == N:
                if i*10000+j*5000+k*1000 == Y:
                    flag = True
                    s = i
                    t = j
                    u = k

if flag == True:
    print(s,t,u)
else:
    print(-1,-1,-1)

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


a = Y//10000
b = Y//5000

flag = False

for i in range(a+1):
    if flag == True:
        break
    for j in range(b+1):
        if N-i-j<0:
            break
        if i*10000+j*5000+(N-i-j)*1000 == Y:
            flag = True
            s = i
            t = j
            u = N-i-j
            break

if flag == True:
    print(s,t,u)
else:
    print(-1,-1,-1)