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>

using namespace std;

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

C++: /*
 * 宇宙ヤシガニ（枝狩り問題）
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2012
 */
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<climits>
#include<ctime>
#include<cstring>
#include<sstream>
#define REP(i,p,n) for(int i=p;i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define rep_split(tok,a_str,re) for(char *tok = strtok((char *)a_str.c_str(),re); tok != NULL; tok = strtok(NULL,re))
#define ALL(c) (c).begin(), (c).end()
#define dump(a) cerr << #a << "=" << (a) << endl
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; } //t=min
template<class T> void chmax(T &t, T f) { if (t < f) t = f; } //t=max
using namespace std;

int main() {
	// x=1,000,000
	// y=1,000
	// z=100

	int min_m=INT_MAX,m=0,power=0;
	int E;
	int ww,xx,yy;
	while(cin >> E && E) {
		min_m=INT_MAX,m=0,power=0;
		rep(z,100) {
			yy = E - z*z*z;
			if (yy >= 0) {
				rep(y,1000) {
					xx = yy - y*y;
					if (xx >= 0) {
						m = xx + y + z;		
						chmin(min_m,m);
					}
					else { break; }
				}
				
			}
			else { break; }
		}
		cout << min_m << endl;
		
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <sstream>

using namespace std;

int main(){
	
	int n;
	
	while(true){
		
		cin >> n;
		if(n == 0){
			break;
		}
		
		int ans = 1000000;
		
		for(int i = 0; i <= 100; i++){
			for(int j = 0; j <= 1000; j++){
				if(i * i * i + j * j > n){
					break;
				}
				ans = min(ans, i + j + n - i * i * i - j * j);
			}
		}
		
		cout << ans << endl;
		
	}
	
	return 0;
}

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

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

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

int main(){
	long long E, sum=1000000;
	int y,z,
	long long x= E-z*z*z-y*y;
	while(1){
	cin >> E;
	if(E==0)break;
	for(z=0;z*z*z<=E;z++)
		for(y=0;y*y<=E;y++){
			if(z*z*z+y*y>E)break;
			else if(sum>x+y+z)sum=x+y+z;
			}
		cout << sum << endl;
	}
        return 0;
}

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

using namespace std;

int main()
{
    int e;
    
    while (scanf("%d", &e) && e){
        int ct = 1000000;
        for (int i = 0; i * i * i <= e; i++){
            for (int j = 0; j * j <= e - i * i * i; j++){
                ct = min(ct, i + j + e - i * i * i - j * j);
            }
        }
        
        printf("%d\n", ct);
    }
    
    return (0);
}

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

using namespace std;

int main(){
  int e;

  while(1)
    {
      cin >> e;
      if(e == 0)break;
      for(int x=0;x <= e;x++)
	for(int y=0;y*y <= e;y++)
	  for(int z=0;z*z*z <= e;z++)
	    {
	      if(x + y*y + z*z*z == e)
		{
		  cout << x+y+z << endl;
		  return 0;
		}
	    }
    }
  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<e;i++){
   for(int j=0;j*j*j<=e;j++){
     ans=e-(i*i+j*j*j);
     if(min>ans+j+i && e>=ans && ans>=0) min=ans+i+j;
   }
 }
 cout<<min<<endl;
  }
 return 0;
}

C++: #include <iostream>

using namespace std;

int pw (int n, int p) {
  if (n == 0) return 0;
  if (p == 0) return 1;
  if (p == 1) return n;
  return n * pw(n, p-1);
}

int computeM (int e) {
  
  int temp, ret = e;
  
  for(int x = 0; x <= e; x++) {
    for(int y = 0; y <= e; y++) {
      for(int z = 0; z <= e; z++) {
	for(int i = 0; i <= e; i++) {
	  for(int j = 0; j <= e; j++) {
	    for(int k = 0; k < e; k++) {
	      temp = pw(x, i) + pw(y, j) + pw(z, k);
	      if(temp == e) ret = min(x + y + z, ret);
	    }
	  }
	}
      }
    }
  }

  return ret;
}

int main (void) {
  int e, m;

  while (1) {
    cin >> e; if (e == 0) break;
    m = computeM(e);
    cout << m << endl;
  }
  return 0;
}

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

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

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

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

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

int main()
{
	int energy;

	while (std::cin >> energy, energy)
	{
		int sol = 1e+9;

		for (int z = 0; z * z * z <= energy; z++)
		{
			for (int y = 0, yMax = energy - z * z * z; y * y <= yMax; y++)
			{
			//	int y = ::sqrt(energy - z * z * z);
				sol = std::min(sol, z + y + (energy - z * z * z - y * y));
			}
		}

		std::cout << sol << std::endl;
	}

	return(0);
}

C++: #include<iostream>
#include<math.h>
#include<stdint.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>
#include<math.h>
using namespace std;

int main(){
  long x,y,z,min=1000000,e,result[100000],cnt=0;
  while(true){
    min=1000000;
    cin>>e;
    if(e==0)break;
    //x,y,zが最小になる値を算出する
    for(y=0; y<1000; y++){
      for(z=0; z<100; z++){
	x = e-pow(y,2)-pow(z,3);
	if(x<0)continue;
	if(e == (x+pow(y,2)+pow(z,3)) && min > x+y+z){
	  min = x+y+z;
	  //printf("x:%ld y:%ld z:%ld Min is now %ld\n",x,y,z,min);
	}
	
      }
    }
    result[cnt] = min;
    cnt++;
  }
  for(int i=0; i<cnt; i++){
    cout<<result[i]<<endl;
  }
  return 0;
}

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

using namespace std;

#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define INF 1000000000
#define INFL 10000000000000000LL
#define ALL(v) v.begin(),v.end()
#define pb push_back
#define ll long long int
#define P pair<ll, ll>

int main() {
  while(true){
    int n;
    cin >> n;
    if(n == 0) return 0;
    ll ans = INF;
    REP(i, (int)pow(n, 0.335)+1){
      REP(j, (int)pow(n, 0.5)+1){
        int k = n - (i*i*i) - (j*j);
        if(k >= 0 && i+j+k < ans) ans = i+j+k;
      }
    }
    cout << ans << endl;
  }
  return 0;
}