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++: // #define USE_CPP11
// #define USE_PRINTF

#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <utility>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <complex>
#include <memory>
#include <sstream>

#ifdef USE_CPP11
#include <unordered_map>
#include <unordered_set>
#include <functional>
#endif

#define PRINT(obj) cout << obj << endl
#define REP(i, n) for(int (i) = 0; (i) < (n); i++)
#define SPACE " "

typedef long long ll;

const int INF = 1e9 + 10;

using namespace std;

namespace Scanner {
#ifdef USE_PRINTF
  int    nextInt()    { int    d; scanf("%d" , &d); return d; }
  float  nextFloat()  { float  f; scanf("%f" , &f); return f; }
  double nextDouble() { double f; scanf("%lf", &f); return f; }  
  string nextString() { string s; scanf("%s" , &s); return s; }
  ll     nextll()     { ll     l; scanf("%ll", &l); return l; }
#else
  int    nextInt()    { int    d; cin >> d; return d; }
  float  nextFloat()  { float  f; cin >> f; return f; }
  double nextDouble() { double f; cin >> f; return f; }  
  string nextString() { string s; cin >> s; return s; }
  ll     nextll()     { ll     l; cin >> l; return l; }
#endif

  string getLine() { 
    string input;
    getline(cin, input);
    return input;
  }
};

namespace myLibrary {
  vector<string> split(const string& str, char delim) {
    vector<string> ret;
    size_t current = 0, found;
    while ((found = str.find_first_of(delim, current)) != string::npos) {
      ret.push_back(string(str, current, found - current));
      current = found + 1;
    }
    ret.push_back(string(str, current, str.size() - current));
    return ret;
  }
  
#ifdef USE_CPP11
  ///
  /// higher-order functional
  /// This is something like map in haskell, python, etc.
  /// Sample usage:
  ///   vector<int> a = {1, 2, 3, 4, 5};
  ///   vector<int> b = myLibrary::_Map<int, int>(a, [](int n){
  ///     return n * n;
  ///   });
  /// Result:
  ///   b = 1, 4, 9, 16, 25
  ///
  template<typename T_IN, typename T_OUT, class Functor>
  vector<T_OUT> _Map(vector<T_IN> src, Functor func) {
    vector<T_OUT> ret;
    for (int i = 0; i < src.size(); i++) {
      ret.push_back(func(src[i]));
    }
    return ret;
  }
#endif

};

struct Point {
public:
  int y, x;
  Point(int y, int x): y(y), x(x) { }
  Point() { }
};

/// BEGIN //////////////////////////////////////////////////////////

int main() {
  while (true) {
    int e = Scanner::nextInt();
    if (e == 0) {
      break;
    }

    int ans = 1000000;
    for (int z = 0; z <= 100; z++) {
      for (int y = 0; y <= 1000; y++) {
        int t = z * z * z + y * y;
        int x = e - t;
        if (x >= 0) {
          ans = min(ans, (x + y + z));
        }
      }
    }

    PRINT(ans);
  }
  return 0;
}

/// END   //////////////////////////////////////////////////////////

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

C++: #include<stdio.h>

int main(){
	long long E, sum=1000000;
	int y,z;
	long long x= E-z*z*z-y*y;
	while(scanf("%lld",&E)){
	if(E==0)break;
	for(z=0;z*z*z<=E;z++)
		for(y=0;y*y<=E;y++){
			if(z*z*z+y*y>E)break;
			else if(sum>x+y+z)sum=x+y+z;
			}
		printf("%lld\n",sum);
	}
        return 0;
}

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

int getMinM(int e){
	int mini=INT_MAX;
	for(int y=0;y*y<=e;y++){
		for(int z=0;z*z*z<e;z++){
			int x = e - ( pow(y,2) + pow(z,3) );
			if(x>=0) mini = min(mini,x+y+z);

		}
	}
	return mini;
}

int main(){
	while(1){
		int e;
		cin >> e;
		if(e==0) break;
		cout << getMinM(e) << endl;
	}
	return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

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

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


int main() {
	int e;
	while (cin >> e && e>0) {
		int y=0;
		int z=0;
		int sum=0,summin=e; // min: NOTICE how we initialize it

		while (y*y+z*z*z<e) { // third power of something
			while (y*y+z*z*z<e) {
				int x= e-y*y-z*z*z;	
				sum = x+y+z;
				if (sum < summin) summin = sum;
				++z;
			}
			++y;
		}
		cout << summin << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<sstream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<climits>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; i++)
#define FOR(i, j, k) for(int i = j; i < k; i++)
#define P pair<int, int>
const int INF = INT_MAX / 2;

int main(){
    int e;
    while(cin >>e && e){
        int ans = INF;
        int x, y, z;
        REP(i, e + 1){
            REP(j, e + 1){
                REP(k, e + 1){
                    x = k;
                    y = j * j;
                    z = i * i * i;
                    if(x + y + z > e) break;
                    if(x + y + z != e) continue;
                    ans = min(ans, i + j + k);
                }
                if(y + z > e) break;
            }
            if(z > e) break;
        }
        cout <<ans <<endl;
    }
    return 0;
}

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

int main()
{
  int e, x;
  while(cin >> e && e > 0){
    int m = 1e6;
    for(int z=0; z<=1e2; z++){
      for(int y=0; y<=1e3; y++){
        x = e - z*z*z - y*y;
        if(x < 0){
          continue;
        }
        if(x+y+z<m){
          m = x + y + z;
        }
      }
    }
    cout << m << endl;
  }
  return 0;
}

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

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

C++: //#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>
#include <climits>

using namespace std;
using ll=long long;

void solve(){
  while(true){
    int e;
    cin >> e;
    if(e==0)return;
    int res=e;
    for(int i=0;i<e;i++){
      ll z=(ll)i*i*i;
      if(z>e)break;
      for(int j=0;j<=e-z;j++){
        ll y=(ll)j*j;
        if(y+z>e)break;
        int x=e-y-z;
        res=min(res,x+j+i);
      }
    }
    cout << res << "\n";
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}