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>
#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 < 1000; 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 <stdlib.h>
using namespace std;
int main()
{
  int E,tmp,z,y,x,i;
  cin >> E;
  if (E<0 || E>1000000){
    cout << "Incorrect input" << endl;
    exit(1);
  }
  for (i=0;i*i*i<E;i++){
  }
  i--;
  z=i;
  tmp = E-z*z*z;
  for (i=0;i*i<tmp;i++){
  }
  i--;
  y=i;
  x=tmp-y*y;
  cout << x+y+z << endl;
}

C++: #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
  int E,tmp,z,y,x,i;
for(;;){
  cin >> E;
  if (E<0 || E>1000000){
    cout << "Incorrect input" << endl;
    exit(1);
  }
  for (i=0;i*i*i<E;i++){
  }
  i--;
  z=i;
  tmp = E-z*z*z;
  for (i=0;i*i<tmp;i++){
  }
  i--;
  y=i;
  x=tmp-y*y;
  cout << x+y+z << endl;
}
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

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

    int min_m = e;

    for (int z = 0; z * z * z <= e; z++) {
      int ez = e - z * z * z;
      for (int y = 0; y * y <= ez; y++) {
	int x = ez - y * y;
	int m = x + y + z;
	if (min_m > m) min_m = m;
      }
    }

    cout << min_m << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <array>
#include <vector>

using namespace std;

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

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

C++: #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;


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

	cin >> N;
	while (N) {
		M = INT_MAX;
		for (int i = 0; i <= 100; i++) {
			for (int j = 0; j < 1000; j++) {
				if (N - i*i*i - j*j >= 0) {
					M = min(M, i + j + N - i*i*i - j*j);
				}
			}
		}
		cout << M << endl;
		cin >> N;
	}
	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 = 0; z <= pow(e, 1.0 / 3.0); z++) {
			for(int y = 0; y <= pow(e - pow(z, 3), 1.0 / 2.0); y++) {
				for(int x = 0; x <= e - pow(z, 3) - pow(y, 2); 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++: //Space Coconut Grab
#include<bits/stdc++.h>
using namespace std;

#define INF 10000000
typedef long long ll;

//x^t
ll mypow(ll x, ll t){
  return (ll)pow((double)x, (double)t);
}

ll ans[1000001];

int main(){
  for(ll i=0; i<=1000000; i++)ans[i]=INF;
  for(ll z=0; mypow(z, 3)<=1000000; z++){
    ll tmp;
    for(ll y=0; (tmp=mypow(z,3)+mypow(y,2))<=1000000; y++)
      if(ans[tmp]>y+z)
        ans[tmp]=y+z;
  }
  while(true){
    ll e;
    cin>>e;
    if(e==0)break;
    ll mn=INF;
    for(int i=0; i<=e; i++)
      if(mn>ans[i]+(e-i))mn=ans[i]+(e-i);
    cout<<mn<<endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int x,y,z;
int e;
int solve(){
	int minsum = 1000000;
	for (z=0;z*z*z<=e;z++)
	{
		for(y=0;y*y+z*z*z<=e;y++)
		{
				for(x=0;x+y*y+z*z*z<=e;x++)
				{
					if(x+y*y+z*z*z == e)
					{
						int temp = x+y+z;
						minsum = min(minsum,temp);
					}
				}
		}
	}
	return minsum;
};
int main(){
	int A[100000];
    int k = 0;
	while( cin>>e && e>0 )
	{
		A[k]=solve();
        k++;
	}
	for(int l = 0;l < k; l++)
    {
        cout<<A[l]<<endl;
    }
	return 0;
}

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

int mycount = 0; // ambigous??¨???????????????????????????
int solve(int E) {
 // ?????´????±???????
	int ans = 1000000; // ?????§???
	for (int z=0; z*z*z<=E; ++z)
		for (int y=0; y*y<=E; ++y){
			int x = E-z*z*z-y*y;
				++mycount; 
				if (x+y*y+z*z*z == E)
					if (x+y+z<=ans)
						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 int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i,n) for(int i = 0;i < n; i++)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e18;

#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}


signed main(){
	IOS();
	vector<int>ans;
	while(1){
		int e;
		cin>>e;
		if(e==0)break;
		int mi = INF;
		rep(i,0,111){
			rep(j,0,1111){
				if(i*i*i+j*j>e)continue;
				int k = e-i*i*i-j*j;
				chmin(mi,i+j+k);				
			}
		}
		ans.push_back(mi);
	}
	for(auto e:ans){
		cout<<e<<endl;
	}
}