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>
using namespace std;
 
int main(){
   
  int e;

  while(cin>>e, e){
    int mi=1000000;
    for(int z=0;z*z*z<=e;z++){
      for(int y=0;z*z*z+y*y<=e;y++){
	int x=e-(z*z*z+y*y);
	mi=min(mi, x+y+z);
      }
    }
    cout<<mi<<endl;
  }
   
  return 0;
}

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

using namespace std;



int main(){

	int e;
	int x,y,z;
	int xm,ym,zm;
	int csum,msum=1000000;
	while(true){

		cin>>e;
		if(e==0) break;
		
		zm=pow(e,1.0/3);
		ym=sqrt(e-pow(zm,3));
		xm=e-pow(zm,3)-pow(ym,2);
		msum=xm+ym+zm;
		
		z=zm-1;
		y=sqrt(e-pow(z,3));
		x=e-pow(z,3)-pow(y,2);
		csum=x+y+z;
		if(csum<msum) msum=csum;
		cout<<msum<<endl;
	}	
	
	


return 0;
}

C++: #include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

void solve(int E) {
    int m = INF;
    for (int y = 0; (y * y) <= E; y++) for(int z = 0; (z * z * z) <= E; z++) {
        int x = E - (y * y) - pow(z, 3);
        if (x < 0) continue;
        m = min(m, x + y + z);
    }
    cout << m << endl;
}

signed main(void) {
    int n, m, p, a, b, c, x, y, z, q;
    string s;
    while (cin >> n, n) {
        solve(n);
        //return 0;
    }
}

C++: #include <iostream>

#define FOR(i,l,n) for(int (i)=(l);(i)<(n);(i)++)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(){
    long int x,y,z,e,m;
    while(cin>>e,e){
        m=e;
      for(y=0;y*y<=e;y++){
          for(z=0;z*z*z+y*y<=e;z++){
              x = e-y*y-z*z*z;
              m = m<x+y+z?m:x+y+z;
          }
      }  
        cout<<m<<endl;
    }
    return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int main() {
int e,x,y,z;
int sum=0;
while(1){
cin>>e;
if(e==0) break;
for (z=int(cbrt(e));z>0;z--){
  y=int(sqrt(e-z^3));
  x=e-y^2-z^3;
  if(sum>x+y+z||sum==0){
    sum=x+y+z;
  }
}
cout<<sum<<endl;
}
}

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

int main(){

	  while(1){
			int e; cin >> e;
			if(!e) break;
			/*
			int mini = 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++){
							  if(x + y*y + z*z*z == e)
									mini = min(mini,x+y+z);
						}

				  }
			}
			*/
			int mini = e;
			for(int z=0; z*z*z<=e; z++){
				  for(int y=0; z*z*z + y*y<=e; y++){
						int x = e - z*z*z - y*y;
						mini = min(mini,x+y+z);	
				  }
			}
			
			
			cout << mini << endl;

	  }

}

C++: // AOJ 2012

#include <iostream>

using namespace std;

int main(void)
{
	int e;
	while (cin >> e, e){
		int minnum = 1001001;

		for (int i = 0; i <= 1000; i++){
			for (int j = 0; j <= 100; j++){
				for (int k = 0; k <= 100; k++){
					if (i + (j * j) + (k * k * k) == e){
						minnum = min(minnum, i + j + k);
					}
				}
			}
		}

		cout << minnum << endl;
	}

	return 0;
}

C++: #if 0

#endif

#include <iostream>
#include <cmath>
using namespace std;

int mycount = 0; // ambigous??¨???????????????????????????
int solve(int E) {
 // ?????´????±???????
	int ans = 1000000; // ?????§???
	for (int z=0; z*z*z<=E; ++z)
		for (int y=0; y*y<=E; ++y){
			int x = E-z*z*z-y*y;
				++mycount; 
				if (x>=0 && x+y*y+z*z*z == E){
					if (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 <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>

using namespace std;

namespace Solver {

    int e;
    inline bool Read() {
        cin >> e;
        return e != 0;
    }

    inline void Work() {
        for (int x = 0; x <= e; x++) {
            for (int y = 0; (x + y * y) <= e; y++) {
                for (int z = 0; (z * z * z + y * y + x) <= e; z++) {
                    if (z * z * z + y * y + x == e) {
                        cout << x + y + z << endl;
                        return;
                    }
                }
            }
        }
    }

    inline void Solve() {
        while(Read()) Work();
    }
}

int main() {
    Solver::Solve();
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;

struct Edge{int to,from,cost;};

#ifdef DEBUG
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;i--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);i--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define SS stringstream
#define X second
#define Y first
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};



int main() {
	int x,y,z,e;
	IL{
		cin>>e;
		if(e==0)break;
		int res=INF;
		for(z=0;z*z*z<=e;++z){
			for(y=0;y*y+z*z*z<=e;++y){
				x=e-z*z*z-y*y;
				chmin(res,x+y+z);
			}
		}
		cout<<res<<endl;
	}
	return 0;
}