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>
#include<climits>

using namespace std;

const int eMax = 1000000;

int main() {
  int e;
  while(cin>>e && e) {
    int ans = e;
    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;
	if(x+y+z < ans) {
	  ans = x+y+z;
	}
      }
    }
    /*
    int ans = INT_MAX;
    bool flag = false;
    for(int x=0; x<e; x++) {
      for(int y=0; y<=sqrt(e) && x+y*y<=e; y++) {
	int yy = y*y;
	for(int z=0; z<=pow(e,0.333)+1 && x+yy+z*z*z<=e; z++) {
	  int zzz = z*z*z;
	  if(x+yy+zzz==e && x+y+z<ans) {
	    ans = x+y+z;
	  }
	  if(flag == true) break;
	}
	if(flag == true) break;
      }
      if(flag == true) break;
    }
    */
    cout<<ans<<endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
int main()
{
    int e;
    cin >>e;

    while(e)
    {
        int x=0;
        int y=0;
        int z=0;
        int m=0;
     for(z=0;z<=e/9;z++)
        for(y=0;y<=e/2;y++)
        {
            x = e-z*z*z-y*y;
            if(x<0)
                continue;

                int t = x+y+z;
                if(m ==0||m>t)
                    m=t;
            }

        cout <<m<<endl;




        cin >>e;
    }
    return 0;
}

C++: #include <iostream>
#include <queue>
#include <vector>
#include <math.h>

using namespace std;

int main(){
	bool first;
	int min;
	int x, y, z, e,buf_z,buf_y;
	while (cin >> e){
		first = true;
		for (z = 0; (buf_z = pow(z, 3)) < e; z++)
		{
			for (y = 0; buf_z + (buf_y = pow(y, 2)) < e; y++)
			{
				x = e - buf_z - buf_y;
				if (first == true)
				{
					min = x + y + z;				
					first = false;
				}
				else if (min > x + y + z)
				{
					min = x + y + z;
				}
			}
		}
		cout << min << "\n";
	}
	return 0;
}

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

using namespace std;

int counter = 0;

//x y z
/*
int solve(int E) {
	int ans = 3000000;
	for (int x = 0; x <= E; x++)
		for (int y = 0; y * y <= E; y++){
			double z = cbrt(E - x - y * y);
			counter++;
			if (ceil(z) == floor(z)){
				int z = z;
				if (x + y * y + z * z * z == E)
					ans = min(ans, x + y + z);
			}
		}
	return ans;
}
*/

//y z x(fastest)

int solve(int E) {
	int ans = 3000000;
	for (int y = 0; y * y <= E; y++)
		for (int z = 0; z * z * z <= E; z++){
			double x = cbrt(E - y * y - z * z * z);
			counter++;
			if (ceil(x) == floor(x)){
				int x = x;
				if (x + y * y + z * z * z == E)
					ans = min(ans, x + y + z);
			}
		}
	return ans;
}


//z x y
/*
int solve(int E) {
	int ans = 3000000;
	for (int z = 0; z * z * z <= E; z++)
		for (int x = 0; x <= E; x++){
			double y = cbrt(E - x - z * z * z);
			counter++;
			if (ceil(y) == floor(y)){
				int y = y;
				if (x + y * y + z * z * z == E)
					ans = min(ans, x + y + z);
			}
		}
	return ans;
}
*/

//main

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


//count
/*
int main(){
	int E[] = {100, 10000, 1000000};
	for (int i = 0; i < 3; i++){
		counter = 0;
		solve(E[i]);
		cout << "E = " << E[i] << ", counter = " << counter << endl;
	}
}
*/

C++: #include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<sstream>
#include<iomanip>

using namespace std;

#define INF 999999999

