Harryxun/stf_run huggingface dataset:
while True:
    e = int(input())
    if e == 0:
        break
    
    m = e + 1
    y = 0
    while y <= e:
        y2 = y ** 2
        if y2 > e:
            break
        z = 0
        while z <= e:
            z3 = z ** 3
            if z3 + y2 > e:
                break
            x = e - y2 - z3
            m = min(m, x + y + z)
            z += 1
        y += 1
    print(m)


### FIXED CODE ###

import math

while True:
    e = int(input())
    if e == 0:
        break
    
    m = e + 1
    z = 0
    while z <= e:
        z3 = z ** 3
        if z3 > e:
            break
        y = int(math.sqrt(e - z3))
        x = e - y ** 2 - z3
        m = min(m, x + y + z)
        z += 1
    print(m)
n = str(input())
for i in n:
    if i == 9:
        n[i] = 1
    else:
        n[i] = 9
print(int(n))


### FIXED CODE ###

n = str(input())
ans = ""
for i in n:
    if i == "9":
        ans += "1"
    else:
        ans += "9"
print(ans)
a, b = input()

if a<=9 and b<=9 :
  print(a*b)
  else:
    print(-1)

### FIXED CODE ###

a,b=map(int, input().split())
if a<=9 and b<=9:
  print(a*b)
else:
  print(-1)
S=input().split()

plus=0

for i in S:
    if S[i]=="+":
        plus+=1
    else :
        plus-=1

print(plus)

### FIXED CODE ###

s=input()

print (s.count("+") - s.count("-"))
from collections import Counter
import sys


def _ia(): return map(int, sys.stdin.readline().strip().split())


class UnionFind:
    def __init__(self, n: int) -> None:
        self._par = [i for i in range(n)]
        self._rank = [0] * n

    def root(self, n: int) -> int:
        p = self._par[n]
        if p == n:
            return p
        else:
            # compress
            self._par[n] = self.root(p)
            return self._par[n]

    def same(self, n: int, m: int) -> bool:
        return self.root(n) == self.root(m)

    def unite(self, n: int, m: int) -> None:
        pn = self.root(n)
        pm = self.root(m)
        if pn == pm:
            return
        self._par[pm] = pn


def main():
    n, m = _ia()
    uf = UnionFind(n)
    for _ in range(m):
        a, b = map(lambda x: x-1, _ia())
        uf.unite(a, b)
    c = Counter([uf.root(i) for i in range(n)])
    return c.most_common(1)[0][1]


if __name__ == "__main__":
    print(main())


### FIXED CODE ###

from collections import Counter
import sys

sys.setrecursionlimit(20000)


def _ia(): return map(int, sys.stdin.readline().strip().split())


class UnionFind:
    def __init__(self, n):
        self._par = [-1]*(n+1)
        self._rnk = [0]*(n+1)

    def root(self, x):
        if self._par[x] < 0:
            return x
        else:
            self._par[x] = self.root(self._par[x])
            return self._par[x]

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return
        elif self._rnk[x] > self._rnk[y]:
            self._par[x] += self._par[y]
            self._par[y] = x
        else:
            self._par[y] += self._par[x]
            self._par[x] = y
            if self._rnk[x] == self._rnk[y]:
                self._rnk[y] += 1

    def same(self, x, y):
        return self.root(x) == self.root(y)


def main():
    n, m = _ia()
    uf = UnionFind(n)
    for _ in range(m):
        a, b = map(lambda x: x-1, _ia())
        uf.unite(a, b)
    c = Counter([uf.root(i) for i in range(n)])
    return max(c.values())


if __name__ == "__main__":
    print(main())
a,b=map(int, input().split())

if a>b:
	print(‘a > b’)
elif a<b:
	print(‘a < b’)
else:
	print(‘a == b’)


### FIXED CODE ###

a,b=map(int, input().split())

if a>b:
	print("a > b")
elif a<b:
	print("a < b")
else:
	print("a == b")
