Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
if n == 1:
  print('Hello World')
elif n == 2:
  a, b = map(int, input().split())
  print(a+b)

Fixed submission:
n = int(input())
if n == 1:
  print('Hello World')
elif n == 2:
  a = int(input())
  b = int(input())
  print(a+b)
Buggy python submission (verdict: Runtime Error):
s = input()
s[3] = '8'
print(s)

Fixed submission:
s = list(input().split('/'))
s[0] = '2018'
print('/'.join(s))
Buggy python submission (verdict: Runtime Error):
weight = list(map(int, input().split()))
if a+b > c+d:
  print('Left')
elif a+b < c+d:
  print('Right')
else:
  print('Balanced')

Fixed submission:
weight = list(map(int, input().split()))
if weight[0]+weight[1] > weight[2]+weight[3]:
  print('Left')
elif weight[0]+weight[1] < weight[2]+weight[3]:
  print('Right')
else:
  print('Balanced')
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
x = (a+b)/2
print(ceil(x))

Fixed submission:
import math
a, b = map(int, input().split())
x = (a+b)/2
print(math.ceil(x))
Buggy python submission (verdict: Runtime Error):
n = int(input())
num_list = list(map(int,input()))

sorted_num_list = sorted(num_list)
cnt = 0
for i in range(len(num_list)):
	if num_list[i] != sorted_num_list[i]:
		cnt += 1
if cnt < 3:
	print("YES")
else:
	print("NO")

Fixed submission:
n = int(input())
num_list = list(map(int,input().split()))
sorted_num_list = sorted(num_list)
cnt = 0
for i in range(len(num_list)):
	if num_list[i] != sorted_num_list[i]:
		cnt += 1
if cnt < 3:
	print("YES")
else:
	print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n = int(input())
    a_list = list(map(int,input().split()))
    a = 0
    end = 0
    for i in range(n):
        if i%2 == 0:
            a += a_list[i]*0.5
        else:
            a -= a_list[i]*0.5

    out = str(int(a*2))
    point = a
    for i in range(n-1):
        point = a_list[i]-point
        out += " "+str(int(point*2))
    print(out)

if __name__ == "__main__":
    main()

Fixed submission:
def main():
    n = int(input())
    a_list = list(map(int,input().split()))
    a = 0
    end = 0
    for i in range(n):
        if i%2 == 0:
            a += a_list[i]*0.5
        else:
            a -= a_list[i]*0.5

    out = str(int(a*2))
    point = a
    for i in range(n-1):
        point = a_list[i]-point
        out += " "+str(int(point*2))
    print(out)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int,input().split()))
ans = []
a = 0
for i in range(n):
    if i%2 == 0:
        a += a_list[i]/2
    else:
        a -= a_list[i]/2
out = str(int(a*2))
point = a
for i in range(n-1):
    point = a_list[i]-point
    out += " "+str(int(point*2))
print(out)

Fixed submission:
def main():
    n = int(input())
    a_list = list(map(int,input().split()))
    a = 0
    end = 0
    for i in range(n):
        if i%2 == 0:
            a += a_list[i]*0.5
        else:
            a -= a_list[i]*0.5

    out = str(int(a*2))
    point = a
    for i in range(n-1):
        point = a_list[i]-point
        out += " "+str(int(point*2))
    print(out)

if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int,input().split()))
ans = []
a = 0
for i in range(n):
    if i%2 == 0:
        a += a_list[i]/2
    else:
        a -= a_list[i]/2
ans.append(2*a)
point = a
for i in range(n):
    point = a_list[i]-point
    ans.append(point*2)
out = ""
for num in ans[:-1]:
    out += str(int(num)) + " "
print(out[:-1])

Fixed submission:
def main():
    n = int(input())
    a_list = list(map(int,input().split()))
    a = 0
    end = 0
    for i in range(n):
        if i%2 == 0:
            a += a_list[i]*0.5
        else:
            a -= a_list[i]*0.5

    out = str(int(a*2))
    point = a
    for i in range(n-1):
        point = a_list[i]-point
        out += " "+str(int(point*2))
    print(out)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