int main(){
	int ans, i, j, k, e;
	while(1){
		cin >> e;
		if(!e)break;
		ans=INF;
		for(i=0;i*i*i<=e;i++){
			for(j=0;i*i*i+j*j<=e;j++){
				if(i+j+(e-i*i*i-j*j) < ans){
					ans = i+j+(e-i*i*i-j*j);
				}
			}
		}
		cout << ans << endl;
	}
	
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
int main(){
	int e;

	while(cin>>e,e){
	int m=0;
	vector<int>anss(0);
	for(int i=0;i<=e;i++){
		for(int j=0;j*j<=e;j++){
			for(int k=0;k*k*k<=e;k++){
				if(i+j*j+k*k*k<e)break;
				if(i+j*j+k*k*k==e)anss.push_back(i+j+k);
			}
		}
	}
		sort(anss.begin(),anss.end());
		cout<<anss[0]<<endl;
	}
	return 0;
}

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

int main(){
  int e;
  while(cin >> e,e){
    int x,y,z;
    int min = 10000;
    for(int i=0; i<=e; ++i){
      for(int j=0; j*j+i<=e; ++j){
	for(int k=0; k*k*k+j*j+i<=e; ++k){
	  if(e == i+j*j+k*k*k && min > i+k+j){
	    min = i+j+k;
	  }
	}
      }
    }

    cout << min << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int> PI;
#define MAX 1000009
int main(){
    int e;
    while(cin>>e,e){
        vector<PI> v3;
        for(int i =0;i<=100;i++){
            PI temp;
            temp.first=pow(i,3);temp.second=i;
            if(temp.first>e)break;
            v3.push_back(temp);
        }
        vector<PI> v2;
        for(int i=0; i<=10000;i++){
            PI temp;
            temp.first=pow(i,2); temp.second=i;
            if(temp.first>e)break;
            v2.push_back(temp);
        }
        PI min; min.first=INF; min.second=INF;
        for(int i=(int)v3.size()-1; i>=0;i--){
            if(v3[i].first==e){cout<<v3[i].second<<endl; goto E;}
            for(int j=(int)v2.size()-1; j>=0;j--){
                if(v2[j].first+v3[i].first>e)continue;
                if(v2[j].first==e){cout<<v2[j].second<<endl;goto E;}
                if(v2[j].first+v3[i].first==e){cout<<v2[j].second+v3[i].second<<endl; goto E;}
                if(v3[i].first+v2[j].first<e){
                    if(min.second>e-(v3[i].first+v2[j].first)+v3[i].second+v2[j].second){
                        min.second=v3[i].second+v2[j].second;
                        min.first=e-(v3[i].first+v2[j].first);
                    }
                }
            }
        }
        cout<<min.second+min.first<<endl;
    E:;
    }
    return 0;
}

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

int main(){
	int e;
	while(true){
		cin >> e;
		if(e==0){
			break;
		}
		int x=0,y=0,z=0;
		
		int ans = e;

		for(z=0;z*z*z <= e;z++){
			for(y=0;y*y+z*z*z <= e; y++){
				int buf = e - (y*y+z*z*z);
				ans = min(ans,buf+y+z);
			}
		}


		cout << ans <<endl;
		/*
		for(x=0;x<=e;x++){
			for(y=0;y*y+x<=e;y++){
				for(z=0;z*z*z+y*y+x<=e;z++){
					if(z*z*z+y*y+x==e){
						ans = min(ans,x+y+z);
					}
				}
			}
		}
		cout << ans << endl;
		*/
	}
}

C++: 

int main(){

  while(true){
    int min;
      
    cin >> e;
    min = e;
    
    if(e == 0)break;
    for (int x = 0; x <= e; ++x){
       for (int y = 0; y <= e; ++y){
	  for (int z = 0; z <= e; ++z){
	    if((x + y*y + z*z*z) == e){
	      if((x + y + z) <= min)min = x + y + z;
	      //cout << "xyz = " << x << " " << y << " " << z << " min = " << min << endl;
	    }
	  }
       }
    }
    cout << min << endl;
    
  }
}