Go: package main

import (
    "fmt"
    "math"
)

func main() {
    var e int
    for {
        fmt.Scan(&e)
        if e == 0 { break }

        var ans float64 = float64(e)
        for z := 0; z <= 101; z++ {
            for y := 0; y <= 1001; y++ {
                x := e - y*y - z*z*z
                if (0 <= x && x <= 100000) {
                  ans = math.Min(ans, float64(x+y+z));
                }
            }
        }
        fmt.Println(ans)
    }
}

C++: #include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 1000

int e;

int main(){
	cin.sync_with_stdio(false);
	while(1){
		cin>>e;
		if(e==0)break;
		int res=INF;
		for(int y=0;y*y<=e;y++){
			for(int z=0;z*z*z<=e-y*y;z++){
				minch(res,e-y*y-z*z*z+y+z);
			}
		}
		cout<<res<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(){

	int e;
	int y_max,z_max;
	int j,k;
	int answer;
	int x,y,z;
	while(1){
		

		answer = 10000000;

		scanf("%d",&e);
		if(e == 0){
			break;
		}

		y_max = 1000;
		z_max = 100;

		for(j=0; j<=y_max; j++){
			for(k=0; k<=z_max; k++){

				y = j;
				z = k;

				x = e - y*y - z*z*z;
				//
				if(x >= 0){
					//if(e == x + y*y + z*z*z){
						if(answer > x + y + z){
							answer = x + y + z;
						}
					//}
				}
			}
		}
		printf("%d\n",answer);
	}


}

C++: #include <bits/stdc++.h>
using namespace std;

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int e;
  while(cin >> e, e){
    int x, y, z;
    int ans = INT_MAX;
    for(z = 0; z <= pow(e, 1.0/3.0)+1; z++){
      y = sqrt(e-pow(z, 3));
      x = e - pow(z, 3) - pow(y,2);
      ans = min(ans, x+y+z);
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
	int e,m;
	while(cin >> e,e){
		m = 1000000;
		for(int z = 0;pow(z,3) <= e;z++){
			int y = sqrt(e - pow(z,3));
			int x = e - pow(y,2) - pow(z,3);
			m = min(m,x + y + z);
			//cout << x << ":" << y << ":" << z << " " << (x+y+z) << endl;
		}
		cout << m << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
  int ene;
  for (int i=0; cin >> ene && ene>0; i++){
    int min = 1000000;
    int z=0;
    while (z<=100) {
      int xy = ene - z^3;
      int y=0;
      while (y<xy) {
	int x = xy - y^2;
	if (x+y+z<min) min = x+y+z;
      }
    }
    cout << min << endl;
  }
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  int e;
  while(cin >> e, e){
    int num;
    int ans = 1e9;
    for(int i = 0; i < e; i++){
      for(int j = 0; j < e; j++){
        num = e - i * i * i - j * j;
        if(num < 0)break;
        ans = min(ans, num + i + j);
      }
    }
    cout << ans << endl;


  }
}

C++: #include <iostream>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;

int main(void){

  int e;

while(1){
    cin >> e;
    int ans = e;
    if(e == 0) break;
    for(int x=0; x <= 118; x++){
      for(int y=0; y <= 172; y++){
	for(int z=0;z <= 99; z++){
	  if(e == x + y*y + z*z*z){
	    ans = min(ans,x+y+z);
	    //cout << x << ' ' << y << ' ' << z << endl;
	  }
	}
      }
    }

    cout << ans << endl;

 }
  return 0;
}

C++: #include <bits/stdc++.h>
static const int INF = 1e9+7;
using namespace std;

int main(){
    int e;
    while(1){
        cin>>e;
        int ans = INF;
        if(e == 0) break;
        for(int y = 0; y<=1000; y++){
            for(int z= 0; z<=100; z++){
                int x = e-y*y-z*z*z;
                if(x >= 0){
                    ans = min((x+y+z),ans);
                }
           }
        }    
        cout<<ans<<endl;
    }

    return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
  while(1){
    int in, sum, min;
    cin >> in;
    min = in;
    if(in == 0) break;

    int pre;

    for(int z = 0; z*z*z <= in; z++){
      sum = in - z*z*z;
      for(int y = 0; y*y <= in-z*z*z; y++){
	sum = in - z*z*z - y*y;
	pre = z+y+sum;
	if(min > pre) min = pre;
      }
    }

    cout << min << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;

int main() {
  while(1) {
    int e;
    cin >> e;
    if(e == 0) break;
    int min = -1;
    for(int z = 0; z*z*z <= e; z++) {
      for(int y = 0; y*y <= e; y++) {
	int x = e - (y*y + z*z*z);
	if(x < 0) break;
	int m = x + y + z;
	if(min == -1 || m < min) min = m;
      }
    }
    cout << min << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int main() {
  int e, m;

  while(1) {
    cin >> e;
    if(e == 0) break;

    m = e;
    for(int z = 0; z * z * z <= e; ++z)	{
      for(int y = 0; y * y <= e - z * z * z; ++y) {
        int x =	e - y *	y - z *	z * z;
        m = min(m, x + y + z);
      }
    }

    cout << m << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h> 
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;
typedef pair<char, int> pci;
typedef long long ll;
typedef unsigned long long ull;
#define int long long
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define call(a) (a).cbegin(), (a).cend()
#define pb push_back
#define pf push_front
#define eb emplace_back
#define ef emplace_front
#define mp make_pair
#define mt make_tuple
#define fs first
#define se second
#define loop(i,a,b) for(int i=(a);i<ull(b);i++)
#define rloop(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define rep(i,n) for(int i=0;i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define riter(i,c) for(auto i=(c).rbegin(); i!=(c).rend(); ++i)
#define set(a,c) memset(a,c,sizeof a)
#define clr(a) memset(a,0,sizeof a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define in scanf
#define out printf
#define gcd(a,b) __gcd(a,b)
#define np(v) next_permutation(all(v))
#define pp(v) prev_permutation(all(v))
#define SORT(a) stable_sort(all(a))
#define RSORT(a) stable_sort(all(a),greater<int>())
#define MIN(a,b) (a>b?b:a)
#define MAX(a,b) (a>b?a:b)
#define INFILE() freopen("in0.txt","r",stdin)
#define OUTFILE() freopen("out0.txt","w",stdout)
const double eps = 1e-14;
const double pi  = 2*acos(0.0);
const double inf = INT_MAX/3;
int lcm(int a, int b) {return a*b/__gcd(a,b);}
bool is_leapyear(int y){return y%4==0&&(y%100!=0||y%400==0);}
int lis(int n,vi a) {
	int l[100000],length=1;l[0] = a[0];
	rep(i,n){
		if(l[length-1]<a[i])l[length++]=a[i];
		else *lower_bound(l,l+length, a[i])=a[i];
	}
	return length;
}
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dfs(int x, int y) {
    // (x, y) に対する処理をここに書く
    // 周辺4マスを調べる
    for(int r = 0; r < 4; r++) {
        int nx = x + dx[r];
        int ny = y + dy[r];
        dfs(nx, ny);
    }
}
signed main(){
    int x,y,z,ansx,ansy,ansz;
    x=y=z=0;
    int e;while(cin>>e&&e){
        while(pow(z,3)<e){
            z++;
        }e-=(int)pow(--z,3);
        while(pow(y,2)<e){
            y++;
        }e-=(int)pow(--y,2);
        x=e;
        cout << x+y+z <<endl;
    }
}