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>
using namespace std;

int solve(int E)
{
    int ans=E;
    int x;
    for(int z=0;z*z*z<=E;z++)
       for(int y=0;y*y<=E-z*z*z;y++)
       {
           x=E-y*y-z*z*z;
           ans=min(ans,x+y+z);
       }
    return ans;
}

int main()
{
    int E;
    while(cin >> E && E>0)
         cout << solve(E) << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<n;i++)
int main(void){
    int n;
    while(cin>>n,n){
        int ans=10000000;
        for(int z=0 ;z*z*z<=n;z++){
            for(int y=0; y*y<=n-z*z*z;y++){
                ans=min(ans, n-z*z*z-y*y+y+z);
            }
        }
        cout<<ans<<endl;
    }
}

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



int main(){
	int e;
	int minimum = 0;
	cin >> e;
	while(e != 0){
		for(int z = 0; z * z * z <= e; z++)){
			for(int y = 0; y * y <= e; y++){
				if(ceil(e - y * y - z * z * z) == floor(e - y * y - z * z * z)){
					minimum = min(minimum, e - y * y - z * z * z + y + z);
				}
			}
		}
		cout << minimum << endl;
		cin >> e;
	}

	return 0;
}

C++: #define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#pragma comment (linker, "/STACK:526000000")

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(10);
}

#define int ll
void solve() {
	while (true) {
		int e;
		cin >> e;
		if (e == 0) return;
		int m = 1e9;
		for (int i = 0; i * i * i <= e; ++i) {
			int hoge = e - i * i * i;
			for (int q = 0; q * q <= hoge; ++q) {
				int tmp = hoge - q * q;
				if (tmp >= 0) {
					m = min(m, i + q + tmp);
				}
			}
		}
		cout << m << endl;
	}
}
#undef int

int main() {
	init();
	solve();
}

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

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

		int min = e;
		for(int i = 0; i * i * i <= e; i++){
			for(int j = 0; j*j+i*i*i <= e; j++){
				if(min > i + j + e - i*i*i - j*j){
					min = i + j + e - i*i*i - j*j;
				}
			}
		}
		cout << min << endl;
	}
}

C++: #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
	int e;
	while(cin>>e){
		if(e==0) break;
		int m=e;;
		for(int z=0;z<pow(e,0.3333334)+1;z++){
			for(int y=0;y<pow(e,0.5)+1;y++){
				for(int x=0;x<e+1;x++){
					if(x+y*y+z*z*z==e){
						m=min(m,x+y+z);
						break;
					}
					else if(x+y*y+z*z*z>e) break;
				}
			}
		}
		cout<<m<<endl;
	}
    return 0;
}

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

using namespace std;

int max(int ,int );

int main(void){
  int min,zzz,ez,ezy,x=0;
  long int e;
  cin >> e;
 
  while(e!=0){
    min=e;
    zzz = pow(e,1.0/3.0);
    for(int z=0;z<=zzz;z++){
      ez = e -z*z*z;
      for(int y=0;y*y <= ez ;y++){
	x = ez - y*y;
	if(x+y+z<min) min = x+y+z;
	//if(y>=min) y = e;
      }
    }
      
    cout << min << endl;
    cin >> e;
  }
  return 0;
}

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

using namespace std;

int INF = 10000000;

int cast(int e)
{
	
	

	 int Min = INF;

	 for(int i = 0;i <= 100;i++)
	 {
		 for(int j = 0;j <= 1000;j++)
		 {
			 int k = e - pow(i,3) - pow(j,2);
			 if(k >= 0)
			 Min = min(i+j+k,Min);
		 }
	 }


	return Min;
}


int main()
{

  while(1)
  {
	 int e;

	 cin >> e;
 
	 if(!e)break;
	
	 cout << cast(e) << endl;

  }

  return 0;
}

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

int e = 0;

int solve(){
    int x,y,z;

    int y_max, z_max;
    for(x=0; x<=e; ++x){
        for(y=0; y<=e; ++y){
            for(z=0; z<=e; ++z){
                if((x+y*y+z*z*z) == e){
                    return x + y + z;
                }
            }
        }
    }
    return 0;
}

int main(void){
    while(true){
        std::cin >> e;
        if(e == 0) break;
        std::cout << solve() << std::endl;
    }
}

C++: #include <iostream>
#include <vector>
#include <limits>
#include <algorithm>
#include <cmath>

using namespace std;

int count = 0; // ?¨???¬??¨ global ?????°
int solve(int E) {
	::count = 0;
	int ans = numeric_limits<int>::max(); // ?????§???
	for (int y=0; y*y<=E; ++y){
		for (int z=0; z*z*z<=E; ++z){
			++::count;
			int x = (int)round(E-y*y-z*z*z);
			if (x+y*y+z*z*z == E && x >= 0)
				ans = min(ans, x+y+z);
		}
	}
	return ans;
}
int main() {
	int E;
	while (cin >> E && E>0) {
		cout << solve(E) << endl;
		// cout << "case: m = " << E << " count: " << ::count << endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <assert.h>
#include <complex>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
ll cnt = 0;
ll inf = 1000001;
ll E;
ll solve(ll E) {
    ll ans = inf;
    for (ll z = 0; z * z * z <= E; ++z) {
        for (ll y = 0; y * y <= E; ++y) {
            // ll z = (ll) round(pow(E - x - y * y, 1.0 / 3));
            ++cnt;
            ll x = E - z * z * z - y * y;
            if (x >= 0) {
                ans = min(ans, x + y + z);
            }
        }
    }
    return ans;
}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    #define ll int;

    while (cin >> E) {
        if (E) {
            cout << solve(E) << endl;
        }
    }

    return 0;
}

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define P pair<int, int>
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())

int E;

int calc2(){
  int ans = 5000000;
  REP(z, 100){
    int y = (int)(floor(sqrt(E - z))), x = E - y - z;
    if(y >= 0 && x >= 0){
      cout <<x <<", " <<y <<", " <<z <<", " <<x + y + z <<endl;
      ans = min(ans, x + y + z);
    }
  }
  return ans;
}

int calc(){
  int ans = 5000000;
  for(int z = 100; z >= 0; --z){
    if((int)(pow(z, 3)) > E) continue;
    for(int y = 1000; y >= 0; --y){
      int tmp = ((int)(pow(z, 3)) + (int)(pow(y, 2)));
      if(tmp > E) continue;
      int x = E - tmp;
      //return x + y + z;
      ans = min(ans, x + y + z);
    }
  }
  return ans;
}

int calc1(){
  int ans = 1e9 + 7;
  REP(y, 1000){
    if((int)(pow(y, 2)) > E) continue;
    REP(z, 100){
      int tmp = ((int)(pow(z, 3)) + (int)(pow(y, 2)));
      if(tmp > E) break;
      int x = E - tmp;
      ans = min(ans, x + y + z);
    }
  }
  return ans;
}

int main() {
  while(cin >>E && E) cout <<calc1() <<endl;
  //while(cin >>E && E) cout <<calc() <<endl;
  //while(cin >>E && E) cout <<calc2() <<endl;
  return 0;
}