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 <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;}

int hoge(int e){

  int num;

  REP(a,100){
	REP(b,100){
	  REP(c,100){
		num = a + b*b + c*c*c;
		//		cout << num << endl;
		if(num > e) break;
		if(num == e) return (a + b + c);
		
	  }
	}
  }  
	return -1;
}

int main(){

  int e;

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

	cout << hoge(e) <<endl;

  }
}

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

int main() {
    long long int e;
    while (cin >> e && e != 0) {
        int vmin = -1;
        for (int xi = 0; xi <= e; ++xi) {
            for (int zi = 0; zi <= pow(e, 1.0/3.0); ++zi) {
                int yi2 = e - xi - zi*zi*zi;
                if (yi2 < 0) continue;
                int yi = sqrt(yi2);
                if (xi+yi*yi+zi*zi*zi == e) {
                    if (vmin == -1) vmin = xi+yi+zi;
                    else vmin = min(vmin, xi+yi+zi);
                }
            }
        }
        cout << vmin << endl;
    }
}

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

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef complex<double> P;
static const double EPS = 1e-8;
static const int INF = (int)1e8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOREQ(i,k,n) for (int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FIND(m,w) ((m).find(w)!=(m).end())

int main(void){
  int e;
  while(cin>>e){
    int my = sqrt(e);
    int mz = pow(e,1.0/3.0);
    int ans = INF;
    for(int y = 0; y<=my; y++){
      for(int z = 0; z<=mz; z++){
        int x = e - y*y - z*z*z;
        if(x<0) break;
        ans = min(ans,x+y+z);
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

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

int main(){
  while(true){
    int min_m = 100000000;
    int e;
    cin >> e;
    if( e == 0 ) break;
    for(int z = 0; z <= 100; ++z){
      for(int y = 0; y <= 1000; ++y){
	int x = e -  (int)pow((double)z,3) - (int)pow((double)y,2);
	if( x >= 0 )
	  min_m = min( min_m, x + y + z );
      }
    }
    cout << min_m << endl;
  }
  return 0;
}

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

int count = 0; // count the number of iterations
int solve(int E) {
  int ans = E;
  for (int y = 0; y*y <= E; ++y)
    for (int z = 0; z*z*z <= E; ++z){
      ++count; // Minimum number of counts when the looping is minimized; loop y and z thus.
      int x = (int) round(E-y*y-z*z*z);
      
      if (x + y*y + z*z*z == E)
	ans = min(ans, x + y + z);
    }
return ans;
}
int main() {
  int E;
  while (cin >> E && E>0) {
    cout << solve(E) << endl;
  }
}

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) && z >= 0){
				int z2 = z;
				ans = min(ans, x + y + z2);
			}
		}
	return ans;
}
*/

//y z x

int solve(int E) {
	int ans = 1000000;
	for (int y = 0; y * y <= E; y++)
		for (int z = 0; z * z * z <= E; z++){
			int x = E - y * y - z * z * z;
			counter++;
			if (x >= 0)
				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 = sqrt(E - x - z * z * z);
			counter++;
			if (ceil(y) == floor(y) && y >= 0){
				int y2 = y;
				ans = min(ans, x + y2 + 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<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n;
	cin>>n;
	int mi=inf;
	rep(i,110)rep(j,1010){
		int k=n-i*i*i-j*j;
		if(k<0)continue;
		mi=min(mi,i+j+k);
	}
	cout<<mi<<endl;
}

C++: #include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int e;
	while(cin >> e && e){
		int ans = (1<<23);
		for(int z = 0; z*z*z<=e;z++)
			for(int y=0;y*y <= e-z*z*z;y++)
				ans = min(ans,z+y+e-z*z*z-y*y);
		cout << ans << endl;
	}
}

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

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)

using namespace std;

template <typename T>
void show_all(T t) {
  rep (i, t.size()) {
    rep (j, t[0].size()) {
      cout << t[i][j];
    }
    cout << endl;
  }
}

int main() {
  int e;
  while (1) {
    cin >> e;
    if (!e) break;

    // greedy(O(3*N)?): WA
    // int i;
    // int x, y, z;
    // for (i=0; pow(i, 3) <= e; i++) {}
    // z = i-1;
    // e -= pow(z, 3);
    //
    // for (i=0; pow(i, 2) <= e; i++) {}
    // y = i-1;
    // e -= pow(y, 2);
    //
    // x = e;
    // cout << x+y+z << endl;
    //

    // O(N^2): TLE
    // int ans = 10000000 + 7;
    // for (int z=0; pow(z,3)<=e; z++) {
    //   for (int y=0; pow(z,3)+pow(y,2)<=e; y++) {
    //     int x = e - (pow(z,3)+pow(y,2));
    //     if (x + pow(y,2) + pow(z,3) != e) continue;
    //     ans = min(ans, x+y+z);
    //   }
    // }

    int ans = 10000000 + 7;
    for (int z=0; pow(z,3)<=e; z++) {
      int y = sqrt(e-pow(z,3));
      int x = e-pow(z,3)-pow(y,2);
      if (x + pow(y,2) + pow(z,3) != e) continue;
      ans = min(ans, x+y+z);
    }

    cout << ans << endl;
  }
}