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<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back 
#define pf push_front 
#define mp make_pair
#define fr first
#define sc second
#define Rep(i,n) for(int i=0;i<(n);i++)
#define All(v) v.begin(),v.end()
typedef pair<int, int> Pii; typedef pair<int, Pii> Pip;
const int INF = 1107110711071107;


main()
{
  int e;
  while( cin >> e, e ) {
    /*int m = 0;
    int ans;
    int sum = 0;
    
    for(int i=0; ; i++) {
      if( pow(i, 3) > e ) { sum += pow(i-1, 3); m += i-1; break; }
    }
    
    for(int i=0; ; i++) {
      if( pow(i, 2) > e-sum ) { sum += pow(i-1, 2); m += i-1; break; }
    }
    
    ans =  m + e-sum;
    
    m = sum = 0;

    for(int i=0; ; i++) {
      if( pow(i, 2) > e ) { sum += pow(i-1, 2); m += i-1; break; }
    }
    
    for(int i=0; ; i++) {
      if( pow(i, 3) > e-sum ) { sum += pow(i-1, 3); m += i-1; break; }
    }
    
    cout << min( ans, m + e-sum ) << endl;
    */
    int mi = INF;
    for(int i=0; i<100; i++) {
      for(int j=0; j<100; j++) {
	for(int k=0; k<100; k++) {
	  if( i + j*j + k*k*k == e ) {
	    if( mi > i + j + k ) {
	      mi = i + j + k;
	    }
	  }
	}
      }
    }

    cout << mi << endl;
    
  }
  
}

C++: #include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <ctime>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <deque>
#include <complex>
#include <string>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <valarray>
#include <iterator>
using namespace std;
typedef long long int ll;
typedef unsigned int uint;
typedef unsigned char uchar;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();i++)
#define ALL(container) container.begin(), container.end()
#define RALL(container) container.rbegin(), container.rend()
#define SZ(container) ((int)container.size())
#define mp(a,b) make_pair(a, b)
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"["; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"]"; return os;
}
template<class T> ostream& operator<<(ostream &os, const set<T> &t) {
os<<"{"; FOR(it,t) {if(it!=t.begin()) os<<","; os<<*it;} os<<"}"; return os;
}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const int INF = 1<<28;
const double EPS = 1e-8;
const int MOD = 1000000007;


int n;

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

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

int main(){

  while(cin >> E){
    if ( E == 0) break;
    int min = 1000001; 
    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 + y + z < min ) min = x + y + z ;
      }
    }
    cout << min << endl;
  }
return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll e;
    while(cin >> e,e){
        ll m=e;
        for(int y=0;y*y<=e;y++){
            for(int z=0;z*z*z+y*y<=e;z++){
                m=min(m,y+z+(e-(ll)pow(y,2)-(ll)pow(z,3)));
            }
        }
        cout << m << endl;
    }
}

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

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

C++: #include <iostream>
#include <algorithm>
#include <string>

using namespace std;


int main(){
        int E;
        while(cin >> E && E){
                int m=1000000;
                for(int z=0; z*z*z<=E; ++z){
                        for(int y=0; y*y+z*z*z<=E; ++y){
                                int x = E-z*z*z-y*y;
                                m = min(m,x+y+z);
                        }
                }
                cout << m << endl;
        }

}

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

int solve (int e) {
  long long int min = e;
  for (long long int l=e + 1; l >= 0; l--) {
    for (long long int k = e - l*l*l + 1; k >= 0; k--) {
      for (long long int i = e - l*l*l - k*k + 1; i >= 0 ; i--) {
        if (i + k*k + l*l*l == e && min > i + k + l) {
          min = i + k + l;
          break;
        }
      }
    }
  }
  for (long long int l=e + 1; l >= 0; l--) {
    for (long long int k = e - l*l + 1; k >= 0; k--) {
      for (long long int i = e - l*l - k*k*k + 1; i >= 0 ; i--) {
        if (i + k*k*k + l*l == e && min > i + k + l) {
          min = i + k + l;
          break;
        }
      }
    }
  }
  return min;
}

int main () {
  long long int e;
  cin >> e;
  if(e == 0){
    return 0;
  }
  cout << solve(e) << endl;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
#define pb push_back
#define mp make_pair
typedef long long ll;
using namespace std;
typedef pair<int, int> P;

string getReverse(string str);
bool isLeap(int y);
ll gcd(ll a, ll b);
ll lcm(ll a, ll b);
double distanceAB(double xa, double ya, double xb, double yb);
void trace(int A[], int N);

/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/



int main()
{
	int e;
	
	while (cin >> e, e)
	{
		int res = 1e8;
		for (int i=0; i*i*i<=e; i++)
		{
			for (int j=0; j*j<=e-i*i*i; j++)
			{
				res = min(res, i + j + e-i*i*i - j*j);
			}
		}
		
		cout << res << endl;
	}
	
	return 0;
}


string getReverse(string str)
{
	string ret = "";
	for (int i=str.length()-1; i>=0; i--)
	{
		ret += str.substr(i, 1);
	}
	return ret;
}

bool isLeap(int y)
{
	return y % 400 == 0
						? true : y % 100 == 0
						? false : y % 4 == 0
						? true : false;
}

ll gcd(ll a, ll b)
{
	return (b > 0) ? gcd(b, a % b) : a;
}

ll lcm(ll a, ll b)
{
	return a / gcd(a, b) * b;
}

void trace(int A[], int N)
{
	REP(N)
	{
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
}

double distanceAB(double xa, double ya, double xb, double yb)
{
	return sqrt((xb-xa)*(xb-xa) + (yb-ya)*(yb-ya));
}