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>
#define ll long long
using namespace std;

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

C++: #include <iostream>

using namespace std;

int func(int y,int z,int e){
	return y+z+e-y*y-z*z*z;
}

int main(){

	int e;

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

		int min=10000000;

		for(int y=0;y*y<=e;y++){
			for(int z=0;(z*z*z+y*y)<=e;z++){
				int ans = func(y,z,e);
				
			//	cout<<"y="<<y<<"z="<<z<<endl;
				if(ans<=0)break;

				if(min>=ans){
					min=ans;
				}

			}
		}

		cout<<min<<endl;

	}

	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int x,y,z;
int e;
int minnum;

int solve(){
	z=  (int)(pow (e,1/3));
	y = (int)(sqrt(e - pow(z, 3)));
	x = (int)(e - pow(z, 3)-pow(y, 2)); 
	minnum = x+y+z;
	return minnum;
};
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 <bits/stdc++.h>
#include <cmath>

using namespace std;

int main() {

    int e, m;

    while(cin >> e, e) {

        m = e;

        for(int x = 0; x <= e; ++x) {
            for(int y = 0; y <= pow(e - x, 1.0 / 1.9999999999); ++y) {
                for(int z = 0; z <= pow(e - x - y * y, 1.0 / 2.9999999999); ++z) {
                    if(x + y * y + z * z * z == e) {
                        m = min(m, x + y + z);
                    }
                }
            }
        }

        cout << m << endl;

    }

}

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

using namespace std;

int count = 0; // ?¨???¬??¨ global ?????°
int solve(int E) {
	// ?????´????±???????
	int ans = numeric_limits<int>::max(); // ?????§???
	for (int x=0; x<=E; ++x){
		for (int y=0; y*y<=E; ++y){
			int z = (int)round(pow(E-x-y*y,1.0/3));
			if (x+y*y+z*z*z == E)
				ans = min(ans, x+y+z);
		}
	}
	return ans;
}
int main() {
	int E;
	while (cin >> E && E>0) {
		cout << solve(E) << endl;
	}
}

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

int isqrt(int x) {
  double d = sqrt(x);
  int i = (int)(d+0.5);
  if(i*i>x) return i-1;
  else return i;
}

int main() {
  for(int tci = 0; ; tci++) {
    int e; scanf("%d", &e);
    if(e==0) break;
    int mv = e;
    for(int z = 0; z*z*z <= e; z++) {
      int y = isqrt(e-z*z*z);
      int x = e-z*z*z-y*y;
      mv = min(mv,x+y+z);
    }
    printf("%d\n", mv);
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int calcOver(int, int);
int calcM(int, int ,int);

int main() {
  while(true) {
    int e;
    cin >> e;
    if(e == 0) break;
    int y = 0;
    int z = 0;
    int maxover = 0;
    int limity = pow(e, 1.0 / 2.0) + 1;
    int limitz = pow(e, 1.0 / 3.0) + 1;
    int maxy = limity;
    int maxz = limitz;
    int minm = e;
    bool flag = false;
    //cout << limity << ":" << limitz << endl;
    for(y = limity; y >= 0; --y) {
      for(int z = limitz; z >= 0; --z) {
        int m = calcM(e, y, z);
        if((y + z <= m) && (m <= y + z + e)) {
          //cout << y << ":" << z << ":" << ":" << m << endl;
          if(minm > m) {
            maxy = y;
            maxz = z;
            minm = m;
          }
          break;
        }
      }
    }
    //cout << maxy << ":" << maxz << endl;
    cout << (e - pow(maxy, 2) - pow(maxz, 3) + maxy + maxz) << endl;
  }
  return 0;
}

int calcOver(int y, int z) {
  return (pow(y, 2) + pow(z, 3));
}
int calcM(int e, int y, int z) {
  return (e - pow(y, 2) - pow(z, 3) + y + z);
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	while(cin>>n,n){
		int mi=inf;
		rep(i,110)rep(j,1010){
			int k=n-i*i*i-j*j;
			if(k<0)continue;
			mi=min(mi,i+j+k);
		}
		cout<<mi<<endl;
	}
}

C++: #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
//#include <utility>
//#include <memory>
//#include <functional>
//#include <deque>
//#include <cctype>
//#include <ctime>
//#include <numeric>
//#include <list>
//#include <iomanip>

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	ll n;
	while(cin>>n,n){
		ll ans = INFL;
		for(ll i = 0; i*i*i <= n; i++){
			ll tmp = n - i*i*i;
			ll t = sqrt(tmp);
			reep(j, t-4,t+4){
				if(j<0) continue;
				if(j*j > tmp) continue;
				mins(ans, i+j+(tmp-j*j));
			}
		}
		cout<<ans<<endl;
	}
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}