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<vector>
#include<string>
#include<algorithm>
using namespace std;
int e;
int main() {
	
	vector<int> ans;
	while (cin >> e, e) {
		int m=1000000;
		for (int i = 0; i <= e; ++i) {
			if (i*i*i > e) break;
			for (int j = 0; j <= e; ++j) {
				if (i*i*i + j * j > e) break;
				for (int k = 0; k <= e; ++k) {
					if (i*i*i + j * j + k == e) m = min(m, i + j + k);
				}
			}
		}
		ans.push_back(m);
	}
	for (int i = 0; i < ans.size(); ++i) {
		cout << ans[i] << endl;
	}
	return 0;
}

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

int main() {

    int e=0, min, tre, deu;
    while(cin >> e && e > 0)
    {
        min = e;
        for(int i = e; i>=0;i--)
        {
            tre = i*i*i;
            if(tre <= e)
                for(int j =e;j>=0;j--)
                {
                    deu = j*j;
                    if(deu <= e - tre)
                        min = i + j + (e-tre-deu) < min ? i+j+(e-tre-deu) : min;
                }
        }
        cout << min << endl;
    }
    return 0;
}

C++: #include<stdio.h>
#define INF 1000000
int main(){
    while(true){
        int e,ans=INF;
        scanf("%d",&e);
        if(e==0) return 0;
        for(int z=0;z*z*z<=e;z++){
            for(int y=0;y*y+z*z*z<=e;y++){
                if(ans>e-y*y-z*z*z+y+z) ans=e-y*y-z*z*z+y+z;
            }
        }
        printf("%d\n",ans);
    }
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
int main(void){
	while(1){
		ll num,ans=1000000;
		cin >> num;
		if(!num)	break;
		for(ll y=0;pow(y,2)<=num;y++){
			for(ll z=0;pow(z,3)+pow(y,2)<=num;z++){
				ll x=num-y*y-z*z*z;
				if(x<0)	break;
				ans = min(ans,x+y+z);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>
using namespace std;


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

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(){
  int e,m;

  while(cin >> e && e>0){
      m=e;
    for(int z=0; pow(z,3)<=e; z++){
      int pz = pow(z,3);
      for(int y=0; pz+pow(y,2)<=e; y++){
        int x = e - (pz+pow(y,2));
          if(x+y+z<m)
            m=x+y+z;
        }
      }
    cout << m << endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

typedef long long ll;
typedef pair<int, int> pii;

int main(void)
{
	int e;
	while (cin >> e, e) {
		vector<pii> vs;
		for (int y = 0;; y++) {
			int k = y*y;
			if (k > e) break;
			for (int z = 0;; z++) {
				int l = z*z*z;
				if (k+l > e) break;
				vs.push_back(pii(k+l, y+z));
			}
		}

		int ans = (1<<29);
		sort(ALL(vs));
		for (int x = 0; x <= max(e/3+1, 3); x++) {
			int e_x = e - x;
		
			int a = 0, b = vs.size();
			while (b - a > 1) {
				int m = (a+b)/2;
				if (vs[m].first >= e_x)
					b = m;
				else
					a = m;
			}
			if (vs[b].first == e_x)
				ans = min(ans, x+vs[b].second);
		}
		cout << ans << endl;
	}
	return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll e;
  while(cin >> e && e){
    ll m = inf;
    for(int i = 0; i <= 100; ++ i){
      for(int j = 0; int(e - i * i * i - j * j) >= 0; ++ j){
        ll x = e - i * i * i - j * j ;
        if(x >= 0 && x <= 1000000){
          m = min(m,i+j+x);
        }
      }
    }
    cout << m << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<math.h>

using namespace std;

int main() {
  int e, x, y, z, y_max, z_max, ans;
  while(true) {
    cin >> e;
    if(e == 0) break;
    ans = e;
    z_max = (int) pow(e, 1.0/3.0);
    for(z = 0; z <= z_max; z++) {
      y_max = (int) sqrt(e-z*z*z);
      for(y = 0; y <= y_max; y++) {
	x = e - y*y - z*z*z;
	if(ans > x+y+z) ans = x+y+z;
      }
      if(z == z_max) cout << ans << endl;
    }
  }

  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int hoge(int e){
  int num;
  int a,b,c;
  for(a=0;a<=e;a++){
	for(b=0;b<=10000;b++){
	  for(c=0;c<=1000;c++){
		num = a + b*b + c*c*c;
		//		cout << num << endl;
		if(num > e) break;
		if(num == e) return (a + b + c);
		
	  }
	}
  }  
	return -1;
}

int main(){

  int e;

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

	cout << hoge(e) <<endl;

  }
}