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 <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll inf =1LL << 62;
int main(void){
	int n;
	while(cin >> n,n){
		int m=1 << 29;
		for(int i=0;i<=100;i++)
			for(int j=0;j<=1000;j++){
				int x=n-i*i*i-j*j;
				if(x>=0)
					m=min(m,x+i+j);
			}
		cout << m << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int energy;
  cin>>energy;
  while(energy!=0){
    int z_limit=1;
    int y_limit=1;
    while(z_limit*z_limit*z_limit<=energy){
      z_limit++;
    }
    z_limit--;
    while(y_limit*y_limit<=energy){
      y_limit++;
    }
    y_limit--;
    
    int sum;
    int minimum=energy;
    for(int i=z_limit;i>=0;i--){
      sum=i;
      for(int j=y_limit;j>=0;j--){
	if(i*i*i+j*j<=energy){
	  sum+=j;
	  sum+=energy-i*i*i-j*j;
	  minimum=min(minimum,sum);
	}
      }
    }
    cout<<minimum<<endl;
    cin>>energy;
  }
  return(0);
}

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

using namespace std;

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

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
int e;
int x,y,z;
int minm;
while(true){
cin>>e;
if(e==0)break;
minm=1000000;
for(int i=0;i<101;i++){
	for(int j=0;j<101;j++){
		for(int k=0;k<101;k++){
			if(e==(i+j*j+k*k*k))minm=min(minm,i+j+k);
		}
	}
}
cout<<minm<<endl;
}
return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int e;
    while(cin>>e&&e!=0){
        int minSum=100000000;
        for(int z = 0; z <= 100; z++){
            if(e-(z*z*z)<0)
                break;
            for(int y = 0; y <= 1000; y++){
                if(e-y*y-z*z*z<0)
                    break;
                int x=e-y*y-z*z*z;
                minSum=min(minSum,x+y+z);
            }
        }
        cout<<minSum<<endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
  while (true) {
    int e;
    scanf("%d", &e);
    if (e == 0) break;
    int m = (1 << 30);
    for (ll z=0;z*z*z<=e;z++) {
      const ll z3 = z*z*z;
      for (ll y=0;y*y+z3<=e;y++) {
        const ll x = e-(y*y+z3);
        m = min(m, (int)(x+y+z));
      }
    }
    printf("%d\n", m);
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>

#define INF 999999999
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define MOD(x) (x%(mod))
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int>pi;

/*---------------------------------------------------*/

int main(){
  int n;
  while(cin>>n){
    if(n==0)break;
    int mini=INF;
    rep(y,n){
      rep(z,n){
	int x=n-pow(y,2)-pow(z,3);
	if(x<0)continue;
	//cout<<x<<" "<<y<<" "<<z<<endl;
	mini=min(mini,x+y+z);
      }
    }
    cout<<mini<<endl;
    
  }
  return 0;
}

C++: #include<cmath>
#include<cctype>
#include<cstdlib>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<deque>
#include<string>
#include<queue>
#include<map>
#include<set>
#include<utility>
#include<queue>
#include<limits>
typedef long long ll;
using namespace std;
#define mp(a,b) make_pair(a,b)
#define rep(i,n) for (size_t i = 0; i < (n); ++i)
/*
  m = y+z + (e- y^2 - z^3)
  = e + y -y^2 + z- z^3;
*/



int main(){
  int e;
  while(  cin >> e and e != 0){
    int ans = e;
    for(int z = 0;z < 101;z++){
      int m = e;
      m -= z*z*z;
      if(m < 0)break;
      for(int y = 0;y < 1000;y++){
	int m2 = m;
	m2 -= y*y;
	if(m2 < 0)break;
	ans = min(m2+y+z,ans);
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main(){
    int e;
    
    while(cin >> e,e){
        //x+y^2+z^3=e
        int ans = INF;
        
        for(int z = 0 ; z*z*z <= e ; z++){
            for(int y = 0 ; y*y <= e ; y++){
                for(int x = 0 ; x <= e ; x++){
                    if(x+(y*y)+(z*z*z)==e) ans = min(ans,x+y+z);
                }
            }
        }
        
        cout << ans << endl;
    }
    
    return 0;
}

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

int main(void){

  int e;

while(1){
    cin >> e;
    int ans = e;
    if(e == 0) break;
      for(int y=0; y <= sqrt(e); y++){
	for(int z=0;z <= cbrt(e); z++){
	int x = e - y*y - z * z * z;
	  if(e == x + y*y + z*z*z && x >= 0){
	    ans = min(ans,x+y+z);
	    //cout << x << ' ' << y << ' ' << z << endl;
	  }
	}
      }

    cout << ans << endl;

 }
  return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <list>
using std::cout;
using std::cin;
using std::endl;
using std::cerr;
int pow(int base,int exponent){
  if(exponent==0){
    return 1;
  }
  int result=base;
  for(int i=1;i<exponent;i++){
    result*=base;
  }
  return result;
}
void solve(int e){
  int result=1000001;
  int x=0,y=0,z=0;
  for(y=0;pow(y,2)<1000001;y++) {
    for (z = 0; pow(z, 3) < 1000001; z++) {
      int x = e - pow(y, 2) - pow(z, 3);
      if (x < 0) continue;
      result = std::min(result, x + y + z);
    }
  }

  cout<<result<<endl;
}

int main(void){
  while(1){
    int e;
    cin>>e;
    if(e==0) break;
    solve(e);
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int e;
	while (1){
		cin >> e;
		int m = 1000000;
		if (e == 0) break;
		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;
				if (m > x + y + z) { m = x + y + z; }
			}
		}
		cout << m << endl;
	}
	return 0;
}