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<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int> PI;
#define MAX 1000009
int main(){
    int e;
    while(cin>>e,e){
        vector<PI> v3;
        for(int i =0;i<=100;i++){
            PI temp;
            temp.first=pow(i,3);
            if(temp.first>e)break;
            temp.second=i;
            v3.push_back(temp);
        }
        vector<PI> v2;
        for(int i=0; i<=10e4;i++){
            PI temp;
            temp.first=pow(i,2); temp.second=i;
            if(temp.first>e)break;
            v2.push_back(temp);
        }
        sort(all(v3));
        sort(all(v2));
        PI min; min.first=INF; min.second=INF;
        for(int i=(int)v3.size()-1; i>=0;i--){
            if(v3[i].first==e){cout<<v2[i].second<<endl; goto E;;}
            else for(int j=(int)v2.size()-1; j>=0;j--){
                if(v2[j].first==e){cout<<v2[j].second<<endl;goto E;}
                if(v3[i].first+v2[j].first<e){
                    if(min.first>e-(v3[i].first+v2[j].first)){
                        min.second=v3[i].second+v2[j].second;
                        min.first=e-(v3[i].first+v2[j].first);
                    }
                }
            }
        }
        cout<<min.second+min.first<<endl;
    E: ;
    }
    return 0;
}

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 y=0; y <= sqrt(e); y++){
	for(int z=0;z <= cbrt(e); z++){
	int x = e - y*y - z * z * z;
	  if(e == x + y*y + z*z*z && x >= 0){
	    ans = min(ans,x+y+z);
	    //cout << x << ' ' << y << ' ' << z << endl;
	  }
	}
      }

    cout << ans << endl;

 }
  return 0;
}

C++: // Space Coconut Crab
#include <iostream>
using namespace std;
int count = 0; // ?¨???¬??¨ global ?????°
int solve(int E) {
  // ?????´????±???????
  int ans = E; // ?????§??? 
  for (int x=0; x<=E; ++x)
    for (int y=0; y*y<=E; ++y)
      for (int z=0; z*z*z<=E; ++z) {
        ++count;
        if (x+y*y+z*z*z == E)
          if (x+y+z < ans ) // x+y+z??????????°??????????ans?????´??°
            ans = x+y+z;
      }
  return ans;
}
int main() {
  int E;
  while (cin >> E && E>0) {
    cout << solve(E) << endl; 
  }
}

C++: #include <bits/stdc++.h>

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;



int main(void) {
	
	while (1) {
		int e;
		bool flag = true;
		int mini = INF;

		cin >> e;
		if (e == 0) {
			break;
		}
		RFOR(z, cbrt(e), 0) {
			if (pow(z, 3) > e) {
				continue;
			}
			RFOR(y, sqrt(e-pow(z,3)), 0) {
				if (pow(y, 2) < e - pow(z, 3) - pow(y, 2)) {
					if (mini > z + y + e - pow(z, 3) - pow(y, 2)) {
						mini = z + y + e - pow(z, 3) - pow(y, 2);
					}
					break;
				}
				if (pow(y, 2) > e - pow(z, 3)) {
					continue;
				}
				if (pow(y, 2) == e - pow(z, 3)) {
					mini = z + y;
					flag = false;
					break;
				}
				else {
					if (mini > z + y + e - pow(z, 3) - pow(y, 2)) {
						mini = z + y + e - pow(z, 3) - pow(y, 2);
					}
				}
			}
			if (flag == false) {
				break;
			}
		}
		cout << mini << endl;
	}

}

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

int main(){
int e;
while(cin >> e,e){
int ans = 1000000000;
for(int z=1;z*z*z<e;z++)
for(int y=1;y*y+z*z*z<e;y++)
ans = min(ans,(e-y*y*-z*z*z) + y + z);
cout << ans << endl;
}
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int inf = 1000000000;

int main(void) {

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

  }

  return 0;
}

// EOF

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 main(){
	const int intmax  = 1000010;
	ll int e;
	while(cin >> e,e){
		ll int ans = 9999999;
		FOR(y,0,sqrt(e)+1){
			FOR(z,0,cbrt(e)+1){
				if(e-y*y-z*z*z>=0) ans = min(ans,y+z+(e-y*y-z*z*z));
			}
		}
		cout << ans << endl;
	}
	
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
int e;
long long minm;
vector<vector<vector<int> > >nums(343,vector<vector<int> >(174,vector<int>(101)));
for(int i=0;i<343;i++){
	for(int j=0;j<174;j++){
		for(int k=0;k<101;k++){
			nums[i][j][k]=(i+j*j+k*k*k);
		}
	}
}
while(true){
cin>>e;
if(e==0)break;
minm=LLONG_MAX;
for(int i=0;i<101;i++){
	for(int j=0;j<101;j++){
		for(int k=0;k<101;k++){
			if(e==nums[i][j][k])minm=min(minm,(long long)i+j+k);
		}
	}
}
cout<<minm<<endl;
}
return 0;
}