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++: /*
 * 宇宙ヤシガニ（枝狩り問題）
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2012
 */
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#include<sstream>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; } //t=min
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } //t=max
using namespace std;

int main() {
	// x=1,000,000
	// y=1,000
	// z=100

	int min_m=INT_MAX,m=0;
	int E;
	int x,zz;
	while(cin >> E && E) {
		min_m=INT_MAX,m=0;
		rep(z,100) {
			zz = E - z*z*z;
			if (zz >= 0) {
				rep(y,1000) {
					x = zz - y*y;
					if (x >= 0) {
						m = x + y + z;
						//dump(E);
						//cout<<"m="<<m<<" x="<<x<<" y="<<y<<" z="<<z<<endl;
						chmin(min_m,m);
					}
					else { break; }
				}
			}
			else { break; }
		}
		cout << min_m << endl;
		
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int main()
{
    int a,ans;
    
    while(cin >> a,a!=0){
        
        ans = 100010;
        for(int i=0;i*i*i<=a;i++){
            for(int j=0;j*j<=a-i*i*i;j++){
                ans = min(ans,i+j+(a-i*i*i-j*j) );
            }
        }
        
        cout << ans << endl;
    }
    
    
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

const int INF = 1 << 30;
// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::pair<int,P> State;

int pow(int a, int n){
    int res = 1;
    while(n > 0){
        if(n & 1){res *= a;}
        a *= a;
        n >>= 1;
    }
    return res;
}

int bs(int a, int n){
    int lb = 0, ub = 1001;
    while(ub-lb > 1){
        int mid = (lb+ub) / 2;
        if(pow(mid, n) <= a){
            lb = mid;
        }else{
            ub = mid;
        }
    }

    return lb;
}


int main(){
    int e;
    while(std::cin >> e, e){
        int res = INF;
        REP(z, 100){
            if(e-z*z*z >= 0){
                int y = bs(e-z*z*z, 2),
                    x = e - z*z*z - y*y;
                res = std::min(res, x+y+z);
            }
        }

        std::cout << res << std::endl;
    }
}

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

using namespace std;

#define pb push_back
#define fi first
#define se second
#define FOR(i, a, b) for(int i=(a);i<(b);i++)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define RREP(i, n) FOR(i, n, 0)
#define MFOR(i, m) for(auto i=(m).begin();i!=(m).end();i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())

typedef long long int ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

const double eps = 1e-10;
const int MOD = 1000000007;

template<typename T>
void printv(vector<T> const& s) {
  REP(i, s.size()) {
    cout << s[i] << " ";
  }
  cout << endl;
}

int main () {
  cin.tie(0);
  cout << setprecision(10);

  while(1) {
    int e; cin >> e;
    if(e == 0) break;
    int mi = 1000000;
    REP(i, 100+1) {
      REP(j, 1000+1) {
        int x = e - i*i*i - j*j;
        if(x >= 0) {
          mi = min(mi, x+i+j);
        } else {
          break;
        }
      }
    }
    cout << mi << endl;
  }
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int e;
	while (scanf("%d", &e), e)
	{
		int res = e;
		for (int z = 0; z*z*z <= e; ++z)
		{
			int y = sqrt(e - z*z*z + 0.5);
			min_swap(res, (e - (y*y + z*z*z) + y + z));
		}
		printf("%d\n", res);
	}
}

C++: #include <iostream>
#include <math.h>
using namespace std;
int E;
int solve (int e) {
	int mi = e;
	for (int z = 0; z*z*z <= e ; z++) {
		for (int y = 0; y*y <= e ; y++) {
			if (e - y*y - z*z*z >= 0) {
				mi = min(mi,e-y*y-z*z*z+y+z);
			}
		}
	}
	return mi;
}
int min(int a,int b) {
	if (a<b) return a;
	else return b;
}
int main() {
	while (cin >> E && E > 0 ) {
		cout << solve(E) << endl;
	}
}

C++: 
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <string>
#include <queue>
#include <map>
#include <stack>
using namespace std;
 
int dx[8]={1,-1,0,0,1,1,-1,-1};
int dy[8]={0,0,1,-1,-1,1,-1,1};
 
 
int main() {
int n;
while(cin>>n && n){
int mi=1000000;
for(int z=0;z<101;z++){
if(z*z*z>n) break;
int q=n-z*z*z;
int y=0;
while(y*y<=q) y++;
y--;
int x=q-y*y;
mi=min(mi,x+y+z);
}
cout<<mi<<endl;
}
	return 0;
 
   }

C++: #include <iostream>
#include <cmath>
using namespace std;
int calcOver(int, int);
int calcM(int, int ,int);

int main() {
  while(true) {
    int e;
    cin >> e;
    if(e == 0) break;
    int y = 0;
    int z = 0;
    int maxover = 0;
    int limity = pow(e, 1.0 / 2.0);
    int limitz = pow(e, 1.0 / 3.0);
    int maxy = limity;
    int maxz = limitz;
    int minm = e;
    bool flag = false;
    //cout << limity << ":" << limitz << endl;
    for(y = limity; y >= 0; --y) {
      for(int z = limitz; z >= 0; --z) {
        int over = calcOver(y, z);
        if(e >= over) {
          //cout << "ok" <<endl;
          int m = calcM(e, y, z);
          //cout << y << ":" << z << ":" << over << ":" <<m << endl;
          //if(maxover <= over && ((maxy + maxz) >= (y + z))) {
          if(minm > m) {
          //cout << "ok" <<endl;
            maxy = y;
            maxz = z;
            //maxover = over;
            minm = m;
          }
          if(flag) {
            flag = false;
            break;
          } else {
            flag = true;
          }
        }
      }
    }
    //cout << maxy << ":" << maxz << endl;
    cout << (e - pow(maxy, 2) - pow(maxz, 3) + maxy + maxz) << endl;
  }
  return 0;
}

int calcOver(int y, int z) {
  return (pow(y, 2) + pow(z, 3));
}
int calcM(int e, int y, int z) {
  return (e - pow(y, 2) - pow(z, 3) + y + z);
}