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;

int main(){
  int e = 1;
  while(e > 0){
    cin >> e;
    int x,y,z,s;
    s = e;
    y = 0;
    z = 0;
    while(z*z*z<=e){
      while(y*y<=e-z*z*z){
	int s1;
	x = e-z*z*z-y*y;
	s1 = x+y+z;
	if(s>s1){
	  s = s1;
	}
	y+=1;
      }
      z+=1;
      y=0;
    }
    if(e > 0){
    cout << s <<endl;
    }
  }
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main() {
    int e;
    while (cin >> e, e) {
        int ret = 1e6;
        for (int z=0; z<=e; ++z) {
            int y = (int)pow(e - z*z*z, 1.0/2.0);
            int x = e - z*z*z - y*y;
            ret = min(ret, x+y+z);
        }
        cout << ret << endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int E;
    cin >> E;
    while(E){
        int mini = INF;
        rep(i,0,1000)rep(j,0,100){
            int x = i * i + j * j * j;
            if(x <= E)mini = min(mini, i + j + (E - x));
        }
        cout << mini << endl;
        cin >> E;
    }
}

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

int cal(int e) {
	int m = 2000000000, x;
	for (int z = 0; z * z * z <= e; z++) {
		for (int y = 0; z * z * z + y * y <= e; y++) {
			x = e - y * y - z * z * z;
			if (x < 0)break;
			m = min(m, x + y + z);
		}
	}
	return m;
}

int main() {
	vector<int> a;
	int hoge;
	while (1) {
		cin >> hoge;
		if (hoge != 0) {
			a.push_back(hoge);
		}
		else break;
	}
	for (int i = 0; i != a.size(); i++) {
		cout << cal((int)a[i]) << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
//int count1=0;
int solve(int E) {
    int ans = E;
    for (int z = 0; z*z*z <= E; z++) {
        for (int y = 0; y*y <= E; y++) {
            //count1++;
            int x = E - y*y - z*z*z;
            if (x >=0&&x+y+z<ans)
                ans=x+y+z;
            
        }
    }
    return ans;
}

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

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

int main(){
    while(true){
        int n; cin >> n;
        if(n == 0) break;
        int m = 1001001; // mは1000000より大きな数で初期化
        // z^3, y^2を決める、この時 O(10^2*10^3) = O(10^5)で間に合う
        for(int i = 0; i*i*i <= n; i++){ 
            for(int j =0 ; j*j <= n - i*i*i; j++){ 
                int x = n - i*i*i - j*j; 
                m = min(m, i + j + x); //最小の値
            }
        }
        cout << m << endl;
    }
}

C++: #include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define LOOP(i,x,n) for(int i=x;i<n;i++)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define MP make_pair
#define FR first
#define SC second
#define int long long
using namespace std;
const int MOD=1000000007;
const int INF=1000000009;


signed main(){
  int e;
  while(cin>>e,e){
    int m=INF;
    REP(y,1001){
      REP(z,101){
        if(e-y*y-z*z*z>=0){
          int x=e-y*y-z*z*z;
          m=min(m,x+y+z);
        }
      }
    }
    cout<<m<<endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS=1e-10;
const ll INF=1000000000;
int main(){
    int e;
    while(cin>>e,e){
        int ans=INF;
        for(int z=0;z*z*z<=e;z++){
            for(int y=0;y*y<=e;y++){
                int x=e-(z*z*z)-(y*y);
                if(x<0){
                    continue;
                }
                ans=min(x+y+z,ans);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;



int main(void) {
	
	while (1) {
		int e;
		bool flag = true;
		int mini = INF;

		cin >> e;
		if (e == 0) {
			break;
		}
		RFOR(z, cbrt(e)+1, 0) {
			if (pow(z, 3) > e) {
				continue;
			}
			RFOR(y, sqrt(e-pow(z,3))+1, 0) {
				if (pow(y, 2) < e - pow(z, 3) - pow(y, 2)) {
					break;
				}
				if (pow(y, 2) > e - pow(z, 3)) {
					continue;
				}
				if (pow(y, 2) == e - pow(z, 3)) {
					mini = z + y;
					flag = false;
					break;
				}
				else {
					if (mini > z + y + e - pow(z, 3) - pow(y, 2)) {
						mini = z + y + e - pow(z, 3) - pow(y, 2);
					}
				}
			}
			if (flag == false) {
				break;
			}
		}
		cout << mini << endl;
	}

}

C++: #include <iostream>

using namespace std;

const int INF = 1 << 23;

int main(void) {
    int e;
    while(cin >> e and e) {
        int ans = INF;
        for(int z = 0; z*z*z <= e; z++)
            for(int y = 0; y*y <= e - z*z*z; y++) 
                ans = min(ans, e + y + z - y*y - z*z*z);

        cout << ans << endl;
    }

    return 0;
}

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

int main(){
  int e;

  while(cin>>e,e){
    if(e==1) cout << e << endl;
    else{
      int x=e,y=round(pow((double)e,1.0/2.0)),z=round(pow((double)e,1.0/3.0)),m=x;

      for(int i=0;i<=x;i++){
        for(int j=0;j<=y;j++){
          for(int k=0;k<=z;k++){
            if(i+(int)pow((double)j, 2.0)+(int)pow((double)k, 3.0)==e&&m>i+j+k){
              m=i+j+k;
              break;
            }else if(i+(int)pow((double)j, 2.0)+(int)pow((double)k, 3.0)>e){
              break;
            }
          }
          if(i+(int)pow((double)j, 2.0)>e) break;
        }
      }
      cout << m << endl;
    }
  }

  return 0;
}

C++: #include <bits/stdc++.h>
#include<algorithm>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

int rp(int a,int t){
    int c=a*(100+t);
    int b=c/100;
    return b;
}

int main(){
    int E;
    while(cin >> E && E!=0){
        int x=0,y=0,z=0;
        int z3,y2;
        int minx,miny,minz;
        int mini=INF;
        while(z*z*z<=E){
            int z3=z*z*z;
            y=0;
            while(y*y<=E-z3){
                y2=y*y;
                x=E-z3-y2;
                mini=min(mini,x+y+z);
                y++;
            }
            z++;
        }
        cout << mini << endl;
    }
    return 0;
}