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<math.h>
#include<stdio.h>
using namespace std;
int count1=0;
int solve(int E){
    double e=(double)E;
    double i,a=pow(e,1.0/3);
    i=round(a);
    int j=(int)a;
    int ans=E*round(sqrt(E))*j;
    for (int x=0;x<=E;++x){
        for (int y=0;y*y<=E;++y){
            for (int z=0;z*z*z<=E;++z){
                ++count1;
                if(x+y*y+z*z*z==E&&ans>(x+y+z)){
                    ans=x+y+z;
            
                }
            }
        }
    }
    return ans;
}
int main(){
    int E;
    while (cin>>E&&E>0){
        cout<<solve(E)<<endl;
    }
}

C++: #include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
signed main() {
  int e; cin >> e;
  while (e!=0) {
    int m = INF;
    for (int z = 0; z*z*z <= e; z++) {
      for (int y = 0; z*z*z+y*y <= e; y++) {
        m = min(m, e+y+z-y*y-z*z*z);
      }
    }
    cout << m << endl;
    cin >> e;
  }
}

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

int main(){
while(1){//start	
	
	int e;
	int ans = 10000000;
	cin >> e;
	
	if(e == 0) break;
	
	int x;
	for(int y = 0; y <= 1000; y++){
		for(int z = 0; z <= 100; z++){
			if(y*y + z*z > e)break;
			x = e - y*y - z*z*z;
			if(x + y*y + z*z*z > e) break;
			if(x >= 0 and x + y*y + z*z*z == e){
				ans = min(ans, x + y + z);
				//cout << "ans = " << ans << endl;
			}
		}
	}
	
	
	cout << ans << endl;
	
}//end	
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    int e;
    while(cin>>e&&e!=0){
        int minSum=100000000;
        for(int z = 0; z <= 100; z++){
            if(e-(z*z*z)<0)
                break;
            int y = (int)(sqrt((1.0)*e-z*z*z)+(1e-10));
            int x = e-z*z*z-y*y;
            minSum=min(minSum,y+z+x);
            //for(int y = 0; y <= 1000; y++){
            //    if(e-y*y-z*z*z<0)
            //        break;
            //    int x=e-y*y-z*z*z;
            //    minSum=min(minSum,x+y+z);
            //}
        }
        cout<<minSum<<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, m = 100000;
		for(int z = 0; z <= tmpm; z++) {
			for(int y = 0; 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 < m) {
					m = tmp;
				}
			}
		}

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

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

#define MAX 1000000

int main(void) {
	while(1) {
		int e, y, z, ans = MAX;

		scanf("%d", &e);
		if(!e) break;
		for(z = 0; z*z*z <= e; z++) {
			y = (int)sqrt((double)e - z*z*z);
			ans = min(ans, e - y*y - z*z*z + y + z);
		}
		printf("%d\n", ans);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
#ifdef DEBUG
#define line() cerr << "[" << __LINE__ << "] ";
#define dump(i) cerr << #i ": " << i << " ";
#define dumpl(i) cerr << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main(int argc, char const *argv[])
{
    ll e;
    while ((cin >> e), e != 0)
    {
        ll ans = e;
        for (ll i = 0; i * i * i <= e; i++)
        {
            for (ll j = 0; j * j <= e; j++)
            {
                if (i * i * i + j * j > e)
                {
                    break;
                }
                ll k = e - (i * i * i + j * j);
                ans = min(ans, i + j + k);
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
void solve(int n){
    vector<long long int> y,z;
    y.push_back(0);
    z.push_back(0);
    for(int i=1;i<1000;i++){
        y.push_back(i*i);
        z.push_back(i*i*i);
    }
    long long int ans=0;
    for(int i=0;1;i++){
        for(int j=0;pow(max((j-1),0),2)+i<n;j++){
            ans=0;
            for(int k=0;ans<=n;k++){
                ans=i+y[j]+z[k];
                //cout<<i<<" "<<j<<" "<<k<<endl;
                if(ans==n){
                    cout<<(i+j+k)<<endl;
                    return;
                }
            }
        }
    }
}

int main(void){
    int n;
    while(cin>>n,n){
        solve(n);
    }
    
}

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

int main()
{
	while (true) {
		int e;
		cin >> e;

		if (e == 0) {
			break;
		}

		int ans = e;

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

		cout << ans << endl;
	}

	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	const int MAX = 1000000;
	vector<int> cub, sq;
	for (int i = 0; i*i*i <= MAX; ++i)
		cub.push_back(i*i*i);
	for (int i = 0; i*i <= MAX; ++i)
		sq.push_back(i*i);
	cub.push_back(MAX + 1);
	sq.push_back(MAX + 1);

	int e;
	while (scanf("%d", &e), e)
	{
		int res = e;
		for (int z = 0; cub[z] <= e; ++z)
			for (int y = 0; sq[y] + cub[z] <= e; ++y)
				min_swap(res, (e - (sq[y] + cub[z])) + y + z);
		printf("%d\n", res);
	}
}