A, B, C = map(int, input().split())
cnt = 0
if A % 2 == B % 2 and B % 2 != C % 2:
  A += 1
  B += 1
  cnt += 1
elif A % 2 == C % 2  and C % 2 != B % 2 :
  A += 1
  B += 1
  cnt += 1
elif C % 2 == B % 2 and A % 2 != C %2 :
  C += 1
  B += 1
  cnt += 1
else :
  pass
L = [A, B, C]
L= soreted(L)
cnt += (L[2] - L [1])//2
cnt += (L[2] - L[0])//2
print(cnt)


### FIXED CODE ###

A, B, C = map(int, input().split())
cnt = 0
if A % 2 == B % 2 and B % 2 != C % 2:
  A += 1
  B += 1
  cnt += 1
elif A % 2 == C % 2  and C % 2 != B % 2 :
  A += 1
  C += 1
  cnt += 1
elif C % 2 == B % 2 and A % 2 != C %2 :
  C += 1
  B += 1
  cnt += 1
else :
  pass
L = [A, B, C]
L= sorted(L)
cnt += (L[2] - L [1])//2
cnt += (L[2] - L[0])//2
print(cnt)
import sys
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]

for i in range(10**n):
    s = str(i)
    c = 0
    for i in range(m):
        if n >= 2:
            if sc[i] == [1,0]:
                print(-1)
                sys.exit()
            
        if s[sc[i][0]-1] == str(sc[i][1]):
            c += 1
    
    if c == m:
        print(s)
        sys.exit()

print(-1)

### FIXED CODE ###

import sys
n,m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]

for i in range(10**n):
    s = str(i)
    if len(s) != n:
        continue
    c = 0
    for i in range(m):
        if n >= 2:
            if sc[i] == [1,0]:
                print(-1)
                sys.exit()
            
        if s[sc[i][0]-1] == str(sc[i][1]):
            c += 1
    
    if c == m:
        print(s)
        sys.exit()

print(-1)
A, B, K = map(int, input().split())

lst = [1]
for i in range(2,max(A,B)):
    if A % i == 0 and B % i == 0:
        lst.append(i)

print(lst[-K])


### FIXED CODE ###

A, B, K = map(int, input().split())

lst = []
for i in range(1,min(A,B)+1):
    if A % i == 0 and B % i == 0:
        lst.append(i)

print(lst[-K])
d = int(input())
print("Christmas" if d=25 else "Christmas Eve" if d =24 else "Christmas Eve Eve" if d=23 else "Christmas Eve Eve Eve")

### FIXED CODE ###

d = int(input())
print("Christmas" if d==25 else "Christmas Eve" if d==24 else "Christmas Eve Eve" if d==23 else "Christmas Eve Eve Eve")
N = int(input())
A = list(map(int,input(). split ()))
if 0 in A:
	print(0)
	return
prod = 1
for a in A:
	prod *= a
	if prod > 1000000000000000000:
		print(-1)
		return
print(prod)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 1

for i in range(n):
  ans *= a[i]
  if ans > 10 ** 18:
    ans = -1
    break

print(ans)
n=int(input())
d=list(map(int,input().split()))
c=[0]*n
ans=0
for i in range(0,n):
  c[d[i]]+=1

if d[0]!=0 or c[0]!=1:
  print(0)
  
else:
  for j in range(2,n-1):
    if c[j+1]!=0 and c[j]==0:
      ans=0
      break      
    elif c[j]==0 and c[j+1]==0:
      ans+=0
    else:
      ans*=c[j]**c[j-1]
      
  if c[n-2]==0　and c[n-1]!=0:
      ans=0
  elif c[n-2]==0 and c[n-1]==0:
    ans+=0
  elif:c[n-1]==0:
    ans+=0
  else:
    ans*=c[n-1]**c[n-2]
      
  print(int(ans%998244353)) 
    
    
  



### FIXED CODE ###

