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 <cstdio>
#include <cstring>
#include <algorithm>
#define MAX (2000000)
#define INF (1145141919)
using namespace std;

int dp[MAX + 1];

int main()
{
	dp[0] = 0;
	for (int i = 1; i <= MAX; i++){
		dp[i] = INF;
	}
	
	for (int i = MAX; i >= 0; i--){
		if (dp[i] < MAX){
			for (int x = 0; i + x <= MAX; x++){
				dp[i + x] = min(dp[i + x], dp[i] + x);
			}
		}
	}
	
	for (int i = MAX; i >= 0; i--){
		if (dp[i] < MAX){
			for (int y = 0; i + y * y <= MAX; y++){
				dp[i + y * y] = min(dp[i + y * y], dp[i] + y);
			}
		}
	}
	
	for (int i = MAX; i >= 0; i--){
		if (dp[i] < MAX){
			for (int z = 0; i + z * z * z <= MAX; z++){
				dp[i + z * z * z] = min(dp[i + z * z * z], dp[i] + z);
			}
		}
	}
	
	int e;
	while (scanf("%d", &e), e){
		printf("%d\n", dp[e]);
	}
	
	return 0;
}

C++: #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
  int E,tmp,z,y,x;
  while (cin >> E && E>0){
    if (E>1000000){
    cout << "Incorrect input" << endl;
    exit(1);
    }
    for (z=0;z*z*z<=E;z++){
    }
    z--;
    tmp = E-z*z*z;
    for (y=0;y*y<=tmp;y++){
    }
    y--;
    x=tmp-y*y;
    cout << x+y+z << endl;
  }
}

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

typedef long long ll;

//x^t
ll mypow(ll x, ll t){
  return (ll)pow((double)x, (double)t);
}

int main(){
  while(true){
    ll e;
    cin>>e;
    if(e==0)break;
    ll x, y, z;
    for(x=0; x<=e; x++)
      for(y=0; mypow(y,2)+x<=e; y++)
        for(z=0; pow(z,3)+pow(y,2)+x<=e; z++)
          if(mypow(z,3)+mypow(y,2)+x==e){
            cout<<x+y+z<<endl;
            x=e+1;
          }
  }
  return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
int prime(int x) {
	if (x < 2)return 0;
	else if (x == 2) return 1;
	if (x % 2 == 0) return 0;
	for (int i = 3; i*i <= x; i += 2) {
		if (x%i == 0) return 0;
	}
	return 1;
}
int main() {
	int e;
	while (scanf("%d", &e), e) {
		int m = 100000000000000;
		for (int y = 0; y <= 10000; y++) {
			for (int z = 0; z <= 10000; z++) {
				int x=e + y - y * y + z - z * z * z;
					if(x>=0&&e>=y*y+z*z*z)m = min(x,m);
			}
		}
		cout << m << endl;
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS // #pragma warning(disable:4996)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <functional>
#include <sstream>
#include <cmath>
#include <set>
#include <map>
#include <stack>
using namespace std; 

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define all(a) a.begin(),a.end()
#define len(x) ((int)(x).size())
#define tmax(a,b,c) max((a),max((b),(c)))
#define tmin(a,b,c) min((a),min((b),(c)))
#define debug(x) cerr << #x << " is " << x << endl;

typedef pair<int, int> Pii;
typedef vector<int> Vi;
typedef vector<vector<int> > VVi;
typedef long long ll;
const int inf = 2e9;
const ll ll_inf = 1e17;
const int mod = 1e9 + 7;
const long double eps = 1e-10;

int main()
{
	while (1) {
		int e;
		cin >> e;
		if (!e) break;
		int ans = inf;
		rep(i, 0, 1001) {
			rep(j, 0, 1001) {
				int l = 0;
				int r = 1000;
				rep(k, 0, 10) {
					int m = (l + r) / 2;
					int x = i*i*i + j*j + k;
					if (x == e) {
						ans = min(ans, i+j+k);
					}
					else if (x > e) r = m;
					else l = m;
				}
			}
		}
		cout << ans << endl;
	}

	return 0;
}

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

int main() {
    while (true) {
        int e;
        cin >> e;
        if (e == 0) {
            break;
        }
        int minM = e;
        for (int z = 0; pow(z, 3) <= e; z++) {
            for (int y = 0; pow(y, 2) <= e - pow(z, 3); y++) {
                int x = e - pow(y, 2) - pow(z, 3);
                if (x + y + z < minM) {
                    minM = x + y + z;
                }
            }
        }
        cout << minM << endl;
    }
}

C++: #include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	while(1){
		ll e; cin >> e;
		if(!e) break;
		ll ans = inf;
		rep(i,101){
			ll tmp = e - i*i*i;
			if(tmp < 0) break;
			ll sq = (ll)sqrt(tmp);
			chmin(ans,i+sq+tmp-sq*sq);
		}
		cout << ans << endl;
	}
}

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

const int INF = (int)1e9;

typedef long long lli;

int solve(int E) {
    int res = INF;
    for(lli x = 0; x < res && x <= E; x++) {
        for(lli y = 0; x + y < res && (x + y*y <= E); y++) {
            for(lli z = 0; x + y + z < res && (x + y*y + z*z*z <= E); z++) {
                if(x + y * y + z * z * z == E) {
                    res = x + y + z;
                }
            }
        }
    }
    return res;
}

int main() {
    for(int E; cin >> E, E; ) {
        cout << solve(E) << endl;
    }
}