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 <cstdlib>
#include <cmath>

using namespace std;

struct Ans{
  int x;
  int y;
  int z;
};
static const int E_MAX = 1000001;
static const int Y_MAX = 1000;
static const int Z_MAX = 100;
Ans ans[ E_MAX ];

int main (){
  for( int i = 0; i < E_MAX; i++ ) {
    ans[ i ].x = -1;
  }

  for( int y = 0; y <= Y_MAX; y++ ) {
    for( int z = 0; z <= Z_MAX; z++ ) {
      int idx = y * y + z * z * z;
      if( idx >= E_MAX ){ break; }
      if( ans[ idx ].x != -1 ) {
        if(
            y + z < ans[ idx ].y + ans[ idx ].z
        ) {
          ans[ idx ].y = y;
          ans[ idx ].z = z;
        }
        continue;
      }
      ans[ idx ].x = 0;
      ans[ idx ].y = y;
      ans[ idx ].z = z;
    }
  }

  int counter = 0;
  int py = 0, pz = 0;
  for( int i = 0; i < E_MAX; i++ ) {
    if( ans[ i ].x != -1 ) {
      counter = 0;
      py = ans[ i ].y;
      pz = ans[ i ].z;
      continue;
    }
    ans[ i ].x = ++counter;
    ans[ i ].y = py;
    ans[ i ].z = pz;
  }
  while( 1 ) {
    int e;
    cin >> e;
    if( !e ){ return EXIT_SUCCESS; }
    
    cout << ans[ e ].x + ans[ e ].y + ans[ e ].z << endl;
  }
}

C++: #include <bits/stdc++.h>
#define int long long
#define double long double
#define rep(i, a, n) for(int i = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int i = (int)(a);(i) <= (int)(n);++(i))
#define repif(i, a, x) for(int i = (int)(a);(x);++(i))
#define repr(i, a, n) for(int i = ((int)(a)-1);(i) >= (int)(n);--(i))
#define reper(i, a, n) for(int i = (int)(a);(i) >= (int)(n);--(i))
#define SZ(x) ((int)(x).size())
#define ALL(x) begin(x), end(x)
#define CEIL(x) ((int)ceil(((double)x)))
#define POW(x, y) ((int)pow(x, y))
#define UNIQUE(x) (x).erase(unique(ALL((x))), end(x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x)/gcd(x,y)*(y))
#define isin(x, l, r) ((l) <= (x) and (x) < (r))
#define fcout(n) cout << fixed << setprecision(n)
#define rcout(n) cout << right << setw(n)
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define PI (acosl(-1))
#define EPS (1e-10)
#define INF LLONG_MAX
#define INF32 INT32_MAX
#define MOD 1000000007LL
using namespace std;
using VI = vector<int>;
using PII = pair<int, int>;
using TIII = tuple<int, int, int>;
using VPII = vector<PII>;
using VTIII = vector<TIII>;
using Complex = complex<double>;
template<typename T, template<typename> typename C = less> using PQ = priority_queue<T, vector<T>, C<T>>;
template<typename T> bool chmax(T& a, const T& b, bool t = false){ if(a<b or (t and a == b)){ a=b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b, bool t = false){ if(a>b or (t and a == b)){ a=b; return true; } return false; }


int e;


signed main(){
    while(cin >> e, e){
        int m = INF;
        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;
            if(x >= 0) chmin(m, x+y+z);
        }
        cout << m << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;
const int INF = 1000000000;

int main(){
	while(true){
		int e;
		cin >> e;
		if(e == 0){ break; }
		int answer = INF;
		for(int z = 0; z * z * z <= e; ++z){
			for(int y = 0; z * z * z + y * y <= e; ++y){
				int x = e - y * y - z * z * z;
				answer = min(answer, x + y + z);
			}
		}
		cout << answer << endl;
	}
	return 0;
}

C++: #include<stdio.h>

int main()
{
	int e,y,z,m,ans=100000000;

	
	while(1){
		scanf("%d",&e);
		ans=100000000;
		if(e==0)
			break;
		
		else{
			for(y=0; y<=1000; y++){
				for(z=0; z<=100; z++){
					m=e-y*y-z*z*z+y+z;
					if(ans>m && e-y*y-z*z*z>=0)
						ans=m;
				}
			}
		
		printf("%d\n",ans);
	}
	}
	return 0;
}

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

long long min(long long a,long long b){
	if(a<b)return a;
	else return b;
}

int main(){
	long long e;
	while(cin>>e,e){
		long long m=INF;
		rep(i,min(e+1,1001)){
			rep(j,min(e+1,101)){
				if((e-i*i-j*j*j)<0)continue;
				if(m>(e-i*i-j*j*j+i+j))m=e-i*i-j*j*j+i+j;
			}
		}
		cout<<m<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int e;
int main(){
  for(;;){
    cin >> e ;;
    int m = e;
    if(e == 0) break;
    for(int y=0; y*y <= e; y++){
      for(int z=0; y*y + z*z*z <= e; z++){
        int x = e - z*z*z - y*y;
        if( x + y + z < m){
          m = x+y+z;
        }
      }
    }
    cout << m << endl;
  }
}

C++: #include <iostream>
using namespace std;
 
#define REP(i,n) for(int i=0;i<=(int)(n);i++)

int dou(int a){
  return a*a;
}

int tri(int a){
  return a*a*a;
}
 
int main(){

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

	int x,y,z;

	int cb = cbrt(e);
	
	int m = 1000000;

	REP(i,cb){
	  z = cb - i;
	  int huga = sqrt(e - tri(z));
	  REP(j,huga){
		y = huga - j;
		x = e - tri(z) - dou(y);
		if(m>(x+y+z)) m = x+y+z;
	  }
	}

	cout << m << endl;

  }
}

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

int main(int argc, char const* argv[])
{
    while ( cin >> E and E > 0 ) {
        int m = E;
        for (int z = 0; z * z * z <= E ; z++) {
            for (int y = 0; y * y <= E - z * z * z; y++) {
                int x = E - z * z * z - y * y;
                if ( x + y + z < m) m = x + y + z;
            }
        }
        cout << m << endl;
    }
    return 0;
}

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

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
int main(void){
  int m;
  while(cin>>m,m){
    int a,b,c,ret = 1e9;
    c = 0;
    while(c * c * c <= m)c++;
    rep(i,sqrt(m)+1)rep(j,c+1){
      if(i*i + j*j*j <= m){
        ret = min(ret, j + i + (int)(m-pow(i,2) - pow(j,3)));
       // cout<<i<<" "<<j<<" "<<(int)(m-pow(i,2) - pow(j,3))<<endl;
      }
    }
    cout<<ret<<endl;
  }
}

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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

ll crab(ll e){
    ll mi = inf;
    FOR(z, 0, 101){
        FOR(y, 0, 1001){
            ll rest = e - z*z*z - y*y;
            if(rest>=0){
                ll x = rest;
                chmin(mi, x+y+z);
            }
        }
    }
    return mi;
}

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

    // input
    while(true){
        ll e; cin >> e;
        if(e==0){
            return 0;
        }
        ll m = crab(e);
        p(m);
    }
    
    return 0;
}