n=int(input())
d=list(map(int,input().split()))
x=max(d)
li=[0]*(x+1)
for i in range(n):
    li[d[i]]+=1
if d[0]!=0 or li[0]!=1:
    print(0) 
else:
    ans=1
    for i in range(2,len(li)):
        ans*=pow(li[i-1],li[i],998244353)   
    print(ans%998244353)
H, W = map(int, input().split())
ans = 0
S = []
for _ in range(H):
    s = list(input())
    ans += s.count('.')
    S.append(s)

inf = float('inf')
G = [[inf] * H * W for _ in range(H * W)]

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]

for h in range(H):
    for w in range(W):
        for x, y in zip(dx, dy):
            nx = w + x
            ny = h + y
            if 0 <= nx < W and 0 <= ny < H and S[ny][nx] != '#':
                G[W * h + w][W * ny + nx] = 1

from scipy.sparse.csgraph import dijkstra

d = dijkstra(G, indices=0)

print(int(ans - d[-1] - 1))


### FIXED CODE ###

H, W = map(int, input().split())
ans = 0
S = []
for _ in range(H):
    s = list(input())
    ans += s.count('.')
    S.append(s)

inf = float('inf')
G = [[inf] * H * W for _ in range(H * W)]

dx = [0, 1, 0, -1]
dy = [1, 0, -1, 0]

for h in range(H):
    for w in range(W):
        for x, y in zip(dx, dy):
            nx = w + x
            ny = h + y
            if 0 <= nx < W and 0 <= ny < H and S[ny][nx] != '#':
                G[W * h + w][W * ny + nx] = 1

from scipy.sparse.csgraph import dijkstra

d = dijkstra(G, indices=0)
if d[-1] == inf:
    print(-1)
else:
    print(int(ans - d[-1] - 1))
# coding: utf-8

# In[3]:


import numpy as np


# In[19]:


n,k = map(int, input().split())
h = []
for _ in range(n):
    h.append(int(input()))


# In[20]:


h = np.array(h)


# In[21]:


sorted_h = np.sort(h)


# In[22]:


print(min(sorted_h[k-1:] - sorted_h[:k]))



### FIXED CODE ###


# coding: utf-8

# In[3]:


import numpy as np


# In[38]:


n,k = map(int, input().split())
h = []
for _ in range(n):
    h.append(int(input()))


# In[43]:


h = np.array(h)
sorted_h = np.sort(h)
print(min(sorted_h[k-1:] - sorted_h[:-k+1]))
while True:
    d, w = map(int, input().split())
    if d==w==0:
        break
    E=[list(map(int, input().split())) for i in range(d)]
    a=0
    for x2 in range(d):
        for y2 in range(w):
            for x1 in range(x2-1):
                for y1 in range(y2-1):
                    co=10**18
                    for x in range(x1, x2+1):
                        co=min(co, E[x][y1], E[x][y2])
                    for y in range(y1, y2+1):
                        co=min(co, E[x1][y], E[x2][y])
                    ci=cnt=0
                    for x in range(x1+1, x2):
                        for y in range(y1+1, y2):
                            ci=max(ci, E[x][y])
                            cnt+=E[x][y]
                    if ci < co:
                        a=max(ans, (x2-x1-1)*(y2-y1-1)*co - cnt)
    print(a)



### FIXED CODE ###

while True:
    d, w = map(int, input().split())
    if d == 0:
        break
    area = []
    for _ in range(d):
        area.append(list(map(int, input().split())))
    a = 0
    for dp in range(1, d - 1):
        for wp in range(1, w - 1):
            for i in range(1, d - dp):
                for j in range(1, w - wp):
                    mawari = min(area[i - 1][j - 1:j + wp + 1] + area[i + dp][j - 1:j + wp + 1])
                    naka = 0
                    for ii in range(dp):
                        mawari = min(mawari, area[i + ii][j - 1], area[i + ii][j + wp])
                        naka = max([naka] + area[i + ii][j:j + wp])
                    if mawari > naka:
                        vn = 0
                        for ii in range(dp):
                            for jj in range(wp):
                                vn += mawari - area[i + ii][j + jj]
                        a = max(vn, a)
    print(a)
