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 <list>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define COUNT(i, n) for(int i = 1; i <= n; i ++)
#define ITER(c) __typeof((c).begin())
#define each(c, it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define ALL(c) c.begin(), c.end()
#define mp make_pair
#define pb push_back
#define MEMSET(v, h) memset((v), h, sizeof(v))
 
using namespace std; 

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

const int INF = 1 << 24;

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

    return 0;
}

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


int main() {
	int e;
	while (cin >> e && e>0) {
		int y=0;
		int z=0;
		int sum=0,summin=e; // min: NOTICE how we initialize it

		while (y**3+z**3<e) {
			while (y**3+z**3<e) {
				x= e-y**3+z**3;	
				sum = x+y+z;
				if (sum < summin) summin = sum;
				++z;
			}
			++y;
		}
		cout << summin << endl;
	}

	return 0;
}

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

const int MAX=1000000;

int main(){
  int m,x,y,z,e;

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

    for(x=0;x<=sqrt(MAX/100);x++){
      for(y=0;y<=sqrt(MAX/100);y++){
	for(z=0;z<=sqrt(MAX/100);z++){
	  if(e==(x+y*y+z*z*z)){
	    m=min(m,(x+y+z));
	    break;
	  }
	}
      }
    }
    cout<<m<<endl;
  }
  return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<utility>
#include<iomanip>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<list>
#include<set>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define F first
#define S second
using namespace std;
const int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int dX[8] = { 0, 1, 1, 1, 0, -1, -1, -1 }, dY[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };
struct XY
{
	int x;
	int y;
};
int in()
{
	int x;
	cin >> x;
	return x;
}

/*
(char)'1' - (int)48 = (int)1;
　1111181
*/
////////////////////////////////////////////////////



int main()
{
	int e;
	while (cin>>e&&e)
	{
		int ans = e;
		for (int z = 0; z*z*z <= e; z++)
		{
			int y = (int)sqrt(e - z*z*z);
			ans = min(ans, y + z + (e - z*z*z - y*y));
		}

		cout << ans << endl;


	}
}

C++: #include <iostream>
#include <fstream>
#include <cmath>

using std::cin;
using std::cout;
using std::endl;

int limit(int lim, int exp) {
	int res = 0;
	for (int i = 0; pow(i,exp) < lim+1; i++) {
		res = i;
	}
	return res;
}

int main(void) {
	int e;
	cin >> e;

	while (e != 0) {
		int m = 0;
		int res;
		int en = e;
		int temp;
		int z = limit(en,3);

		for (int i = 0; i < 10 && !((z-i) < 0); i++) {
			m = 0;
			en = e;

			m += z-i;
			en -= pow(z-i,3);

			temp = limit(en,2);
			m += temp;
			en -= pow(temp,2);

			temp = limit(en,1);
			m += temp;

			if (i == 0) {
				res = m;
			}
			else if (m < res) {
				res = m;
			}
		}

		temp = limit(e,2);
		if (temp < res) {
			if (pow(temp,2) == e) {
				res = temp;
			}
		}
		
		cout << res << endl;
		cin >> e;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;



int main(){

	int e;
	int ans;

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

		ans=10000000;
		for(int i=0;i<=e;i++){
			for(int j=0;j*j<=e;j++){
				for(int k=0;k*k*k<=e;k++){
					if(i+j*j+k*k*k==e&&ans>i+j+k){
						ans=i+j+k;
					}
				}
			}
		}
		cout<<ans<<endl;
	}

}

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

using namespace std;
using ll = long long;


int main()
{
    int e;
    while(scanf("%d", &e)){
        if(e == 0)return 0;
        int ans = 1e9;
        for(int z = 0;z * z *z <= e;z++){
            for(int y = 0;y * y <= e - z * z * z;y++){
                int s = z * z * z + y * y;
                int usi = e - s;
                ans = min(ans, z + y + usi);
            }
        }
        printf("%d\n", ans);
    }
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 29);
const ll LINF = 1e18;
const double PI = acos(-1);

template<typename T>vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...)); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value != 0>::type
fill_v(U & u, const V... v) { u = U(v...); }
template<typename T, typename U, typename... V>
typename enable_if<is_same<T, U>::value == 0>::type
fill_v(U & u, const V... v) { for (auto& e : u) fill_v<T>(e, v...); }
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 (a > b) { a = b; return 1; } return 0; }

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int e;
	cin >> e;
	vi dbl(1001);
	FOR(i, 1, 1001) {
		dbl[i] = i * i;
	}
	while (e != 0) {
		int ans = INF;
		REP(z,e+1) {
			int cur = e - z * z * z;
			if (cur == 0) {
				chmin(ans, z);
				break;
			}
			else if (cur < 0) {
				break;
			}
			int y = distance(dbl.begin() + 1, upper_bound(ALL(dbl),cur));
			int x = cur - y * y;
			chmin(ans, x + y + z);
		}
		cout << ans << endl;
		cin >> e;
	}
	return 0;
}

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

using namespace std;

int main() {
    int x, y, z, e, ans;

    while (cin >> e) {
        if (!e) { break; }
        z = 0; ans = e;

        for (int z = 0; z*z*z <= e; z++) {
            for (int y = 0; y*y + z*z*z <= e; y++) {
                x = e - y*y - z*z*z;
                ans = min(ans, x+y+z);
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int x,y,z;
int e;
int solve(){
	int minnum = 1000000;
	z=pow (e,1/3);
	y = (int)sqrt(e - pow(z, 3));
	x = (int)(e - pow(z, 3)-pow(y, 2)); 
	return x+y+z;
};
int main(){
	int A[100000];
    int k = 0;
	while( cin>>e && e>0 )
	{
		A[k]=solve();
        k++;
	}
	for(int l = 0;l < k; l++)
    {
        cout<<A[l]<<endl;
    }
	return 0;
}