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 <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>
#include <cassert>
#include <cstdio>

// #include <unordered_set>
// #include <unordered_map>

#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())

#define pb push_back
#define mp make_pair

int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}

typedef std::pair<int, int> P;
typedef long long ll;
typedef long double ld;

const int MOD = 1000000007;
const int INF = 1e9;
const ll LINF = INF * 1ll * INF;
const ld DINF = 1e200;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

using namespace std;

#define int long long

signed main(){
  

    ios::sync_with_stdio(false);
    cin.tie(0);
    //cin高速化

    int e;



    while(cin>>e){

        int ans=INF;

        if(e==0)break;

        for(int x=0;x*x*x<=e;x++){
            for(int y=0;y*y<=e;y++){
                int z=e-(x*x*x+y*y);
                if(z>=0){
                    ans=min(ans,x+y+z);                
                }
            }
        }
        cout<<ans<<endl;
    }
    
}

C++: #define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////

int main() {
	while (1) {
		ll e;
		rd(e);
		if (e == 0) break;
		ll ans = MAX_10p18;
		for (ll z = 0; z*z*z <= e; z++) {
			for (ll y = 0; z*z*z + y*y <= e; y++) {
				ll x = e - z*z*z - y*y;
				ans = min(ans, x + y + z);
			}
		}
		wrln(ans);
	}
	return 0;
}

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

int main() {
    int x, e;
    int min;

    while(cin >> e) {
        if (!e) break;
        min = e;
        for(int y = 0; y * y <= e; y++) {
            for(int z = 0; z * z * z <= e; z++) {
                x = e - y * y - z * z * z;
                if(x < 0) continue;
                if(x + y + z < min) min = x + y + z;
            }
        }
        cout << min << endl;
    }
}

C++: #include <iostream>
using namespace std;
int main()
{
    int e,ans;
    int x,y,z;
    while(1)
    {
        cin >> e;
        ans=e;
        if(e==0||e>1000000)
            break;
        else    for(y=0;y*y<=e;y++)
                    for(z=0;z*z*z<=e-y*y;z++)
                    {
                        x=e-y*y-z*z*z;
                        ans=min(ans,x+y+z);
                    }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cmath>

using namespace std;

int main(){
  int e,ee,m,x,y,z;
  while (true){
    cin >> e;
    if (!e)
      break;
    x = 0;
    y = 0;
    z = 0;
    m = e;
    while(e>=z*z*z){
      ee = e;
      ee -= z*z*z;
      y =  int(sqrt(ee));
      ee -= y*y;
      x = ee;
      if (m>x+y+z)
	m = x+y+z;
      z++;
    }
    z--;
    cout << m << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main() {

  int e,x;
  int max=0;
  cin >>e;
  while(1){
  if (e==0) break;
  for (int z=0; z*z*z<=e; ++z){
    for (int y=0; y*y+z*z*z<=e; ++y){
      x=e-y*y-z*z*z;
      if (max<x+y+z) max=x+y+z;
    }
  }
  }
  cout<<max<<endl;
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#define MAX 10000000L;
using namespace std;

int main()
{
	long e;
	while (cin >> e && e != 0)
	{
		long min_m = MAX;
		
		bool flag = false;
		for (long m = 1; m < 100; m++)
		{
			for (int z = 0; z <= m; z++)
			{
				for (int y = 0; y <= m - z; y++)
				{
					int x = m - z - y;
					if (e == x + y * y + z * z * z)
					{
						min_m = m;
						flag = true;
						break;
					}
				}

				if (flag)break;
			}

			if (flag)break;
		}

		cout << min_m << endl;
	}


	return 0;
}

C++: #include<iostream>
#include<math.h>
//#include<limits.h>
using namespace std;
int solve(int E)
{
  int ans =999999;
  for (int z=0; z*z*z<=E; z++)
    for (int y=0; y*y<=E; y++)
      {
	//cout<<"z="<<z<<" y="<<y<<endl;
	int x=E-z*z*z-y*y;
	//cout<<"x="<<x<<endl;
	//cout<<"x+y*y+z*z*z="<<x+y*y+z*z*z<<endl;
	if ((x+y*y+z*z*z == E)&&(x>=0))
	{

	  if((x+y+z)<ans)
	  {
	    ans=x+y+z;
	    cout<<"ans="<<ans<<endl;
	  }
	}
      }
  return ans;
}
int main()
{
  int E;
  while (cin >> E && E>0)
  {
    cout << solve(E) << endl;
  }
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int Bsearch(int n,int e){
  if(e==1)return 1;
  int s,t;
  s=0;t=e;
  int x=e/2;
  while(t-s>1){
    if(pow(x,n)<e){
      s=x;
    }else if(pow(x,n)>e){
      t=x;
    }else{
      break;
    }
    x=(s+t)/2;
  }
  return x;
}
 
int main(){
  int e;
  while(cin>>e){
    if(e==0)break;
    int x=Bsearch(3,e);
    int y=Bsearch(2,e);
    int minim=1000;
    for(int i=0;i<=x;i++){
      int z=i*i*i;
      for(int j=0;j<=y;j++){
	int x=e-z-j*j;
	if(x<0)break;
	minim=min(minim,i+j+x);
      }
    }
    cout << minim << endl;
  }
  return 0;
}

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

using namespace std;

int main(void) {
	int e;
	while(1) {
		cin >> e;
		if(e == 0) {
			break;
		}
		
		int tmpx, tmpy, tmpz, tmpe;
		tmpe = e;
		tmpz = pow(e, 1.0 / 3.0);
		tmpe = tmpe - pow(tmpz, 3);
		if(tmpe == 0){
			tmpy = 0; tmpx = 0;
		}else{
			tmpy = pow(tmpe, 1.0 / 2.0);
			tmpe = tmpe - pow(tmpy, 2);
			if(tmpe == 0){
				tmpx = 0;
			}else{
				tmpx = tmpe;
			}
		}
		int tmpm = tmpx + tmpy + tmpz;

		int tmp;
		for(int z = 0; z <= tmpz + 1; z++) {
			for(int y = tmpy; y <= min(tmpm - z, int(pow(e - pow(z, 3), 1.0 / 2.0))); y++) {
				int x = e - pow(y, 2) - pow(z, 3);
				tmp = x + y + z;
				if(tmp < tmpm) {
					tmpm = tmp;
				}
			}
		}

		cout << tmpm << endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int e,x,y,z,small ;
	z=0;
	small=1000000;
	while(cin >> e && e>0){
		while(z*z*z < 1000000){
			y = 0 ;
			while(y*y < 1000000){
				x = e-y*y-z*z*z;
				if(small > x+y+z && x > 0){
				small = x+y+z;
				}
			y = y+1;
			}
		z = z+1;
		}
	cout << small << endl ;
	}
}