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>
#include <queue>

using namespace std;


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

        priority_queue<unsigned int, vector<unsigned int>, greater<unsigned int>> q;
        [&]() mutable -> void
        {
            const unsigned short y_max = sqrt( e );
            const unsigned short z_max = cbrt( e );
            for( unsigned int x=0; x<=e; ++x ) {
                for( unsigned short y=0; y<=y_max; ++y ) {
                    for( unsigned short z=0; z<=z_max; ++z ) {
                        unsigned long long const v = x + y*y + z*z*z;
                        if ( v > e )
                            break;
                        if ( v == e ) {
                            if ( q.size() == 20 )
                                return;

                            q.push( x + y + z );
                        }
                    }
                }
            }
        }();

        cout << q.top() << endl;
    }
}

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

using namespace std;

int main() {

  int e,x,y,z;

  for(;;){
    cin >> e;
    if(!e)break;
    int xm = e;
    int ym = (int)sqrt(e)+1;
    int zm = (int)cbrt(e)+1;

    int f,m=3*e;

    for(int i = 0;i<xm;++i)
      for(int j = 0;j<ym;++j)
	for(int k = 0;k<zm;++k){
	  f=i+j+k;
	  if(i+j*j+k*k*k==e&&f<m)m=f;
	}

    cout << m << endl;

  }

}

C++: #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define EPS (1e-7)
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const double PI = acos(-1);
const ll MOD = 1000000007;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
 
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////////////////////
 
int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    while (true) {
        int N; cin >> N;
        if (N == 0) break;
        int ans = INF;
        for (int z = 0; z*z*z <= N; z++) {
            for (int y = 0; y*y <= N - z*z*z; y++) {
                int x = N - z*z*z - y*y;
                chmin(ans,x+y+z);
            }
        }

        cout << ans << endl;
    }
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int E;
int main(){
  while(cin >> E && E>0){
    int m = 100;
    for (int z=0; z<=100; z++){
      if(z >= m) break;
      for(int y=0; y<= sqrt(E-pow(z,3));y++){
	 if (y+z >= m) break;
	    int x = E - pow(z,3) - pow(y,2);
	    if (x >= 0){
	      if(x+y+z < m){
		m = x+y+z;
	      }
	    }
      }
    }
    cout << m << endl;
  }
}

C++: #include <math.h>
#include <iostream>
using namespace std;
int main() {
  int ene;
  while( cin >> ene && ene>0){
    int min = 1000000;
    for( int z=0; z<=100; z++) {
      int xy = ene - z*z*z;
      if( xy >= 0)
	for( int y=0; y<=10000; y++) {
	  int x = xy - y*y;
	  if( x>=0)
	    if( x+y+z<min) min = x+y+z;
	}
    }
    cout << min << endl;
  }
}

C++: #include <iostream>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <math.h>


using namespace std;

int main(int argc, char const* argv[])
{
    int e;
    while (cin >> e, e) 
    {
        int x,y,z;
        int m = 1000000;

        //for (int i = 0; i <= e; i++) 
        //{
        //    for (int j = 0; j*j <= e; j++) 
        //    {
        //        for (int k = 0; k*k*k <= e; k++) 
        //        {
        //            //cout << " x y z = " << i << j << k <<endl;
        //            if ( i + j*j + k*k*k == e) 
        //            {
        //                m = min( m, i + j + k);
        //            }
        //        }
        //    }
        //}
        for (int k = sqrt(e); 0 <= k; k--) 
        {
            for (int j = 0; j*j <= e; j++) 
            {
                for (int i = 0; i <= e; i++)
                {
                    if ( i + j*j + k*k*k == e) 
                    {
                        m = min( m, i + j + k);
                    }
                }
            }
        }
        cout << m << endl;
    }
    return 0;
}

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

int main(){

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

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

using namespace std;

int max(int ,int );

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

C++: #include <iostream>
#include <stdlib.h>
using namespace std;
int main()
{
  int E,tmp,z,y,x,i;
  while (cin >> E && E>0){
    if (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<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define CC puts("-------ok--------");
#define all(in) in.begin(), in.end()
#define bv vector<bool>
using namespace std;
typedef pair<int, int> PI;
#define MAX 1000009
int main(){
    int e;
    while(cin>>e,e){
        vector<PI> v3;
        for(int i =0;i<=100;i++){
            PI temp;
            temp.first=pow(i,3);temp.second=i;
            if(temp.first>e)break;
            v3.push_back(temp);
        }
        vector<PI> v2;
        for(int i=0; i<=10000;i++){
            PI temp;
            temp.first=pow(i,2); temp.second=i;
            if(temp.first>e)break;
            v2.push_back(temp);
        }
        PI min; min.first=INF; min.second=INF;
        for(int i=(int)v3.size()-1; i>=0;i--){
            if(v3[i].first==e){cout<<v3[i].second<<endl; goto E;}
            for(int j=(int)v2.size()-1; j>=0;j--){
                if(v2[j].first+v3[i].first>e)continue;
                if(v2[j].first==e){cout<<v2[j].second<<endl;goto E;}
                if(v2[j].first+v3[i].first==e){cout<<v2[j].second+v3[i].second<<endl; goto E;}
                if(v3[i].first+v2[j].first<e){
                    if(min.second+min.first>e-(v3[i].first+v2[j].first)+v3[i].second+v2[j].second){
                        min.second=v3[i].second+v2[j].second;
                        min.first=e-(v3[i].first+v2[j].first);
                    }
                }
            }
        }
        cout<<min.second+min.first<<endl;
    E:;
    }
    return 0;
}