n = int(input())
x = []
u = []
sum = 0.0
for i in range(n):
    tmp1, tmp2 = input().split()
    x.append(int(tmp1))
    u.append(tmp2)
    if u[i] == "JPY":
        sum += x[i]
    else:
        sum += int(x[i] * 380000)

print(sum)

### FIXED CODE ###

n = int(input())
x = []
u = []
sum = 0.0
for i in range(n):
    tmp1, tmp2 = input().split()
    x.append(float(tmp1))
    u.append(tmp2)
    if u[i] == "JPY":
        sum += x[i]
    else:
        sum += x[i] * 380000

print(sum)
a , b , t = map(int(), input().split())
x = 0
y = 0
x = t // a
y = x * b
print(y)

### FIXED CODE ###

a,b,t = map(int,input().split())
x = t // a
y = x * b
print(y)
N, X, M = map(int, input().split())

ans = 0
roop_init = 0
roop_sum = 0
roop_len = 0
x = X
ans += x
flug = False    # 周期を数えるフラグ
for i in range(2, N+1):
    old_x = x
    x = old_x**2 % M
    if x == 0:
        break
    if old_x**2 >= M and not flug:
        # print(old_x, x)
        flug = True
        roop_init = x
        roop_sum = x
        roop_len = 1
    elif x == roop_init:
        # print(i)
        ans += (N - (i-1)) // roop_len * roop_sum
        for j in range((N - (i-1)) % roop_len):
            if j != 0:
                old_x = x
                x = old_x**2 % M
            ans += x
        print(ans)
        break
    elif flug:
        roop_len += 1
        roop_sum += x
    ans += x
else:
    print(ans)
print(i, roop_init, roop_sum, roop_len)



### FIXED CODE ###

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

id_ = [-1] * M
a = []
len_ = 0
ans = 0
x = X
while id_[x] == -1:
    id_[x] = len_
    len_ += 1
    ans += x
    a.append(x)
    x = x**2 % M

c = len_ - id_[x]
s = 0
for i in range(id_[x], len_):
    s += a[i]

if len_ >= N:
    ans = 0
    for i in range(N):
        ans += a[i]
