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 <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

typedef long long ll;
typedef pair<int, int> pii;

#define MAX 1000000

int main(void)
{
	int e;
	vector<pii> vs;
	for (int y = 0;; y++) {
		int k = y*y;
		if (k > MAX) break;
		for (int z = 0;; z++) {
			int l = z*z*z;
			if (k+l > MAX) break;
			vs.push_back(pii(k+l, y+z));
		}
	}
	while (cin >> e, e) {
		int ans = (1<<29);
		sort(ALL(vs));
		for (int x = 0; x <= max(e/3+1, 3); x++) {
			int e_x = e - x;
		
			int a = 0, b = vs.size();
			while (b - a > 1) {
				int m = (a+b)/2;
				if (vs[m].first >= e_x)
					b = m;
				else
					a = m;
			}
			if (vs[b].first == e_x)
				ans = min(ans, x+vs[b].second);
		}
		cout << ans << endl;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

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

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

int n;
void init(){
  n=0;
}

int input(){
  cin>>n;
  return n;
}

int solve(){
  for(int m=0;m<=n;m++){
    for(int i=0;i<=m;i++){
      for(int j=0;j<=m-i;j++){
        if(i*i*i+j*j+(m-i-j)==n){
          return m;
        }
      }
    }
  }
}




int main(){
  while(init(),input()){
    cout<<solve()<<endl;
  }
}

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

using namespace std;
int main() {
	int e;
	while(cin >> e && e > 0){
		int min_sum = 100000;
		for(int i = 0; i <= e; i++)
		{
			for(int j = 0; j <= e; j++)
			{
				for(int k = 0; k <= e; k++)
				{
					if(i+j*j+k*k*k == e)
					{
						int temp;
						temp = i + j + k;
						min_sum = min(temp, min_sum);
					}
				}
			}
		}
		cout << min_sum << endl; 
	}
	
}

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

int main(){
    while(true){
        int e;
        int f;
        int ans=1000000;
        cin >> e;
        if(!e) break;
        for(int i=0;i<=100;++i){
            f = e - i*i*i;
            if(f < 0) break;
            for(int j=0;j<=1000;++j){
                if(j*j > f){
                    ans = min(ans, f-(j-1)*(j-1)+j-1+i);
                    break;
                }
            }
        }
        cout << ans << endl;
    }
}

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

using namespace std;

int main() {

  int e,x,y,z;

  for(;;){
    cin >> e;
    if(!e)break;
    int xm = e+1;
    int ym = (int)sqrt(e)+1;
    int zm = (int)cbrt(e)+1;

    int f,g2,g3,m=3*e;
    for(int i=zm;0<=i;--i){
      for(int j=0;j<=ym;++j){
	if(i*i*i+j*j<=e){
	  int k=e-i*i*i-j*j;
	  f=i+j+k;
	  if(f<m)m=f;
	}
      }
    }
    
    cout << m << endl;
  }
  
}

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

#define ll long long
#define inf 1000000000
using namespace std;


int e;

int yy(int a){
		int i=0;
		while(i*i<=a){
				if(i*i==a)return i;
				i++;
		}
		return inf;
}

int zzz(int a){
		int i=0;
		while(i*i*i<=a){
				if(i*i*i==a)return i;
				i++;
		}
		return inf;
}

int main(){
		while(cin>>e,e){
				int ans=inf;
				for(int i=0;i<=e;i++){
						for(int j=0;j<=e;j++){
								if(i+j<=e){
										ans=min(ans,i+yy(j)+zzz(e-i-j));
								}	
						}
				}
				cout<<ans<<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 tmp, m = 10000000;
		for(int z = pow(e, 1.0 / 3.0); z >= 0; z--) {
			for(int y = pow(e - pow(z, 3), 1.0 / 2.0); y >= 0; y--) {
				for(int x = e - pow(z, 3) - pow(y, 2); x >= 0; x--) {
					if(x + pow(y, 2) + pow(z, 3) == e) {
						tmp = x + y + z;
						if(tmp < m) {
							m = tmp;
						}
					}
				}
			}
		}

		/*int x, y, z
		z = pow(e, 1.0 / 3.0);
		e = e - pow(z, 3);
		if(e == 0){
			y = 0; x = 0;
		}else{
			y = pow(e, 1.0 / 2.0);
			e = e - pow(y, 2);
			if(e == 0){
				x = 0;
			}else{
				x = e;
			}
		}

		int m = x + y + z;
		cout << x << " " << y << " " << z << endl;*/
		cout << m << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> Pii;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

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

}

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

#define INF 1e9

int main(){
  int e;
  while(true){
    cin >> e;
    if(e == 0)
      break;

    int y, sum, nmin = INF;
    for(int i=0; i<=cbrt(e); i++){
      sum = e - i*i*i;
      y = sqrt(sum);
      sum -= y*y;
      nmin = min(nmin, sum + y + i);
    }
    cout << nmin << endl;
  }
  
  return 0;
}

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

int main(int argc, char const *argv[]) {
	int count = pow(10,6);
	for (int i = 0; i < count; i++) {
		int e = 0;
		cin >> e;
		if (e == 0){
			return 0;
		}
		int min = e;
		for (int z = 0; z*z*z <= e; z++) {
			for (int y = 0; y*y <= e - z*z*z; y++) {
				int x = e - y*y - z*z*z;
				int m = x + y + z;
				if (m < min){
					min = m;
				}
			}
		} //
		cout << min << endl;
	} //
	return 0;
}

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;
	while(cin>>n,n){
		int mi=inf;
		rep(i,110)rep(j,1010)mi=min(mi,(n<i*i*i+j*j?inf:i+j+n-i*i*i-j*j));
		cout<<mi<<endl;
	}
}