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 <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 m = calcM(e, y, z);
        if((y + z <= m) && (m <= y + z + e)) {
          //cout << y << ":" << z << ":" << ":" << m << endl;
          if(minm > m) {
            maxy = y;
            maxz = z;
            minm = m;
          }
          break;
        }
      }
    }
    //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);
}

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

int n;
void init(){
  n=0;
}

int input(){
  cin>>n;
  return n;
}

int solve(){
  int res=n;
  for(int z=0;z*z*z<=n;z++){
    for(int y=0;y*y+z*z*z<=n;y++){
      res=min(n-(z*z*z)-(y*y)+y+z,res);
    }
  }
  return res;
}




int main(){
  while(init(),input()){
    cout<<solve()<<endl;
  }
}

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

using namespace std;



int main(){

	int e;
	int x,y,z;
	int xm,ym,zm;
	int csum;
	while(true){
		int msum=1000000;

		cin>>e;
		if(e==0) break;
		
		zm=pow(e,1.0/3);
		for (int i = zm; i >= 0; --i)
		{
			
			ym=sqrt(e-pow(i,3));
			for (int j =ym ; j >=0; --j)
			{
				x=e-pow(i,3)-pow(j,2);
				csum=x+j+i;
				if(csum<msum) msum=csum;
			}
		}
		cout<<msum<<endl;
	}	
	
	


return 0;
}

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

int Bsearch(int e,int n){
  //cout << n << endl;
  int l=0,r=e;
  int i=(l+r)/2;
  while(r-l>=1){
    i=(l+r)/2;
    //cout << "i:" << i << endl;
    if(e == pow(i,n)){
      //cout << "aaa:" << i << endl;
      return i;
    }else if(e > pow(i,n)){
      l=i+1;
    }else{
      r=i;
    }
  }
  //cout << "i:" << i << endl;
  return i;
}

int a[2000][2000];

int main(){
  int x,y,z,e;
  while(cin>>e,e){
    memset(a,0,sizeof(a));
    y=Bsearch(e,2);
    z=Bsearch(e,3);

    int m=1000000;
    //cout << "z:" << z << " y:" << y << endl;
    for(int i=0;i<=1000;i++){
      for(int j=0;j<=100;j++){
	x=e-i*i-j*j*j;
	if(x>=0)m = min(x+i+j,m);
      }
    }
    cout << "ans:" <<m << endl; 
  }
}

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

using namespace std;



int main(){

	int e;
	int x,y,z;
	int xm,ym,zm;
	int csum;
	while(true){
		int msum=1000000;

		cin>>e;
		if(e==0) break;
		
		zm=pow(e,1.0/3);
		for (int i = zm; i >= zm-5; --i)
		{
			
			ym=sqrt(e-pow(i,3));
			for (int j =ym ; j >=0; --j)
			{
				x=e-pow(i,3)-pow(j,2);
				csum=x+j+i;
				if(csum<msum) msum=csum;
			}
		}
		cout<<msum<<endl;
	}	
	
	


return 0;
}

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

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

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;
				if(Y+Z > e)continue;
				int l = 0;
				int r = 1000001;
				while(l != r){
					int med = (l+r)/2;
					if(med+Y+Z == e){
						ans = min(ans,med+y+z);
						break;
					}
					if(med+Y+Z < e){
						l = med+1;
					}
					else{
						r = med;
					}
				}
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

int main () {
  long long int e;
  cin >> e;
  long long int min = 0;
  for (long long int l = 0; l < round(pow( e,  1.0/3.0 )) + 1; l++) {
    for (long long int k = 0; k < round(sqrt(e)) + 1; k++) {
      for (long long int i = 0; i < e+1; i++) {
        if (i + k*k + l*l*l == e) {
          if (min == 0) {
            min = i + k + l;
          } else if (min > i + k + l) {
            min = i + k + l;
          }
        }
      }
    }
  }
  cout << min << endl;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;
 
#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<=(int)(n);i++)
#define pb push_back 
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

long long int dou(long long int a){
  return a*a;
}

long long int tri(long long int a){
  return a*a*a;
}
 
int main(){

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

	long long int x,y,z;

	long long int cb = cbrt(e);

	long long int m = 10000000000;

	REP(i,cb){
	  z = cb - i;
	  long long int huga = sqrt(e - tri(z));
	  REP(j,huga){
		y = huga - j;
		x = e - tri(z) - dou(y);
		if(m>(x+y+z)) m = x+y+z;
	  }
	}

	cout << m << endl;

	//	cout << z << endl;


  }
}

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

using namespace std;

int main() {
	int hyou[101];
	for (int i = 0; i < 101; i++) {
		hyou[i] = i*i*i;
	}
	int e;
	while (cin >> e) {
		if (e == 0) {
			break;
		}
		int a, b, c;
		for (int i = 1; ; i++) {
			if (hyou[i] > e) {
				c = i-1;
				break;
			}
		}
		for (int i = 1; ;i++) {
			if (i*i > e-hyou[c]) {
				b = i-1;
				break;
			}
		}
		for (int i = 1; ;i++) {
			if (i > e-hyou[c]-b*b) {
				a = i-1;
				break;
			}
		}
		int MIN = a+b+c;
		for (int i = c-1; i >= 0; i--) {
			for (int j = b+1; ; j++) {
				if (j*j > e-hyou[i]) {
					b = j-1;
					break;
				}
			}
			int q = e-hyou[i]-b*b;
			MIN = min(MIN, b+q+i);
		}
		cout << MIN << endl;
	}
	return 0;
}

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

using namespace std;

int main(void) {
	int e;
	while(1) {
		cin >> e;
		if(e == 0) {
			break;
		}
		
		int tmpx, tmpy, tmpz, tmpe;
		tmpe = e;
		tmpz = pow(e, 1.0 / 3.0);
		tmpe = tmpe - pow(tmpz, 3);
		if(tmpe == 0){
			tmpy = 0; tmpx = 0;
		}else{
			tmpy = pow(tmpe, 1.0 / 2.0);
			tmpe = tmpe - pow(tmpy, 2);
			if(tmpe == 0){
				tmpx = 0;
			}else{
				tmpx = tmpe;
			}
		}
		int tmpm = tmpx + tmpy + tmpz;

		int tmp, m = 1000;
		for(int z = 0; z <= tmpz; z++) {
			for(int y = 0; y <= min(tmpm - z, int(pow(e - pow(z, 3), 1.0 / 2.0))); y++) {
				int x = e - pow(y, 2) - pow(z, 3);
				tmp = x + y + z;
				if(tmp < m) {
					m = tmp;
				}
			}
		}

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