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<algorithm>
#include<numeric>
#include<vector>
#include<set>
#include <math.h>
#include <string>
#define cinf(n,x,y) for(int i=0;i<(n);i++) cin >> x[i]>>y[i];
typedef long long int ll;
const ll INF =1LL << 62;
using namespace std;
int MAX_E=1000010;
ll dp[1000010];
int main(){
    while(1){
        int e; cin >>e;
        if(e==0) break;
        int ans=1e9;
        for(int i=0;i*i*i<=e;i++){
            for(int j=0;j*j<=e-i*i*i;j++){
                ans=min(ans,i+j+(e-i*i*i-j*j));
            }
        }
        cout << ans << endl;
    }
}

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 E;
	while(cin >> E, E) {
		int min_m = E;
		for(int z=0; z*z*z<=E; z++) {
			for(int y=0; y*y<=E-z*z*z; y++) {
				int x = E - y*y - z*z*z;
				if (x + y + z < min_m) { min_m = x + y + z; }
			}
		}
		cout << min_m << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int E;
int main(){
  while(cin >> E && E>0){
    int m = 400000;
    for (int z=0; z<=100; z++){
      for(int y=0; y<= sqrt(E-pow(z,3));y++){
	int x = E - pow(z,3) - pow(y,2);
	if (x >= 0){
	  int n = x+y+z;
	  if(n < m){
	    m = n;
	  }
	}
      }
    }
    cout << m << endl;
  }
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double PI = 3.14159265358979;
const double E = 2.718281828459045;
const double root2 = sqrt(2);
typedef pair<int, int> P;
typedef unsigned int ui;
int main() {
	int e;
	while (cin >> e) {
		if (e == 0)break;
		int m = (int)MOD;
		for (int i = 0; i <= 1000; i++) {
			for (int j = 0; j <= 100; j++) {
				if (i*i + j * j*j <= e) {
					m = min(m, i + j + e - i * i - j * j*j);
				}
			}
		}
		cout << m << endl;
	}
	return 0;
}

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

int main(void){
  int e;
  while(cin >> e && e >0){
    int sum;
    int minsum=0;
    for(int z=0;z*z*z<=e;z++){
      int temp=e-z*z*z;
      for(int y=0;y*y<=temp;y++){
	int x=temp-y*y;
	sum=x+y+z;
	
	if(minsum==0 || sum < minsum){
	  
	  minsum=sum;
	}
      }
    }
    cout<<minsum<<endl;
  }
  return 0;
}

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

typedef long long ll;
using namespace std;

int main() {
  int e;
  while(1){
    cin >> e;
    if(e == 0) break;
    int ans = e;
    for(int y = 0;y*y <= e; y++){
      for(int z = 0;z*z*z+y*y <= e; z++){
        int x = e -y*y-z*z*z;
        ans = min(ans,x+y+z);
      }
    }
    pout(ans);
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<complex>
#define INF 2147483647
#define llINF 9223372036854775807
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long

using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    int ans=INF;
    for(int i=0;i*i*i<=n;i++){
      for(int j=0;j*j<=n-(i*i*i);j++){
	ans=min(ans,i+j+(n-(i*i*i)-(j*j)));
      }
    }
      cout<<ans<<endl;
  }
  return 0;
}

C++: #include<stdio.h>
using namespace std;

int main(){
	long long E, sum=1000000;
	int y,z;
	long long x= E-z*z*z-y*y;
	while(scanf("%lld",&E){
	if(E==0)break;
	for(z=0;z*z*z<=E;z++)
		for(y=0;y*y<=E;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>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  vector<int> m(1e6 + 1, 1<<30);
  const int n = 500;
  for (int x = 0; x < n; x++) {
    for (int y = 0; y < n; y++) {
      for (int z = 0; z < n; z++) {
        int t = x+y*y+z*z*z;
        if (t <= 1e6) {
          m[t] = min(m[t], x+y+z);
        }
      }
    }
  }
  int e;
  while (true) {
    cin >> e;
    if (e == 0) break;
    cout << m[e] << endl;
  }
}

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

int e,minimum;

int solve(){
    minimum = e;
    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;
            if(x>=0)
                minimum = min(x+y+z,minimum);
        }
    }
    return minimum;
}

int main(){
    while(cin >> e && e!=0){
        cout << solve() << endl;
    }
}

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

bool isint(double x){
	int a=(int)x;
	if(a==x) return true;
	return false;
}

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

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

using namespace std;

#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000000
#define INFL 10000000000000000LL
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main() {
  while(true){
    int n;
    cin >> n;
    if(n == 0) return 0;
    ll ans = INF;
    REP(i, (int)pow(n, 0.335)+1){
      if(n < i*i*i) break;
      int j = (int)pow(n-i*i*i, 0.5);
      if(ans > i+j+(n-i*i*i-j*j)){
        ans = i+j+(n-i*i*i-j*j);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main(void){
  int e;
  while(cin>>e,e){
    //x+y^2+z^3=e<=10^6
    //x<=10^6,y<=10^3,z<=10^2
    //x+y+z=m
    
    int z = (int)pow(e,1.0/3.0)+1;
    while(z*z*z>e) --z;
    int y = (int)sqrt(e)+1;
    while(y*y>e) --y;
    int x = 1000;
    while(x>e) --x;
    
    int X,Y,Z,ans=1e6;
    for(Z=z;Z>=0;--Z){
      for(Y=y;Y>=0;--Y){
        for(X=x;X>=0;--X){
          if(X+Y*Y+Z*Z*Z<e) break;
          if(X+Y*Y+Z*Z*Z==e){
            ans=min(ans,X+Y+Z);
            //cerr<<X<<","<<Y<<","<<Z<<endl;
          }
        }
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}