else:
    n = N
    n -= len_
    ans += s * (n // c)
    n %= c
    for i in range(n):
        ans += a[id_[x]+i]
print(ans)
k = int(input())
a,b = map(int,input().split().split(" "))
can = False
for i in range(a,b+1):
  if k % i == 0:
    can = True
if can:
  print("OK")
else:
  print("NG")

### FIXED CODE ###

k = int(input())
a,b = map(int,input().split(" "))
can = False
for i in range(a,b+1):
  if i % k == 0:
    can = True
if can:
  print("OK")
else:
  print("NG")
X,Y=map(int,input().split())
a=(4*X-Y)//2
if a.is_integer() and a>=0 and a<=100:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

X,Y=map(int,input().split())
a=(4*X-Y)/2
if X<=Y and a.is_integer() and a>=0 and a<=50:
  print("Yes")
else:
  print("No")
from collections import deque
def LI():
  return list(map(int,input().split()))

N,M,K = map(int,input().split())
A = deque(LI())
B = deque(LI())
res = 0

while K > 0:
  if len(A) == 0:
    if K >= B[0]:
      b = B.popleft()
      K -= b
    else:
      break
  elif len(B) == 0:
    if K>=A[0]:
      a = A.popleft()
      K -= a
    else:
      break
  else:
    if A[0] > B[0]:
      b = B.popleft()
      K -= b
    elif A[0] < B[0]:
      a = A.popleft()
      K -= a
    else:
      if A[1] > B[1]:
        b = B.popleft()
        K -= b
      else:
        a = A.popleft()
        K -= a

  if K >= 0:
    res += 1
  else:
    break


print(res)


### FIXED CODE ###

import bisect
def LI():
  return list(map(int,input().split()))

N,M,K = map(int,input().split())
A = LI()
B = LI()

cumA = [0]
for a in A:
  cumA.append(cumA[-1]+a)

cumB = [0]
for b in B:
  cumB.append(cumB[-1]+b)

res = 0
for i in range(N+1):
  cuma = cumA[i]
  if cuma > K: continue
  rem = K-cuma
  deskb = bisect.bisect_right(cumB, rem)-1

  res = max(res, i+deskb)

print(res)
import sys

N, M = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
A.sort()
A.reverse()

sys.setrecursionlimit(10000)

num = [0,2,5,5,4,5,6,3,7,6]

A_num = [(num[a], -a) for a in A]
A_num.sort()

min_A = -A_num[0][1]
min_num = A_num[0][0]
keta_max = N//min_num

def solve(d, amari):
    if d == 0 and amari > 0:
        return None
    if amari < 0:
        return None
    elif amari == 0:
        if d == 0:
            return ""
        else:
            return None
    if amari < d*min_num:
        return None
    elif amari == d*min_num:
        return str(min_A) * d
    elif amari < d*(min_num+1):
        new_d = amari - d*min_num
        temp1 = str(min_A) * (d-new_d) + solve(new_d, amari-(d-new_d)*min_num)
        temp2 = solve(new_d, amari-(d-new_d)*min_num) + str(min_A) * (d-new_d)
        if temp1 and temp2:
            if int(temp1) >= int(temp2):
                return temp1
            else:
                return temp2
        else:
            return None
    for a in A:
        temp = solve(d-1, amari-num[a])
        if temp != None:
            return str(a) + temp
    return None
    

for keta in range(keta_max, 0, -1):
    ans = solve(keta, N)
    if ans:
        break
print(ans)

### FIXED CODE ###

import sys

N, M = (int(i) for i in input().split())
A = [int(i) for i in input().split()]
A.sort()
A.reverse()

num = [0,2,5,5,4,5,6,3,7,6]

A_num = [(num[a], -a) for a in A]
A_num.sort()

min_A = -A_num[0][1]
min_num = A_num[0][0]
keta_max = N//min_num

DP = [-1] * (N+1)
DP[0] = 0

for i in range(N+1):
    for j in range(M):
        n = num[A[j]]
        if i - n >= 0 and DP[i-n] != -1:
            DP[i] = max(DP[i], DP[i-n] * 10 + A[j])

print(DP[N])
H,W=map(int, input().split())
s=[list(input()) for _ in range(H)]
d=[[9999999999999 for _ in range(W)] for _ in range(H)]
def bfs(h, w, c):
	if d[h][w] <= c:
		return
	d[h][w] = c
	for dh,dw in [(0, -1), (-1, 0), (0, 1), (1, 0)]:
		if h+dh >= 0 and w+dw >= 0 and h+dh < H and w+dw < W and s[h+dh][w+dw] == ".":
			bfs(h+dh, w+dw, c+1)
bfs(0, 0, 1)
print(H*W-d[H-1][W-1]-sum(map(lambda x: x.count("#"), s)))


### FIXED CODE ###

INF=10*10
H,W=map(int, input().split())
s=[list(input()) for _ in range(H)]
wall=sum(map(lambda x: x.count("#"), s))
d=[[INF for _ in range(W)] for _ in range(H)]
def bfs(h, w, c):
	if d[h][w] <= c:
		return
	d[h][w] = c
	for dh,dw in [(0, -1), (-1, 0), (0, 1), (1, 0)]:
		if h+dh >= 0 and w+dw >= 0 and h+dh < H and w+dw < W and s[h+dh][w+dw] == ".":
			bfs(h+dh, w+dw, c+1)
bfs(0, 0, 1)
print(-1 if d[H-1][W-1] == INF else H*W - d[H-1][W-1] - wall)
import sys
s = sys.stdin.readline()
print eval(s)

### FIXED CODE ###

import sys
s = sys.stdin.readline()
print(eval(s))
n,m=map(int,input().split())
L=[10]*n
for i in range(m):
	s,c=map(int,input().split())
	if L[s-1]==10 or L[s-1]==c:
		L[s-1]=c
	else:
		print('-1')
		exit()
if n==1:
	if L[0]==10:
		print(0)
		exit()
	else:
		print(L[0])
		exit()
else:
	if L[0]==10:
		L[0]=1
	elif L[0]==0:
		print('-1')
		exit()
	else:
		for i in range(1,n):
			if L[i]==10:
				L[i]=0
	print(''.join(map(str,L)))

### FIXED CODE ###

n=int(input())
print((n+2-1)//2)
def main():
    n, m = map(int, input().split())
    num = [set() for _ in range(n)]
    ans = ""
    for _ in range(m):
        s, v = input().split()
        num[int(s)-1].add(v)
    if n > 1 and list(num[0])[0] == "0":
        print(-1)
        return
    for i in num[:-1]:
        if len(i) == 0:
            ans += "0"
        elif len(i) == 1:
            ans += list(i)[0]
        else:
            print(-1)
            return
    if len(num[-1]) > 1:
        print(-1)
        return
    if len(num[-1]) == 1:
        ans += list(num[-1])[0]
    else:
        if m == 1:
            ans += "0"
        else:
            ans += "1"
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    ans = [None]*n
    for _ in range(m):
        s, c = map(int, input().split())
        try:
            if ans[s-1] is None:
                if c == 0 and s != n:
                    print("-1")
                    return
                ans[s-1] = c
            elif ans[s-1] != c:
                print("-1")
                return
        except:
            print("-1")
            return
    ans_str = ""
    p = ans.pop(0)
    if p is None:
        if n == 1:
            ans_str += "0"
        else:
            ans_str += "1"
    else:
        ans_str += str(p)
    if ans:
        for a in ans:
            ans_str += str(a) if a else "0"
    print(ans_str)


if __name__ == "__main__":
    main()
import string
import sys


def check_exists(word_set, rotate_dict, search):
    for word in word_set:
        rotated_word = ''.join(rotate_dict[s] for s in word)
        if rotated_word == search:
            return True
    return False


for line in sys.stdin:
    s0 = line.strip()
    alphabets = string.ascii_lowercase
    frequency = [t[1] for t in sorted([(s0.count(s), ord(s)) for s in alphabets], reverse=True)]
    freq_chr_offset = (4, 0, 19, 8, 14)
    ss = s0.strip('.').split()
    sl3, sl4 = set(s for s in ss if len(s) == 3), set(s for s in ss if len(s) == 4)

    i, rotate_dict = 0, None
    for order in frequency:
        for offset in freq_chr_offset:
            i = 97 + offset - order
            rotate_dict = {a: b for a, b in zip(alphabets, alphabets[i:] + alphabets[:i])}
            if (check_exists(sl3, rotate_dict, 'the')
                    + check_exists(sl4, rotate_dict, 'this')
                    + check_exists(sl4, rotate_dict, 'that')) > 0:
                break
        else:
            continue
        break

    print(''.join(rotate_dict[s] if s.isalpha() else s for s in s0))

### FIXED CODE ###

import string
import sys


def check_exists(word_set, rotate_dict, search):
    for word in word_set:
        rotated_word = ''.join(rotate_dict[s] for s in word)
        if rotated_word == search:
            return True
    return False


for line in sys.stdin:
    alphabets = string.ascii_lowercase
    frequency = [t[1] for t in sorted([(line.count(s), ord(s)) for s in alphabets], reverse=True)]
    freq_chr_offset = (4, 0, 19, 8, 14)
    ss = list(map(lambda word: word.strip('.\n'), line.split()))
    sl3, sl4 = set(s for s in ss if len(s) == 3), set(s for s in ss if len(s) == 4)

    i, rotate_dict = 0, None
    for order in frequency:
        for offset in freq_chr_offset:
            i = 97 + offset - order
            rotate_dict = {a: b for a, b in zip(alphabets, alphabets[i:] + alphabets[:i])}
            if (check_exists(sl3, rotate_dict, 'the')
                    + check_exists(sl4, rotate_dict, 'this')
                    + check_exists(sl4, rotate_dict, 'that')) > 0:
                break
        else:
            continue
        break

    print(''.join(rotate_dict[s] if s.isalpha() else s for s in line), end='')
n,m,k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

suma = [0] * n
sumb = [0] * m
suma[0] = a[0]
sumb[0] = b[0]

for i in range(1,n):
    suma[i] = suma[i-1]+a[i]
for j in range(1,m):
    sumb[j] = suma[j-1]+b[j]

    
ans, cur= 0, m-1
for i in range(n):
    target = k - suma[i]
    if target <= 0:
        break
    for j in range(cur,-1,-1):
        if sumb[j] <= target:
            ans = max(ans, i+j+2)
            cur = j
            break
print(ans)

### FIXED CODE ###

n,m,k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

suma = [0] * (n)
sumb = [0] * (m)
suma[0] = a[0]
sumb[0] = b[0]

for i in range(1,n):
    suma[i] = suma[i-1]+a[i]
for j in range(1,m):
    sumb[j] = sumb[j-1]+b[j]
    
suma.insert(0,0)
sumb.insert(0,0)

ans, cur = 0, m
for i in range(n+1):
  target = k - suma[i]
  if target < 0:
      break
  while sumb[cur] > target:
      cur -= 1
  ans = max(ans, i+cur)
print(ans)
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if B+W*T=<A+V*T or B<A:
    print("NO")
else:
    print("YES")

### FIXED CODE ###

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if abs(B-A)<=(V-W)*T:
  print("YES")
else:
  print("NO")
n = int(input())

if n < 4: # 最小以下
  print("No")

if n % 4 == 0 or n % 7 == 0:  # 片方でわる
  print("Yes")

four_max = n // 4

m = 1
ans = False
while m < four_max + 1:
  if (n - (4*m)) % 7 == 0:
    ans = True
    break
  m = m+1

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

### FIXED CODE ###

n, k = map(int, input().split())
if n % k != 0:
  print(1)
else:
  print(0)
ProNum = int(input())
time = input()
time = time.split()
TotalTime = 0

for t in time:
  TotalTime += int(t)
                  
DrinkNum = int(input())

for d in range(DrinkNum):
  line = input()
  line = line.split()
  diff = int(line[1]) - int(time[int(line[0])])
  print(TotalTime+diff)


### FIXED CODE ###

ProNum = int(input())
time = input()
time = (time.split())
TotalTime = 0

for t in time:
  TotalTime += int(t)
                  
DrinkNum = int(input())

for d in range(DrinkNum):
  line = input()
  line = line.split()
  diff = int(line[1]) - int(time[int(line[0])-1])
  print(TotalTime+diff)
def solve(n, y):
    for man in range(0, n + 1):
        for gosen in range(0, n - man + 1):
            sen = n - man - gosen
            if 10000*man + gosen*5000 + sen*1000 == y and man + gosen + sen == n:
                print(man, gosen, sen)
                return 0

    print("-1 -1 -1")
    return 0            

#main
n = int(input())
y = int(input())
solve()




### FIXED CODE ###

def solve(n, y):
    for man in range(n + 1):
        for gosen in range(n - man + 1):
            sen = n - man - gosen
            if 10000*man + gosen*5000 + sen*1000 == y and man + gosen + sen == n:
                print('{} {} {}'.format(man, gosen, sen))
                return
    print("-1 -1 -1")
    return            

#main
n, y = map(int, raw_input().split())
solve(n, y)