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 <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int pow(int a,int b){
  int ans = 1;
  REP(i,b) ans = ans * a;
  return ans;
}


int hoge(int e){

  int num;

  REP(a,e+1){
	REP(b,e+1){
	  REP(c,e+1){
		num = a + pow(b,2) + pow(c,3);
		//		cout << num << endl;
		if(num > e) continue;
		if(num == e) return (a + b + c);
		
	  }
	}
  }
  
	return -1;

}

int main(){

  int e;

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

	cout << hoge(e) <<endl;

  }
}

C++: //include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
    int result;
    int input;
    bool flag=true;
    while(cin >> input && input){
	for(int i=0; i<1000000 && flag; ++i){
	    for(int j=0; j<1000 && flag; ++j){
		for(int k=0; k<100 && flag; ++k){
		    if(i+j*j+k*k*k==input){
			flag = false;
			result = i + j + k;
		    }
		}
	    }
	}
	cout << result << endl;
	flag=true;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>

#define INF 999999999
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define MOD(x) (x%(mod))
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int>pi;

/*---------------------------------------------------*/

int main(){
  int n;
  while(cin>>n){
    if(n==0)break;
    int mini=INF;
    rep(y,sqrt(n)){
      rep(z,sqrt(n)){
	int x=n-pow(y,2)-pow(z,3);
	if(x<0)continue;
	//cout<<x<<" "<<y<<" "<<z<<endl;
	mini=min(mini,x+y+z);
      }
    }
    cout<<mini<<endl;
    
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int x,y,z;
int e;
int solve(){
	int minsum = 1000000;
	for (z=0;z<=e;z++)
	{
		for(y=0;y<=e;y++)
		{
			if(e-y*y-z*z*z>=0)
			minsum = min(minsum,e-y*y-z*z*z+y+z);	
		}
	}
	return minsum;
};
int main(){
	int A[100000];
    int k = 0;
	while( cin>>e && e>0 )
	{
		A[k]=solve();
        k++;
	}
	for(int l = 0;l < k; l++)
    {
        cout<<A[l]<<endl;
    }
	return 0;
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
  int x,y,z,e;
  while( cin >> e,e ){
    int ret = 999999999;
    for(int y = 0 ; y*y <= e ; y++ ){
      for(int z = 0 ; z*z*z <= e ; z++ ){
	if(e - (y*y + z*z*z) >= 0)x = e - (y*y + z*z*z);
	  ret = min(ret,x+y+z);
      }
    }
    cout << ret << endl;
  }
  return 0;
}

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


int main() {
	int e;
	while (cin >> e && e>0) {
		int y=0;
		int z=0;
		int sum=0,summin=e; // min: NOTICE how we initialize it

		while (y*y*y+z*z*z<e) { // third power of something
			while (y*y*y+z*z*z<e) {
				int x= e-y*y*y-z*z*z;	
				sum = x+y+z;
				if (sum < summin) summin = sum;
				++z;
			}
			++y;
		}
		cout << summin << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int pow(int a,int b){
  int ans = 1;
  REP(i,b) ans = ans * a;
  return ans;
}


int hoge(int e){

  int num;

  REP(a,e+1){
	REP(b,e+1){
	  REP(c,e+1){
		num = a + pow(b,2) + pow(c,3);
		//		cout << num << endl;
		if(num > e) break;
		if(num == e) return (a + b + c);
		
	  }
	}
  }
  
	return -1;

}

int main(){

  int e;

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

	cout << hoge(e) <<endl;

  }
}

C++: /*
 * 宇宙ヤシガニ（枝狩り問題）
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2012
 */
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#include<sstream>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; } //t=min
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } //t=max
using namespace std;

int main() {
	// x=1,000,000
	// y=1,000
	// z=100

	int min_m=INT_MAX,m=0,power=0;
	int E;
	int ww,xx,yy,zz;
	while(cin >> E && E) {
		min_m=INT_MAX,m=0,power=0;
		zz=E;
		rep(z,100) {
			yy = zz - z*z*z;
			if (yy >= 0) {
				rep(y,1000) {
					xx = yy - y*y;
					if (xx >= 0) {
						rep(x,1000000) {
							ww = xx - x;
							if (ww >= 0) {
								power = x + y*y + z*z*z;
								if (power == E) {
									m = x + y + z;		
									chmin(min_m,m);
								}
							}
							else { break; }
						}
					}
					else { break; }
				}
				
			}
			else {
				break;
			}
		}
		cout << min_m << endl;
		
	}

	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <queue>
#include <stack>
#include <map>
#include <set>

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) string((s).rbegin(), (s).rend())
#define MP make_pair
#define X first
#define Y second

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int sq[1010];
int cu[1010];

void init(){
	rep(i, 1010){
		sq[i] = i*i;
		cu[i] = sq[i]*i;
	}
}

int main(){
	init();

	while(1){
		int e;
		cin >> e;
		if(!e)break;

		int xyz = 1000000;

		rep(z, 101){
			rep(y, 1001){
				if(cu[z]+sq[y] > e) continue;
				xyz = min(xyz, z+y+(e-cu[z]-sq[y]));
			}
		}

		cout << xyz << endl;
	}

	return 0;
}