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


int main(void){
    while (1) {
        int e;
        cin >> e;
        if (e == 0) return 0;
        
        int mn = 1e9, cnt = 0;
        for (int i = 100; i >= 0; i--) {
            if (i * i * i <= e) {
                for (int j = pow(e - i * i * i, 0.5) + 1; j >= 0; j--) {
                    if (e - i * i * i - j * j >= 0)
                    mn = min(mn, i + j + (e - i * i * i - j * j));
                }
                cnt++;
            }
            if (cnt > 3) break;
        }
        
        cout << mn << endl;
    }
}

C++: #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
#define INF 1000000
int main() {
    int e;
    vector<int> y, z;
    for (int i=0;;i++) {
        if (i*i>INF) break;
        y.push_back(i*i);
    }
    for (int i=0;;i++) {
        if (i*i*i>INF) break;
        z.push_back(i*i*i);
    }
    while (scanf("%d",&e)) {
        if (e==0) break;
        int m=INF+1;
        for (int x=0; x<=e; x++) {
            for (int i=0; i<y.size(); i++) {
                if (y[i]>e) break;
                for (int j=0; j<z.size(); j++) {
                    if (z[j]>e) break;
                    if(e==x+y[i]+z[j]) {
                        m=x+i+j;
                        break;
                    }
                }
                if (m!=INF+1) break;
            }
            if (m!=INF+1) break;
        }
        printf("%d\n",m);
    }
}

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

using namespace std;


bool solve()
{
	int n; cin >> n;
	if (n == 0)return false;

	int ans = 1000000;
	for (int z = 0; z*z*z <= n; ++z)
	{
		for (int y = 0; z*z*z + y*y <= n; ++y)
		{
			int x = n - z*z*z - y*y;
			ans = min(ans, x + y + z);
		}
	}
	cout << ans << endl;
	return true;
}


int main()
{
	while(solve())
	{
	}
	


	return 0;
}

C++: #include<iostream>
#include<climits>
using namespace std;
	int main(){
		int e,m,p,q,r,min;
		while(cin>>e,e){
			min=INT_MAX;
			for(int z=0;z*z*z<=e;z++)
			for(int y=0;y*y<=e;y++){
				x=e-z*z*z-y*y;
				if(x+y+z<min)
				min=x+y+z;
			}
			cout<<min<<endl;
		}
		return 0;
	}

C++: #include <iostream>
using namespace std;
#define MAX 1000000
int main(){
  int e;
  int x,y,z;

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

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

int main(){
  while(1){
  int e,min=100000000,ans;
 cin>>e;
 if(e==0) break;
 for(int i=0;i*i*i<=e;i++){
   for(int j=0;j*j<=e;j++){
     ans=e-(i*i*i+j*j);
     if(min>ans+j+i && e>=ans && ans>=0) min=ans+i+j;
   }
 }
 cout<<min<<endl;
  }
 return 0;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int solve(){
	int e;
	cin >> e;
	if(e==0)return 1;
	int ans = INF;
	for(int i=0;i*i*i<=e;i++){
		for(int j=0;j*j+i*i*i<=e;j++){
			int k = e-i*i*i-j*j;
			ans = min(ans,i+j+k);
		}
	}
	cout << ans << endl;
	return 0;
}
int main(){
	while(1){
		if(solve())return 0;
	}
}

C++: #include <iostream>
using namespace std;
int main(){
  int e,m;

  while(cin >> e && e>0){
      m=e;
    for(int x=0; x<=e; x++){
      for(int y=0; y<=e; y++){
        for(int z=0; z<=e; z++){
          if(x+y*y+z*z*z==e && x+y+z<m)
            m=x+y+z;
        }
      }
    }

    cout << m << endl;
  }
}

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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    int e;
    while(cin>>e, e) {
        int m = INF;
        for(int z=0; pow(z,3)<=e; ++z) {
            for(int y=0; pow(y,2)<=e-pow(z,3); ++y) {
                int x = e - pow(y,2) - pow(z,3);
                if(x<0) break;
                m = min(m, x+y+z);
            }
        }
        cout << m << endl;
    }
    return 0;
}

C++: // http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2012

#include <stdio.h>
#define min(a,b) ((a<b)?(a):(b))

int main(void) {
	while(1) {
		
		int e;
		int mmin = 10000000;
		
		scanf("%d", &e);
		if ( e == 0 ) { break; }
		
		for(int z=0; z<=100; z++) {
			for(int y=0; y<=1000; y++) {
				int x = e - z*z*z - y*y;
				if ( x<0 ) { break; }
				
				int sum = x+y+z;
				if ( mmin > sum ) { mmin = sum; }
			}
		}
		
		printf("%d\n", mmin);
	}
}