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 <vector>
#include <set>
using namespace std;
int main(){
    int e;
    while(1){
        cin>>e;
        if(e==0)return 0;
        set<int>S[3];
        int a=0,b=0;
        int mi=1e9;
        while(a*a*a<=e)a++;
        while(b*b<=e)b++;
        a--;b--;
        for(int i=a;i>=0;i--){
            for(int j=b;j>=0;j--){
                if(e-(i*i*i)-(j*j)<0)continue;
                mi=min(mi,i+j+(e-(i*i*i)-(j*j)));
                break;
            }
        }
        cout<<mi<<endl;
    }
}

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

# define rep(i, n) for (int i = 0; i < (int)(n); i++)
# define irep(i, n) for (int i = int(n) - 1; i >= 0; i--)
# define FOR(i, m, n) for (int i = int(m); i < (int)(n); i++)

using namespace std;

template <typename T>
void show_all(T t) {
  rep (i, t.size()) {
    rep (j, t[0].size()) {
      cout << t[i][j];
    }
    cout << endl;
  }
}

int main() {
  int e;
  while (1) {
    cin >> e;
    if (!e) break;
    // int i;
    // int x, y, z;
    // for (i=0; pow(i, 3) <= e; i++) {}
    // z = i-1;
    // e -= pow(z, 3);
    //
    // for (i=0; pow(i, 2) <= e; i++) {}
    // y = i-1;
    // e -= pow(y, 2);
    //
    // x = e;
    //
    // cout << x << ' ' << y << ' ' << z << ' ' << x + pow(y,2) + pow(z, 3) << ' ' << x + y + z << endl;

    int ans = 10000000 + 7;

    for (int z=0; pow(z,3)<=e; z++) {
      for (int y=0; pow(z,3)+pow(y,2)<=e; y++) {
        int x = e - (pow(z,3)+pow(y,2));
        if (x + pow(y,2) + pow(z,3) != e) continue;
        ans = min(ans, x+y+z);
      }
    }

    cout << ans << endl;
  }
}

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<bits/stdc++.h>
using namespace std;
#define int long long

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

  vector<int> v(1000001,1 << 30);
  const int n = 300;
  for(int x = 0; x < n; x++){
    for(int y = 0; y < n; y++){
      for(int z = 0; z < n; z++){
        if(x + y*y + z*z*z > 1000001) continue;
        v[x + y*y + z*z*z] = min(v[x + y*y + z*z*z],x + y + z);
      }
    }
  }

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

  cout << v[e] << endl;
}

  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  const int N = 1000000;
  int table[N+1];
  REP(i,N+1)
    table[i] = INF;
  REP(i,1001) {
    for (int j=0; i*i+j*j*j<=N; ++j) {
      table[i*i+j*j*j] = min(table[i*i+j*j*j], i+j);
    }
  }
  REP(i,10) {
    cout << table[i] << endl;
  }
  int n;
  while(cin>>n,n) {
    REP(i,n+1) {
      if (table[n-i] != INF) {
        cout << table[n-i] + i << endl;
        break;
      }
    }
  }
}

C++: //#include<bits/stdc++.h>
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<string>
#include<cmath>
#include<cassert>
#include<map>
  using namespace std;

typedef long long ll;
typedef ll int__;
#define rep(i,j) for(int__ (i)=0;(i)<(j);(i)++)
#define repeat(i,j,k) for(int__ i=(j);i<(k);(i)++)
#define all(v) begin(v),end(v)


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

    int m = 1<<30;
    for(int z=100;z>=0;z--){
      if(z*z*z>e)continue;
      for(int y=1000;y>=0;y--){
        if(z*z*z+y*y>e)continue;
        m=min(z+y+e-y*y-z*z*z,m);
      }
    }
    cout<<m<<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;
    if(y * y > E) continue;
    REP(z, 100){
      //int tmp = ((int)(pow(z, 3)) + (int)(pow(y, 2)));
      int tmp = (z * z * z + y * y);
      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;
}

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

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

C++: #include<iostream>
#include<math.h>
//#include<limits.h>
using namespace std;
int solve(int E)
{
  int ans =999999;
  for (int z=0; z*z*z<=E; z++)
    for (int y=0; y*y<=E; y++)
      {
	//cout<<"z="<<z<<" y="<<y<<endl;
	int x=E-z*z*z-y*y;
	//cout<<"x="<<x<<endl;
	//cout<<"x+y*y+z*z*z="<<x+y*y+z*z*z<<endl;
	if (((x+y*y+z*z*z == E)&&(x>=0))
	{

	  if((x+y+z)<ans)
	  {
	    ans=x+y+z;
	    cout<<"ans="<<ans<<endl;
	  }
	}
      }
  return ans;
}
int main()
{
  int E;
  while (cin >> E && E>0)
  {
    cout << solve(E) << endl;
  }
}

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

using std::cin;
using std::cout;
using std::endl;

int limit(int lim, int exp) {
	int res = 0;
	for (int i = 0; pow(i,exp) < lim+1; i++) {
		res = i;
	}
	return res;
}

int main(void) {
	int e;
	cin >> e;

	while (e != 0) {
		int m = 0;
		int res;
		int en = e;
		int temp;
		int z = limit(en,3);

		for (int i = 0; i < 10 && !((z-i) < 0); i++) {
			m = 0;
			en = e;

			m += z-i;
			en -= pow(z-i,3);

			temp = limit(en,2);
			m += temp;
			en -= pow(temp,2);

			temp = limit(en,1);
			m += temp;

			if (i == 0) {
				res = m;
			}
			else if (m < res) {
				res = m;
			}
		}
		
		cout << res << endl;
		cin >> e;
	}
	return 0;
}