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<cmath>
using namespace std;

int min(int a, int b) {
    if (a > b)return b;
    else return a;
}

int main()
{
    while (1) {
        int ans, E, x;
        cin >> E;
        if (E == 0)break;
        ans = 1000000;
        for (int i = 0; i*i*i <= E; i++) {
            int z = i;
            int y = sqrt(E - z*z*z);
            x = E - z*z*z - y*y;
            ans = min(ans, x + y + z);
        }
        cout << ans << endl;
    }
    return 0;
}

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

int main(void){

  int e;

while(1){
    int ans = 1000000000;
    cin >> 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++: #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){
						cout << y << endl;
						ans = x+y+z;
					}
				}
			}
	return ans;
}
int main() {
	int E;
	while (cin >> E && E>0)
		cout << solve(E) << endl;
}

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

using namespace std;

int main(void) {
	int e;
	while(1) {
		cin >> e;
		if(e == 0) {
			break;
		}
		
		int tmpx, tmpy, tmpz, tmpe;
		tmpe = e;
		for(tmpz = 0; pow(tmpz, 3) <= tmpe; tmpz++){}
		tmpz--;
		tmpe = tmpe - pow(tmpz, 3);
		if(tmpe == 0){
			tmpy = 0; tmpx = 0;
		}else{
			for(tmpy = 0; pow(tmpy, 2) <= tmpe; tmpy++){}
			tmpy--;
			tmpe = tmpe - pow(tmpy, 2);
			if(tmpe == 0){
				tmpx = 0;
			}else{
				tmpx = tmpe;
			}
		}
		int tmpm = tmpx + tmpy + tmpz;
		//cout << tmpz << " ! " << endl;

		int tmp;
		for(int z = 0; z <= tmpz + 1; z++) {
			for(int y = tmpy; y <= min(tmpm - z, int(pow(e - pow(z, 3), 1.0 / 2.0))); y++) {
				int x = e - pow(y, 2) - pow(z, 3);
				tmp = x + y + z;
				if(tmp < tmpm) {
					tmpm = tmp;
				}
			}
		}

		cout << tmpm << endl;
	}
	return 0;
}

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

using namespace std;

#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000000
#define INFL 10000000000000000LL
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main() {
  while(true){
    int n;
    cin >> n;
    if(n == 0) return 0;
    ll ans = INF;
    REP(i, (int)pow(n, 0.335)+1){
      REP(j, (int)pow(n, 0.5)+1){
        int k = n - (i*i*i) - (j*j);
        if(k >= 0 && i+j+k < ans) ans = i+j+k;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

bool solve() {
    ll e;
    cin >> e;
    if(e == 0) {
        return false;
    }
    ll ans = LLINF;
    for(ll z = 0; z * z * z <= e; z++) {
        for(ll y = 0; y * y <= e; y++) {
            ll x = e - y * y - z * z * z;
            if(0 <= x && x <= e) {
                chmin(ans, x + y + z);
            }
        }
    }
    cout << ans << endl;
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(solve())
        ;
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false
 
typedef long long ll;
typedef pair<int, int> ii;

#define MAXI 1000000

int main() {

	vector<int> bin, tri;
	
	for(int i = 0; i*i <= MAXI; i++){
		bin.push_back(i*i);
	}
	for(int i = 0; i*i*i <= MAXI; i++){
		tri.push_back(i*i*i);
	}
	
	int e;
	while(cin >> e, e){
		int ans = IINF;
		for(int i = 0; tri[i] <= e; i++){
			int ee = e;
			int sum = 0;
			sum += i;
			ee -= tri[i];
			if(DEBUG) cout << "\t" << sum << endl;
			auto it2 = upper_bound(bin.begin(), bin.end(), ee);
			it2--;
			int tmp = distance(bin.begin(), it2);
			sum += tmp;
			if(DEBUG) cout << "\t" << sum << endl;
			ee -= *it2;
			sum += ee;
			ans = min(ans, sum);
		}
		cout << ans << endl;
	}
	

	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int e,ans;
	while(scanf("%d",&e),e){
		ans=e;
		int x;
		double d=sqrt(e)+1,g=pow(e,(double)1/3)+1;
		rep(y,d){
			rep(z,g){
				x=e-y*y-z*z*z;
				if(x<0)continue;
				ans=min(ans,x+y+z);
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

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

int main() {
  while(true) {
    int e;
    cin >> e;
    if(e == 0) break;
    int y = 0;
    int z = 0;
    int maxy = 0;
    int maxz = 0;
    int maxover = 0;
    int limity = pow(e, 1.0 / 2.0);
    int limitz = pow(e, 1.0 / 3.0);
    //cout << limity << ":" << limitz << endl;
    for(; y <= limity; ++y) {
      for(int z = 0; z <= limitz; ++z) {
        int over = calcOver(e, y, z);
        //cout << y << ":" << z << ":" << over << endl;
        if(e >= over) {
         /// cout << "ok" <<endl;
          if(maxover < over) {
            maxy = y;
            maxz = z;
            maxover = over;
          }
        }
      }
    }
    //cout << maxy << ":" << maxz << endl;
    cout << (e - pow(maxy, 2) - pow(maxz, 3) + maxy + maxz) << endl;
  }
  return 0;
}

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

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

int main(){
  int e,ans;
  while(1){
    cin>>e;
    if(!e)break;
    ans=(1e9);
    for(int z=0;z*z*z<=e;z++){
      int Z=z*z*z;
      for(int y=0;y*y<=e-Z;y++){
	int Y=y*y;
	int X=e-Y-Z;
	if(X+Y+Z!=e)continue;
	ans=min(ans,X+y+z);
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(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 ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
 
using namespace std;
 
 
int main(){
  int e;
  while(cin>>e,e){
		int ans = 1 << 7;
        for(int i = 0;i*i*i<=e;i++){
					int yyx  = e - i*i*i;
					int y = (int)sqrt(yyx);
					ans = min(yyx-y*y+y+i,ans);
				}
				cout << ans << endl;
  }
  return 0;
}