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++: //#define _GRIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


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

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

int main() {
  int e;
  while (scanf("%d", &e) != EOF && e) {
    int m = 1000;
    for (int z=100; z>=0; z--) {
      if (e < z*z*z) {
	continue;
      }
      for (int y=0; y<m; y++) {
	if (e < y*y + z*z*z) {
	  break;
	}
	for (int x=0; x<m; x++) {
	  if (e == x + y*y + z*z*z && x+y+z < m) {
	    m = x + y + z;
	  } else if (e < x + y*y + z*z*z) {
	    break;
	  }
	}      
      }      
    }
    printf("%d\n", m);
  }
}

C++: /**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	int e;
    while(cin >> e) {
        if(e == 0) break;
        int ans = inf;
        for(int z = 0; z <= 100; ++ z) {
            if(e - z * z * z >= 0) {
                int res = e - z * z * z;
                int y = (int)sqrt(res);
                chmin(ans, z + y + res - y * y);
            }
        }
        cout << ans << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

int main()
{
	int e;
	while (cin >> e,e)
	{
		int z=0;
		while ((z+1)*(z+1)*(z+1) < e) z++;
		e -= z*z*z;
		int y=0;
		while ((y+1)*(y+1) < e) y++;
		e -= y*y;
		while (x+1 < e) x++;
		
		cout << x+y+z << 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 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++: #include<iostream>
#include<vector>
#include<math.h>
using namespace std;

int mind(int e){
  int mind=e;
  for(int i=0;i*i*i<=e;i++){
    for(int j=0;j*j<=e-i*i*i;j++){
      mind=min(i+j+(e-i*i*i-j*j),mind);
    }
  }
  return mind;
}


int main(){
  int E;
  vector<int> a;
  while(cin>>E && E>0){
    a.push_back(mind(E));
  }
  for(int i=0;i<a.size();i++)
    cout<<a[i]<<endl;
}

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

int main() {
  int e;
  while (cin >> e, e != 0) {
    int m = 1000000;
    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) {
	    m = min(m, x + y + z);
	    break;
	  }
	}
      }
    }

    cout << m << endl;
  }

  return 0;
}

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

int main() {
	int e,x = 0,y = 0,z = 0,ans,n,i,j;
	while(1){
		ans = 100000;
		cin >> e;
		if(e == 0)break;
		i = 1;
		while(1){
		if(i*i*i > e)break;
		i++;
		}
		i--;
		for(;i >= 0;i--){
			n = e;
			n -= i*i*i;
			z = i;
			if(n == 0){
				ans = min(ans,z);
				continue;
			}
		for(j = 0;j*j < n;j++);
		j--;
		n -= j*j;
		y = j;
		if(n == 0){
			ans = min(ans, z+y);
			continue;
		}
		x = n;
		ans = min(ans,x+y+z);
		//cout << x << " " << y  << " " << z <<endl;
		}
		j = 1;
		while(1){
		if(j*j > e)break;
		j++;
		}
		j--;
		for(;j >= 0;j--){
			n = e;
			n -= j*j;
			if(n == 0){
				ans = min(ans,j);
			}
			else{
				ans = min(ans,j+n);
			}
		//cout << n << " " << j <<endl;
		}
	cout << ans << endl;
	}
	return 0;
}