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

int count = 0; // count the number of iterations
int solve(int E) {
  int ans = E;
  for (int y = 0; y*y <= E; ++y)
    for (int z = 0; z*z*z <= E; ++z){
      ++count; // Minimum number of counts when the looping is minimized; loop y and z thus.
      int x = (int) round(E-y*y-z*z*z);
      
      if (x + y*y + z*z*z == E)
	ans = min(ans, x + y + z);
    }
return ans;
}
int main() {
  int E[] = {100, 10000, 1000000};
  for (int i=0; i<3; ++i) {
    count = 0;
    solve(E[i]);
    cout << "E = " << E[i] << " count = " << count << endl;
    cout << i << endl;
  }
}

C++: #include <iostream>

using namespace std;

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

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int e;

int main(){
	while(cin>>e&&e){
		int ans=9999999;
		rep(i,100)rep(j,1000){
			if(e-i*i*i-j*j>=0)ans=min(ans,e-i*i*i-j*j+i+j);
		}
		cout<<ans<<endl;
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
int e;
int x,y,z;
int minm;
while(true){
cin>>e;
if(e==0)break;
minm=INT_MAX;
for(int i=0;i<101;i++){
	for(int j=0;j<101;j++){
		for(int k=0;k<101;k++){
			if(e==(i+j*j+k*k*k))minm=min(minm,i+j+k);
		}
	}
}
cout<<minm<<endl;
}
return 0;
}

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

int main() {

	int E,X,tempmin;
	int min;

	while(true) {
		cin >> E;
		if(E == 0) {
			break;
		}
		min = 1000000;
		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;
				tempmin = X+Y+Z;
				cout << X << " " << Y << " " << Z << endl;
				//cout << tempmin << endl;
				if((tempmin<min) && (X+Y*Y+Z*Z*Z == E)) {
					min = tempmin;
					
				}
			}
		}
		cout << min << endl;

	}
	return 0;
}

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


int main() {
    int E,x,y,z,m;
    while (cin >> E && E>0) {
       m = 1000000;
       z = pow(E, 1.0/3.0)/1;
       y = pow(E, 1.0/2.0)/1;
       for (int i = 0 ; i <= z ; i++) {
           for (int j = 0 ; j <= y ; j++){
               x = E - i*i*i - j*j;
               if (x+j+i<=m && x>=0) m = x+j+i;
           }
       }
       cout << m <<endl;
    }
}

C++: #include<bits/stdc++.h>
#define endl '\n';
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N;
    cin >> N;
    while(N != 0){
        int ans = mod;
        for(int i=0; i<=100; i++){
            for(int j=0; j<=1000; j++){
                if(i*i*i + j*j > N) continue;
                chmin(ans,i+j+(N-i*i*i-j*j));
            }
        }
        cout << ans << endl;
        cin >> N;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{
  for(;;){
    int e;
    cin >> e;
    if(e == 0) break;
    int ret = 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;
        if(x+y+z < ret){
          ret = x+y+z;
        }
      }
    }
    cout << ret << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;

void solve(int E) {
    int m = INF;
    for (int y = 0; (y * y) <= E; y++) for(int z = 0; (y * y) + (z * z * z) <= E; z++) {
        int x = E - (y * y) - pow(z, 3);
        if (x < 0) continue;
        m = min(m, x + y + z);
    }
    cout << m << endl;
}

signed main(void) {
    int n, m, p, a, b, c, x, y, z, q;
    string s;
    while (cin >> n, n) {
        solve(n);
        //return 0;
    }
}