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 <cstdio>
#include <utility>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
//bool scan(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
#undef vo

int main() {
	for (int e, m; (e = m = in());) {
		for (int z = cbrtf(e); z >= 0; z--) {
			int te = e - z * z * z;
			int y = (int)sqrt(te);
			int tm = z + y + te - y * y;
			if (z + y > m)
				break;
			m = min(m, tm);
		}
		out(m, '\n');
	}
}

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

int main() {
	int e, m, a, x;
	double c, d;
	while (true) {
		cin >> e;
		if (e == 0) break;
		m = 90000000;

		c = pow(e, 1.0 / 3.0);
		d = sqrt(e);
		for (int z = 0; z <= c + 100; z++) {
			for (int y = 0; y <= d + 100; y++) {	
				x = e - y*y - z*z*z;
				if (x < 0) break;
				else {
					a = x + y + z;
					if (a < m) m = a;
				}
			}
		}

		cout << m << endl;
	}
	return 0;
}

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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;



int main(void) {
	
	while (1) {
		int e;
		bool flag = true;
		int mini = INF;

		cin >> e;
		if (e == 0) {
			break;
		}
		RFOR(z, cbrt(e), 0) {
			if (pow(z, 3) > e) {
				continue;
			}
			RFOR(y, sqrt(e-pow(z,3)), 0) {
				if (pow(y, 2) < e - pow(z, 3) - pow(y, 2)) {
					break;
				}
				if (pow(y, 2) > e - pow(z, 3)) {
					continue;
				}
				if (pow(y, 2) == e - pow(z, 3)) {
					mini = z + y;
					flag = false;
					break;
				}
				else {
					if (mini > z + y + e - pow(z, 3) - pow(y, 2)) {
						mini = z + y + e - pow(z, 3) - pow(y, 2);
					}
				}
			}
			if (flag == false) {
				break;
			}
		}
		cout << mini << endl;
	}

}

C++: #include <iostream>

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

const int INF = 10000000;
using namespace std;
typedef long long  ll;
const int MAX = 10000;

/** Problem2012 : Space Coconut Grab **/
int main()
{
	int e;
	int m=INF;
	
	while (cin>>e, e!=0) {
		m=INF;
		rep(i, 100) {
			rep(j, 100) {
				rep(k, 100) {
					if(i + j*j + k*k*k == e) {
						if (m>i+j+k) {
							m=i+j+k;
						}
					}
				}
			}
		}
		cout << m << endl;
	}
	return 0;
}

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

int main() {
	int e,x = 0,y = 0,z = 0,ans,n,i,j;
	while(1){
		ans = 100000;
		cin >> e;
		if(e == 0)break;
		i = 1;
		while(1){
		if(i*i*i > e)break;
		i++;
		}
		i--;
		for(;i >= 0;i--){
			n = e;
			n -= i*i*i;
			z = i;
			if(n == 0){
				ans = min(ans,z);
				continue;
			}
		for(j = 0;j*j < n;j++);
		j--;
		n -= j*j;
		y = j;
		if(n == 0){
			ans = min(ans, z+y);
			continue;
		}
		x = n;
		ans = min(ans,x+y+z);
		//cout << x << " " << y  << " " << z <<endl;
		}
		for(j = 0;j*j <= e;j++);
		j--;
		for(;j >= 0;j--){
			n = e;
			n -= j*j;
			if(n == 0){
				ans = min(ans,j);
			}
			else{
				ans = min(ans,j+n);
			}
		//cout << n << " " << j <<endl;
		}
	cout << ans << endl;
	}
	return 0;
}

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

using namespace std;

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

C++: /*
 * uchu_yashigani.cpp
 *
 *  Created on: 2017/02/13
 *      Author: Nishio
 */
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=n;i<N;i++)
#define p(S) cout<<S<<endl
#define mp(a,b) make_pair(a,b)
using namespace std;


int main(){
	int e;
	while(cin>>e,e){
		int mini=1000000;
		for(int x=0;x<=e;x++){
			for(int y=0;x+y*y<=e;y++){
				for(int z=0;x+y*y+z*z*z<=e;z++){
					if(x+y*y+z*z*z==e){
						mini=min(mini,x+y+z);
						x=1000001;
					}
				}
			}
		}
		p(mini);
	}
	return 0;
}

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

int main () {
  long long int e;
  cin >> e;
  long long int min = 0;
  int num = int(floor(pow(double(e), 1.0/3.0)));
  if (num == 1) {
    num = 0;
  }
  for (int i = 0; i < e - num*num*num + 1; i++){
    for (int k = 0; k < sqrt(e-num*num*num) + 1; k++){
      if (i + k*k == e - num*num*num) {
        if (min == 0) {
          min = num + i + k;
        } else if (min > num + i + k) {
          min = num + i + k;
        }
      }
    }
  }
  cout << min << endl;
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
#define int ll

signed main(void)
{
  while(true) {
    int n;
    cin >> n;
    if(!n) break;
    int ret = INF;
    for(int i=0; i*i*i<=n; ++i) {
      for(int j=0; j*j<=n; ++j) {
        int tmp = n - i*i*i - j*j;
        if(tmp >= 0) {
          ret = min(ret, i+j+tmp);
        }
      }
    }
    cout << ret << endl;
  }
  return 0;
}

C++: #include <stdio.h>
int main(void)
{
  int e,m;
  int i,j,k;
  for(;;)
    {
      scanf("%d",&e);
      m=e;
      if(e==0){break;}
      for(i=0;i<=e;i++)
	{
	  if(i>m){break;}
	  /*printf("i=%d",i);*/
	  for(j=0;j<=e-i;j++)
	    {
	      if(i+j>m){break;}
	      for(k=0;k<=e-j-i;k++)
		{
		  if(i+j+k>m){break;}
		  /*printf("%d",k);*/
		  if(i+(j*j)+(k*k*k)==e && i+j+k<m)
		    {
		      m=i+j+k;
		      /*printf("m1=%d\n",m);*/
		    }
		}
	    }
	}
      printf("%d\n",m);
    }
  return 0;
}

C++: #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int e;
	while (cin >> e, e) {
		int m=20000000;
		int x, y, z;
	
		for (z = 0; z*z*z <= e; z++) {
			for (y = 0; y*y + z*z*z <= e; y++) {
				x = e - (y*y + z*z*z);
				m = min(m, x + y + z);
			}
		}
		cout << m << endl;

	}
	return 0;
}

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

signed main(){
	while(true){
		int e=read();
		int ans=100000;
		int m;
		if(e==0) break;
		int z,y,x;
		for(z=1;z*z*z<e;z++){
		}
		for(y=1;y*y<e;y++){
		}
		for(int i=0;i<=z;i++){
			for(int j=0;j<=y;j++){
				if(e-i*i*i-j*j >= 0){
					x = e-i*i*i-j*j;
					ans = min(ans,x+j+i);
				}
			}	
		}
		
		cout << ans << endl;
		
	}
	
}