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>
using namespace std;
int calcOver(int, int);
int calcM(int, int ,int);

int main() {
  while(true) {
    int e;
    cin >> e;
    if(e == 0) break;
    int y = 0;
    int z = 0;
    int maxover = 0;
    int limity = pow(e, 1.0 / 2.0);
    int limitz = pow(e, 1.0 / 3.0);
    int maxy = limity;
    int maxz = limitz;
    int minm = e;
    //cout << limity << ":" << limitz << endl;
    for(y = limity; y >= 0; --y) {
      for(int z = limitz; z >= 0; --z) {
        int over = calcOver(y, z);

        //cout << y << ":" << z << ":" << over << endl;
        if(e >= over) {
        int m = calcM(e, y, z);
          //cout << "ok" <<endl;
          //if(maxover <= over && ((maxy + maxz) >= (y + z))) {
          if(minm > m) {
          //cout << "ok" <<endl;
            maxy = y;
            maxz = z;
            //maxover = over;
            minm = m;
          }
          
        }
      }
    }
    //cout << maxy << ":" << maxz << endl;
    cout << (e - pow(maxy, 2) - pow(maxz, 3) + maxy + maxz) << endl;
  }
  return 0;
}

int calcOver(int y, int z) {
  return (pow(y, 2) + pow(z, 3));
}
int calcM(int e, int y, int z) {
  return (e - pow(y, 2) - pow(z, 3) + y + z);
}

C++: #include<iostream>

int main(void) {
    int e = 0;
    while(std::cin >> e) {
        int result = 1000000;
        if(e == 0) {
            break;
        }
        for(int z = 0; z <= 100; z++) {
            const int Z = z*z*z;
            if(Z > e) {
                break;
            }
            for(int y = 0; y <= 1000; y++) {
                const int Y = y*y;
                if(Z + Y > e) {
                    break;
                }
                int X = e - Z - Y;
                result = std::min(result, X + Y + Z);
            }
        }
        std::cout << result << std::endl;
    }
    return 0;
}

C++: #include <stdio.h>
#include <vector>

using namespace std;
int solve(int e)
{
    int minsum=10000000;
    for(int z=0;z*z*z<=e;z++)
    {
        for(int y=0,lim=e-z*z*z;y*y<lim;y++)
        {
            int x=e-y*y-z*z*z;
            if(minsum>x+y+z)
            {
                minsum=x+y+z;
            }
        }
    }
    return minsum;
}
int main(void)
{
    int e;
    while(scanf("%d",&e)==1 && e)
    {
        printf("%d\n",solve(e));
    }
    return 0;
}

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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


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

C++: #include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define rep(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
 
using namespace std;
 
 
int main(){
  int e;
  while(cin>>e,e){
		int not_dp = 10000000;
        for(int i = 0;i*i*i<=e;i++){
					for(int j = 0;j*j+i*i*i<=e;j++){
						int x = e - i*i*i - j*j;
						not_dp = min(not_dp,x+i+j);
					}
				}
				cout << not_dp << endl;
  }
  return 0;
}

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

int Bsearch(int e,int n){
  //cout << n << endl;
  int l=0,r=e;
  int i=(l+r)/2;
  while(r-l>=1){
    i=(l+r)/2;
    //cout << "i:" << i << endl;
    if(e == pow(i,n)){
      //cout << "aaa:" << i << endl;
      return i;
    }else if(e > pow(i,n)){
      l=i+1;
    }else{
      r=i;
    }
  }
  //cout << "i:" << i << endl;
  return i;
}

int a[2000][2000];

int main(){
  int x,y,z,e;
  while(cin>>e,e){
    memset(a,0,sizeof(a));
    y=Bsearch(e,2);
    z=Bsearch(e,3);

    int m=1000000;
    //cout << "z:" << z << " y:" << y << endl;
    for(int i=0;i<=y;i++){
      for(int j=0;j<=z;j++){
	x=e-i*i-j*j*j;
	if(x>=0)m = min(x+i+j,m);
      }
    }
    cout <<m << endl; 
  }
}

C++: //b
#include <iostream>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <memory>
#include <functional>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>

#define REP(i,b,n) for(int i=b;i<n;i++)
#define REPR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#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 BIT(n, b) ((n>>b) & 1)
#define PB push_back
#define MP make_pair

using namespace std;

static const double PI = acos(-1.0);
static const double EPS = 1e-9;
typedef long long ll;
typedef pair<int, int> pii;	

int main(){
	
	ll e;
	
	while(cin>>e, e){
	
		ll mn = LLONG_MAX/2 - 1;
		
		for(ll y=0; e - y*y >= 0; ++y){
			for(ll z=0; e - z*z*z >= 0; ++z){
				
				// x = e - y*y - z*z*z
				// m = e - y*y - z*z*z + y + z
				
				if( e - y*y - z*z*z >= 0){
					mn = min(mn, e - y*y - z*z*z + y + z);
				}
			}
		}
		
		cout << mn << endl;
	}
	
	return 0;	
}