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<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int main(){
	int x,y,z,e,ee,res=10000000;
	while(1){
		cin >> e;
		if(e==0){
			break;
		}
		for(z=0;z<=1000;z++){
			ee=e;
			if(z*z*z<=ee)
				ee-=z*z*z;
			for(y=0;y<=1000;y++){
				x=ee;
				if(y*y<=x)
					x-=y*y;
				res=min(res,x+y+z);
			}
		}
		cout << res << endl;
		res=1000000;
	}
	return 0;
}



/*int main(){
	long z,e,ee,res=1000000;
	while(1){
		cin >> e;
		if(e==0)
			break;

		for(int i=0; e!=0;i++){
            if(i*i*i > e){
                z = i;
                break;
            }
        }
        
        for(int i=0; i<20;i++){
            z-=1;
            ee=e;
            if(z<0){
                z=0;
            }
            ee-=z*z*z;
            if(ee==0){
                res=min(res,z);
            }
            for(int y=0;ee!=0;y++){
                if(y*y > ee){
                    ee-=(y-1)*(y-1);
					res=min(res,z+(y-1)+ee);
					break;
				}
            }
		}
        cout << res << endl;
		res=1000000;
	}
	return 0;
}*/

C++: #include "bits/stdc++.h"

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=n-1;i>=m;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007

const int dx[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy[8] = { 0,1,1,1,0,-1,-1,-1 };

using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	while (1) {
		int e, ans=INF;
		cin >> e;
		int c = e;
		if (!e) break;
		for (int i = 0;i*i*i < e;++i) {
			int y = sqrt(e - i*i*i);
			int x = e - i*i*i - y*y;
			ans = min(ans, x + y + i);
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <tuple>
#include <unordered_map>

using namespace std;

namespace std {
template <>
struct hash<tuple<int, int, int>> {
    size_t operator()(const tuple<int, int, int>& t) const
    {
        return get<0>(t) ^ get<1>(t) ^ get<2>(t);
    }
};
} // namespace std

int main()
{
    unordered_map<tuple<int, int, int>, int> memo;
    while (true) {
        int e;
        cin >> e;
        if (e == 0) {
            return 0;
        }
        auto r = [e, &memo] {
            for (int m = 0; true; ++m) {
                for (int i = 0; i < m; ++i) {
                    for (int j = 0; j < m - i + 1; ++j) {
                        auto k = m - i - j;
                        const auto t = make_tuple(i, j, k);
                        auto it = memo.find(t);
                        if (it != end(memo)) {
                            return it->second;
                        }
                        if (i + j * j + k * k * k == e) {
                            memo[t] = m;
                            return m;
                        }
                    }
                }
            }
        }();
        cout << r << endl;
    }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int e;
main()
{
	while(cin>>e,e)
	{
		int x,y,z,m=e;
		for(z=0;z*z*z<=e;z++)
		{
			for(y=0;y*y+z*z*z<=e;y++)
			{
				m=min(m,y+z+e-z*z*z-y*y);
			}
		}
		cout<<m<<endl;
	}
}

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

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define rer(i, a, b) for (int i = (int)a; i <= (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;

const int inf = 1000000000;
const int mod = 1000000007;
const double eps = 1e-9;
const int dx[] = { -1, 0, 1, 0};
const int dy[] = { 0, -1, 0, 1};

int main() {
	// cin.tie(0); // tie
	// ios::sync_with_stdio(false); // sync
	int e;
	while (cin >> e, e) {
		int ans = inf;
		for (int z = 0; z * z * z <= e; ++z) {
			for (int y = 0; y * y + z * z * z <= e; ++y) {
				int x = e - (y * y + z * z * z);
				ans = min(ans, x + y + z);
			}
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;

int main(){
	int e;
	int x,y,z;
	int m;
	int z3,y2,doe;
	while(cin>>e,e){
		x=y=z=0;
		m=1000000000;

		for(z=0;z*z*z<=e;z++){
			z3=z*z*z;
			for(y=0;y*y<=e-z3;y++){
				doe=e-z3;
				y2=y*y;
				doe-=y2;
				if(m>doe+z+y)
					m=doe+z+y;
			}
		}
		

		cout<<m<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
const int dx[]={1,0,0,-1,1,-1,-1,1,2,0,-2,0};
const int dy[]={0,1,-1,0,1,1,-1,-1,0,2,0,-2};
const int INF = 1<<30;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fr first
#define sc second
#define reps(i,j,k) for(int i = (j); i < (k); ++i)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
typedef pair<int,int> Pii;
typedef pair<int,Pii > P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
int main(){
	int e;
	while(scanf("%d",&e),e){
		int ans = INF;
		rep(y,1000){
			rep(z,100){
				int Y = y*y;
				int Z = z*z*z;
				int l = 0;
				int r = 1000001;
				rep(q,20){
					int med = (l+r)/2;
					if(med+Y+Z == e){
						ans = min(ans,med+y+z);
						break;
					}
					if(med+Y+Z < e){
						l = med;
					}
					else{
						r = med;
					}
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

int main()
{
    int x, e;
    int y_max, z_max = 0;
    int sum_min;

    while (std::cin >> e && e > 0) {
        y_max = static_cast<int>(std::sqrt(e));
        z_max = static_cast<int>(std::pow(e, 1.0 / 3.0));
        sum_min = e + y_max + z_max;
        for (int i = 0; i <= y_max; i++) {
            for (int j = 0; j <= z_max; j++) {
                x = e - std::pow(i, 2) - std::pow(j, 3);
                if (x >= 0 && x + i + j < sum_min) {
                    sum_min = x + i + j;
                }
            }
        }
        std::cout << sum_min << '\n';
        sum_min = e + y_max + z_max;
    }
    return 0;
}