displace = []
for _ in range(m):
    displace.append(int(input()))

dp = [1]
if 1 in displace:
    dp.append(0)
else:
    dp.append(1)

for i in range(2,n+1):
    next_case = 0
    if i not in displace:
        next_case += dp[i-1]+dp[i-2]
    dp.append(next_case%1000000007)
print(dp[-1])

Fixed submission:
n,m = map(int,input().split())
displace = {}
for _ in range(m):
    displace[int(input())] = 1
dp = {0:1}
if 1 in displace:
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2,n+1):
    next_case = 0
    if i not in displace:
        next_case += dp[i-1]+dp[i-2]
    dp[i] = next_case%1000000007
print(dp[n])
Buggy python submission (verdict: Runtime Error):
n = int(input())
adj = [[i,0] for i in range(n+1) ]
adj_path = []
for _ in range(n-1):
    a,b = map(int,input().split())
    adj_path.append([a,b])
    adj[a][1] += 1
    adj[b][1] += 1
c_list = sorted(list(map(int,input().split())))
out = [0 for i in range(n+1)]
if len(adj_path) == 0:
    print(0)
    print(" ")
else:
    for i,[name,rank] in enumerate(sorted(adj,key=lambda x:x[1])):
        if name != 0:
            out[name] = c_list[i]
    score = 0
    for a,b in adj_path:
        score += min(out[a],out[b])
    print(score)
    print(" ".join(str(x) for x in out[1:]))

Fixed submission:
n = int(input())
adj_path = [[] for _ in range(n)]
paths = []
for _ in range(n-1):
    a,b = map(int,input().split())
    paths.append([a,b])
    adj_path[a-1].append(b-1)
    adj_path[b-1].append(a-1)
c_list = sorted(list(map(int,input().split())),reverse=True)
out = [0 for i in range(n)]
que = [[0,adj_path[0]]]
visited = []
cnt = 0
while(que):
    node_num,children = que.pop(0)
    visited.append(node_num)
    out[node_num] = c_list[cnt]
    cnt += 1
    for child in children:
        if child not in visited:
            que.append([child,adj_path[child]])
score = 0
for path in paths:
    a,b = path
    score += min(out[a-1],out[b-1])
print(score)
print(" ".join(str(x) for x in out))
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
S = input()
ac_list = []
question_list = []
for i in range(len(S)+1):
    ac_list.append(S[:i].count("AC"))
for _ in range(q):
    l, r = map(int,input().split())
    question_list.append([l,r])
for l,r in question_list:
    print(ac_list[r]-ac_list[l])

Fixed submission:
n,q = map(int,input().split())
S = input()
ac_list = [0,0]
question_list = []
for i in range(len(S)-1):
    if S[i:i+2] == "AC":
        ac_sum = ac_list[i+1] + 1
        ac_list.append(ac_sum)
    else:
        ac_list.append(ac_list[-1])
for _ in range(q):
    l, r = map(int,input().split())
    question_list.append([l,r])
for l,r in question_list:
    print(ac_list[r]-ac_list[l])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
S = input()
question_list = []
for _ in range(q):
    l, r = map(int,input().split())
    question_list.append([l,r])
for l,r in question_list:
    print(S[l-1:r].count("AC"))

Fixed submission:
n,q = map(int,input().split())
S = input()
ac_list = [0,0]
question_list = []
for i in range(len(S)-1):
    if S[i:i+2] == "AC":
        ac_sum = ac_list[i+1] + 1
        ac_list.append(ac_sum)
    else:
        ac_list.append(ac_list[-1])
for _ in range(q):
    l, r = map(int,input().split())
    question_list.append([l,r])
for l,r in question_list:
    print(ac_list[r]-ac_list[l])
Buggy python submission (verdict: Runtime Error):
import math

a,b,k = map(int,input().split())
x = math.gcd(a,b)
list_num = []
for i in range(1,x+1):
    if x % i == 0:
        list_num.append(i)
list_num = sorted(list_num,reverse=True)
print(list_num[k-1])

Fixed submission:
def gcd(a,b):
    if b==0: 
        return a
    return gcd(b,a%b)

