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>

using namespace std;

const int INF=10000003;

int main(){
	
	int e;
	while(cin>>e && e){
		int ans=INF;
		for(int i=0;i*i*i<=e;i++){
			int tmp=e-i*i*i;
			for(int j=0;j*j<=tmp;j++)ans=min(ans,i+tmp-j*j+j);
		}
	cout<<ans<<endl;
	}
}

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

int e;
int main() {
    while (cin >> e, e != 0) {
        int m = 1<<28;
        int lim_z = pow(e, 1.0/3.0);
        for (int z = 0; z <= lim_z; z++) {
            int lim_y = pow(e-z*z*z, 0.50);
            for (int y = 0; y <= lim_y; y++) {
                int x = e-z*z*z-y*y;
                m = min(m, x+y+z);
            }
        }
        cout << m << endl;
    }
    return 0;
}

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

int main ()
{
    int e;
    int dp[1000001];
    for (int i = 0; i <= 1000000; i++) dp[i] = 1001;

    for (int i = 0; i <= 100 && i < 1001; i++) {
        for (int j = 0; i + j * j <= 10000 && i + j < 1001; j++) {
            for (int k = 0; i + j * j + k * k * k <= 1000000 && i + j + k < 1001; k++) {
                int E = i + j * j + k * k * k;
                dp[E] = min(dp[E], i + j + k);
            }
        }
    }

    while (cin >> e, e) {
        cout << dp[e] << endl;
    }

    return 0;
}

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

using namespace std;

#define rep(i, a) for (int (i) = 0; (i) < (a); (i)++)
#define reps(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define MP(a, b) make_pair((a), (b))
#define pb(a) push_back((a))
#define all(v) (v).begin(), (v).end()

int e;

int main()
{
	cin >> e;
	while (e) {
		int mi = 1e9;
		int r;
		for (int z = 0; (r = e - z * z * z) >= 0; z++) {
			int r2;
			for (int y = 0; (r2 = r - y * y) >= 0; y++) {
				mi = min(mi, r2 + y + z);
			}
		}
		cout << mi << endl;
		cin >> e;
	}
}

C++: #include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    void input() {

    }

    void solve() {
        input();
        int e;
        cin >> e;
        if (e == 0) return;

        int m = INF;
        for (int y = 0; y * y <= e; ++y) {
            for(int z = 0; z * z * z <= e; ++z){
                int x = e - y * y - z * z * z;
                if(x >= 0 && m > x + y + z) m = x + y + z;
            }
        }
        cout << m << endl;
        solve();
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}

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


int main() {
  
  int n;
  while (cin >> n && n > 0) {
    int y_max, z_max, m, x;
    int smallest=n;
    for (int i=0; i*i*i <= n; i++) {
      for (int j=0; j*j + i*i*i <= n; j++) {
        x = n-j*j-i*i*i;
        if (x<0) {
          break;
        }
        if (i+j>smallest) {
          break;
        }
        if (x+i+j < smallest && x>= 0) {
          smallest = x + i + j;
        }
      }
    }
    cout << smallest << endl;
  }
}

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

const int INF = 1e+8;

int main() {
	int e;
	while(cin >> e && e){
		int ans = INF;
		for(int x = 0; x <= 1000000; ++x){
			if(x > ans)
				break;
			for(int y = 0; y * y <= 1000000; ++y){
				if(x + y > ans)
					break;
				for(int z = 0; z * z * z <= 1000000; ++z){
					if(x + y + z > ans)
						break;
					if((x + y * y + z * z * z) == e){
						ans = x + y + z;
					}
				}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #include<stdio.h>

int main(){
	long long E, sum=1000000;
	int y,z;
	while(scanf("%lld",&E),E){
	if(E==0)break;
	for(z=0;z*z*z<=E;z++)
		for(y=0;y*y<=E;y++){
                        long long x= E-z*z*z-y*y;
			if(z*z*z+y*y>E)break;
			else if(sum>x+y+z)sum=x+y+z;
			}
		printf("%lld\n",sum);
	}
        return 0;
}

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

int main(){
  while(1){
    int x,y,z,e;
    cin>>e;
    if(e==0){break;}

    for(int i=1;;i++){
      if(e<i*i*i){z=i-1; break;}
    }
    
    int Z=z*z*z;
    for(int q=1;;q++){
      if(e-Z<q*q){y=q-1; break;}
    }
    
    int Y=y*y;
    for(int p=1;;p++){
      if(e-Z-Y<p){x=p-1; break;}
    }
    cout<<x<<y<<z<<endl;
    
  }
  return 0;

C++: #include<iostream>
#include<math.h>
//#include<limits.h>
using namespace std;
int count = 0;
int solve(int E)
{
  int ans =999999;
  for (int z=0; z*z*z<=E; ++z)
    for (int y=0; y*y<=E; ++y)
      {
	//cout<<"y="<<y<<endl;
	int x=(int)(E-z*z*z-y*y);
	//cout<<"z="<<z<<endl;
	if ((x+y*y+z*z*z == E)&&(x>0))
	{
	  if((x+y+z)<ans)
	  {
	    ans=x+y+z;
	    // cout<<ans<<endl;
	  }
	}
      }
  return ans;
}
int main()
{
  int E;
  while (cin >> E && E>0)
  {
    cout << solve(E) << endl;
  }
}

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

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


int main(){
	int e;
	while(cin >> e , e){
		int m=1e+9;
		for(int z=0 ,z1=0;z<=e; ++z1 , z=pow(z1,3.0)){
			for(int y=0 , y1=0;y<=e; ++y1 , y=pow(y1,2.0)){
				int x = e-(y+z);
				if(x>=0) m= min(m , x+(int)sqrt(y)+(int)cbrt(z));
			}
		}
		cout << m << endl;
	}
	return 0;
}

C++: #define rep(i, n) for(i = 0; i < n; i++)
#define repi(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
	int e;
	while(cin>>e, e){
		int x, y, z;
		int ans = 1000000;
		for(z = 100; z >= 0; z--){
			if(z*z*z > e)continue;
			for(y = 1000; y >= 0; y--){
				if(z*z*z + y*y > e)continue;
				if(ans > (e - z*z*z - y*y )+y+z)ans = (e - z*z*z - y*y )+y+z;
			}
		}
		cout<<ans<<endl;
	}
	return 0;
}

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;
	for(int x=0;x<=e-Y-Z;x++){
	  int X=x;
	  if(X+Y+Z!=e)continue;
	  ans=min(ans,x+y+z);
	}
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}