a,b,k = map(int,input().split())
x = gcd(a,b)
list_num = []
for i in range(1,x+1):
    if x % i == 0:
        list_num.append(i)
list_num = sorted(list_num,reverse=True)
print(list_num[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
s = input()

i = 0
while(True):
    if ("01" in s ) :
        s = s.replace("01","",1) 
        i += 1
    elif "10" in s:
        s = s.replace("10","",1)
        i += 1
    else:
        break
print(i*2)

Fixed submission:
s = input()

num_0 = s.count("0")
num_1 = s.count("1")
if num_0 < num_1:
    print(num_0*2)
else:
    print(num_1*2)

Buggy python submission (verdict: Runtime Error):
s = input()

i = 0
while(True):
    if ("01" in s ) :
        s = s.replace("01","",1) 
        i += 1
    elif "10" in s:
        s = s.replace("10","",1)
        i += 1
    else:
        break
    print(s)
print(i*2)

Fixed submission:
s = input()

num_0 = s.count("0")
num_1 = s.count("1")
if num_0 < num_1:
    print(num_0*2)
else:
    print(num_1*2)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
a_list = sorted(list(map(int,input().split())))

a = a_list[0]
for i in range(1,n):
    a = math.gcd(a,a_list[i])

print(a)

Fixed submission:
import fractions
n = int(input())
a_list = sorted(list(map(int,input().split())))

a = a_list[0]
for i in range(1,n):
    a = fractions.gcd(a,a_list[i])

print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
S = list(input())
min_people = int(1e+6)

for i in range(n):
    if i == n-1:
        min_people = min(min_people,S[:i].count("W"))
    else:
        min_people = min(min_people,S[:i].count("W")+S[i+1:].count("E"))
    
print(min_people)


Fixed submission:
n = int(input())
S = list(input())
dp = [0 for i in range(n)]
dp[0] = S[1:].count("E")

for i in range(n-1):
    if S[i] == S[i+1] == "E":
        dp[i+1] = dp[i]-1
    elif S[i] == S[i+1] == "W":
        dp[i+1] = dp[i]+ 1
    else:
        dp[i+1] = dp[i]

print(min(dp))
Buggy python submission (verdict: Runtime Error):


n = int(input())

number_list = list(map(int,input().split()))
tmp_list = sorted(number_list)


for number in number_list:
    if number < tmp_list[n//2]:
        print(tmp_list[n//2])
    else :
        print(tmp_list[n//2-1])


Fixed submission:
a,b,x = map(int,input().split())

if a <= x and a+b >= x:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):


if __name__ == "__main__":

    n = int(input())

    number_list = list(map(int,input().split()))
    tmp_list = number_list[:]
    tmp_list.sort()

    for number in number_list:
        i = tmp_list.index(number)
        if i < (n/2):
            print(tmp_list[int(n/2)])
        else :
            print(tmp_list[int(n/2)-1])


Fixed submission:


n = int(input())

number_list = list(map(int,input().split()))
tmp_list = sorted(number_list)


for number in number_list:
    if number < tmp_list[n//2]:
        print(tmp_list[n//2])
    else :
        print(tmp_list[n//2-1])

Buggy python submission (verdict: Time Limit Exceeded):
def median(list):
    list.sort()
    median = list[int((len(list)+1)/2)-1]
    return median

if __name__ == "__main__":

    n = int(input())

    number_list = list(map(int,input().split()))

    for i in range(n):
        m = median(number_list[:i]+number_list[i+1:])
        print(m)


Fixed submission:


n = int(input())

number_list = list(map(int,input().split()))
tmp_list = sorted(number_list)


for number in number_list:
    if number < tmp_list[n//2]:
        print(tmp_list[n//2])
    else :
        print(tmp_list[n//2-1])

Buggy python submission (verdict: Time Limit Exceeded):
def median(list):
    list.sort()
    median = list[int((len(list)+1)/2)-1]
    return median


n = int(input())

number_list = list(map(int,input().split()))

for i in range(n):
    tmp_list = number_list[:i]+number_list[i+1:]
    m = median(tmp_list)
    print(m)


Fixed submission:


n = int(input())

number_list = list(map(int,input().split()))
tmp_list = sorted(number_list)


for number in number_list:
    if number < tmp_list[n//2]:
        print(tmp_list[n//2])
    else :
        print(tmp_list[n//2-1])
Buggy python submission (verdict: Time Limit Exceeded):
def cost_culc(spot_list):
    cost = 0
    for i in range(1,len(spot_list)):
        cost += abs(spot_list[i]-spot_list[i-1])
    cost += abs(spot_list[0])+abs(spot_list[len(spot_list)-1])
    return cost

n = int(input())
spot_list = list(map(int,input().split()))

for i in range(len(spot_list)):
    deleted_list = spot_list[:i]+spot_list[i+1:]
    cost = cost_culc(deleted_list)
    print(cost)


Fixed submission:

n = int(input())
spot_list = list(map(int,input().split()))
max_cost = 0

#maxの計算
for i in range(1,len(spot_list)):
    max_cost += abs(spot_list[i]-spot_list[i-1])
max_cost += abs(spot_list[0])+abs(spot_list[len(spot_list)-1])

spot_list = [0] + spot_list + [0]
for i in range(1,len(spot_list)-1):
    d_pay = abs(spot_list[i-1]-spot_list[i+1]) - (abs(spot_list[i]-spot_list[i-1])+abs(spot_list[i+1]-spot_list[i]))
    print(max_cost+d_pay)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

if n==1 and m==1:
    ans = 1
elif n==1 or m==1:
    ans = n*m-2
else:
    ans = (n-2)*(m-2)

print(ans)

Fixed submission:
n = 3
ans = ""
for i in range(n):
    text = input()
    ans += text[i]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def cul_dis(start,goal):
    return abs(start[0]-goal[0])+abs(start[1]-goal[1])

H,W,d = map(int,input().split())
number_pos = {}

for h in range(H) :
    state = list(map(int,input().split()))
    for i,number in enumerate(state):
        number_pos[number] = [h,i]

Q = int(input())

exams = []
for _ in range(Q):
    exams.append(list(map(int,input().split())))

for [L,R] in exams:
    mp = 0
    now_number = L
    while(now_number!=R):
        next_number = now_number+d
        mp += cul_dis(number_pos[now_number],number_pos[next_number])
        now_number = next_number
    print(mp)

Fixed submission:
def cul_dis(start,goal):
    return abs(start[0]-goal[0])+abs(start[1]-goal[1])

H,W,d = map(int,input().split())
number_pos = {}

for h in range(H) :
    state = list(map(int,input().split()))
    for i,number in enumerate(state):
        number_pos[number] = [h,i]

Q = int(input())

exams = []
for _ in range(Q):
    exams.append(list(map(int,input().split())))

mp_consume = [0 for i in range(H*W)]

for i in range(H*W)[::-1]:
    if i+d <= H*W-1:
        mp_consume[i] = mp_consume[i+d]+cul_dis(number_pos[i+1],number_pos[i+d+1])

for [start,goal] in exams:
    ans = mp_consume[start-1]-mp_consume[goal-1]
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
h,w = map(int,input().split())
counter = 0
space = [[-1 for i in range(w+2)]]
for i in range(1,h+1):
    r = input()
    s = list("#"+r+"#")
    counter += r.count("#")
    space.append([])
    for j,moji in enumerate(s):
        if moji == ".":
            space[i].append(0)
        elif moji =="#":
            space[i].append(-1)
space.append([-1 for i in range(w+2)])

sx,sy = 1,1
ex,ey = h,w

watch_space = [[sx,sy]]
decided_space = [[sx,sy]]

while(True):
    tmp = list()
    for [i,j] in watch_space:
        if [i-1,j] not in decided_space and space[i-1][j] == 0:
            space[i-1][j] = space[i][j]+ 1
            decided_space.append([i-1,j])
            tmp.append([i-1,j])
        if [i+1,j] not in decided_space and space[i+1][j] == 0:
            space[i+1][j] = space[i][j]+ 1
            decided_space.append([i+1,j])
            tmp.append([i+1,j])
        if [i,j+1] not in decided_space and space[i][j+1] == 0:
            space[i][j+1] = space[i][j]+ 1
            decided_space.append([i,j+1])
            tmp.append([i,j+1])
        if [i,j-1] not in decided_space and space[i][j-1] == 0:
            space[i][j-1] = space[i][j]+ 1
            decided_space.append([i,j-1])
            tmp.append([i,j-1])
    watch_space = tmp
    if [ex,ey] in decided_space:
        break

ans = (w*h)-(space[ex][ey]+1) - counter
print(ans)


Fixed submission:
h,w = map(int,input().split())
counter = 0
space = [[-1 for i in range(w+2)]]
for i in range(1,h+1):
    r = input()
    s = list("#"+r+"#")
    counter += r.count("#")
    space.append([])
    for j,moji in enumerate(s):
        if moji == ".":
            space[i].append(0)
        elif moji =="#":
            space[i].append(-1)
space.append([-1 for i in range(w+2)])

sx,sy = 1,1
ex,ey = h,w

watch_space = [[sx,sy]]
decided_space = [[sx,sy]]
flag = 0
while(True):
    tmp = list()
    for [i,j] in watch_space:
        if [i-1,j] not in decided_space and space[i-1][j] == 0:
            space[i-1][j] = space[i][j]+ 1
            decided_space.append([i-1,j])
            tmp.append([i-1,j])
        if [i+1,j] not in decided_space and space[i+1][j] == 0:
            space[i+1][j] = space[i][j]+ 1
            decided_space.append([i+1,j])
            tmp.append([i+1,j])
        if [i,j+1] not in decided_space and space[i][j+1] == 0:
            space[i][j+1] = space[i][j]+ 1
            decided_space.append([i,j+1])
            tmp.append([i,j+1])
        if [i,j-1] not in decided_space and space[i][j-1] == 0:
            space[i][j-1] = space[i][j]+ 1
            decided_space.append([i,j-1])
            tmp.append([i,j-1])
    watch_space = tmp
    if [ex,ey] in decided_space:
        break
    elif len(watch_space) < 1:
        flag = -1
        break
if flag == 0:
    ans = (w*h)-(space[ex][ey]+1) - counter
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

N,M = map(int,input().split())

graph = [[] for i in range(N)]

for i in range(M):
    L,R,D = map(int,input().split())
    graph[L-1].append([R-1,D])
    graph[R-1].append([L-1,-D])

#print(graph)
x = [None for i in range(N)]

def f():
    for i in range(N):
        if x[i] == None:
            x[i] = 0
            q = deque([i])
            while len(q):
                j = q.popleft()
                for k,d in graph[j]:
                    if x[k] == None:
                        q.append(k)
                        x[k] = x[j]+d
                    elif x[k] != x[j]+d:
                        return False
                        
    return True

if f():
    print("Yes")
else:
    print("No")

Fixed submission:
from collections import deque

N,M = map(int,input().split())

graph = [[] for i in range(N)]

for i in range(M):
    L,R,D = map(int,input().split())
    graph[L-1].append([R-1,D])
    graph[R-1].append([L-1,-D])

x = [None for i in range(N)]

def f():
    for i in range(N):
        if x[i] == None:
            x[i] = 0
            q = deque([i])
            while len(q):
                j = q.popleft()
                for k,d in graph[j]:
                    if x[k] == None:
                        q.append(k)
                        x[k] = x[j]+d
                    elif x[k] != x[j]+d:
                        return False
                        
    return True

if f():
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

N,M = map(int,input().split())

graph = [[] for i in range(N)]

for i in range(M):
    L,R,D = map(int,input().split())
    graph[L-1].append([R-1,D])
    graph[R-1].append([L-1,-D])

#print(graph)
x = [None for i in range(N)]

def f():
    for i in range(N):
        if x[i] == None:
            x[i] = 0
            q = deque([i])
            while len(q):
                j = q.popleft()
                for k,d in graph[j]:
                    if x[k] == None:
                        q.append(k)
                        x[k] = x[j]+d
                    elif x[k] != x[j]+d:
                        return False
                        
    return True

if f():
    print("Yes")
else:
    print("No")

Fixed submission:
from collections import deque

N,M = map(int,input().split())

graph = [[] for i in range(N)]

for i in range(M):
    L,R,D = map(int,input().split())
    graph[L-1].append([R-1,D])
    graph[R-1].append([L-1,-D])

x = [None for i in range(N)]

def f():
    for i in range(N):
        if x[i] == None:
            x[i] = 0
            q = deque([i])
            while len(q):
                j = q.popleft()
                for k,d in graph[j]:
                    if x[k] == None:
                        q.append(k)
                        x[k] = x[j]+d
                    elif x[k] != x[j]+d:
                        return False
                        
    return True

if f():
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
setting = input().rstrip().split(" ")
N = int(setting[0])
Y = int(setting[1])
otoshidama = [-1,-1,-1]

for x in range(N):
    for y in range(N):
        if 10000*x + 5000*y + 1000*(N-x-y) == Y :
            otoshidama = [x,y,N-x-y]
        else:
            pass

print(otoshidama[0]," ",otoshidama[1]," ",otoshidama[2])   

Fixed submission:
S = input()
S=S.replace("2017","2018")

print(S)

Buggy python submission (verdict: Runtime Error):
setting = input().rstrip().split(" ")
N = int(setting[0])
Y = int(setting[1])


for x in range(N):
    for y in range(N):
        if 10000*x + 5000*y + 1000*(N-x-y) == Y :
            otoshidama = [x,y,N-x-y]
        else:
            pass

print(otoshidama[0]," ",otoshidama[1]," ",otoshidama[2])   

Fixed submission:
S = input()
S=S.replace("2017","2018")

print(S)

Buggy python submission (verdict: Runtime Error):
S = raw_input()
S.replace("2017","2018")

print(S)


Fixed submission:
S = input()
S=S.replace("2017","2018")

print(S)

Buggy python submission (verdict: Runtime Error):
S = raw.input()
S = S.replace("2017","2018")

print(S)


Fixed submission:
S = input()
S=S.replace("2017","2018")

print(S)

Buggy python submission (verdict: Runtime Error):
S = raw.input()
S.replace("2017","2018")

print(S)

Fixed submission:
S = input()
S=S.replace("2017","2018")

print(S)
Buggy python submission (verdict: Runtime Error):
setting = input().rstrip().split(" ")
N = int(setting[0])
Y = int(setting[1])


for x in range(N):
    for y in range(N):
        if N-x-y >= 0:
            if 10000*x + 5000*y + 1000*(N-x-y) == Y :
                otoshidama = [x,y,N-x-y]
        else:
            pass

print(otoshidama[0]," ",otoshidama[1]," ",otoshidama[2])   

Fixed submission:
setting = input().rstrip().split(" ")
N = int(setting[0])
Y = int(setting[1])
A = -1
B = -1
C = -1

for x in range(N+1):
    for y in range(N+1):
        if N-x-y >= 0:
            if 10000*x + 5000*y + 1000*(N-x-y) == Y :
                A , B , C = x ,y,N-x-y
                break
    else:
            continue
    break
print(A," ",B," ",C)

Buggy python submission (verdict: Runtime Error):
setting = input().rstrip().split(" ")
N = int(setting[0])
Y = int(setting[1])


for x in range(N):
    for y in range(N):
        if 10000*x + 5000*y + 1000*(N-x-y) == Y :
            otoshidama = [x,y,N-x-y]
        else:
            pass

print(otoshidama[0]," ",otoshidama[1]," ",otoshidama[2])   

Fixed submission:
setting = input().rstrip().split(" ")
N = int(setting[0])
Y = int(setting[1])
A = -1
B = -1
C = -1

for x in range(N+1):
    for y in range(N+1):
        if N-x-y >= 0:
            if 10000*x + 5000*y + 1000*(N-x-y) == Y :
                A , B , C = x ,y,N-x-y
                break
    else:
            continue
    break
print(A," ",B," ",C)