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 <stdio.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <cctype>

#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <map>
#include <algorithm>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repi(i,l,n) for(int (i)=(int)(l);(i)<(int)(n);(i)++)
#define d_arr(arr, h, w) rep(i,(h) ){ cout << "["; rep(j,(w) ) { cout << (arr)[i][j] << ", "; } cout << "]" << endl;}

typedef pair<int ,int> P;

class Coordinates
{
    public:
        int x;
        int y;

        Coordinates(){ x = 0; y = 0;};
        Coordinates(int a, int b) { x = a; y = b;}

        Coordinates operator+(Coordinates p)
        {
            Coordinates tmp;
            tmp.x = x + p.x;
            tmp.y = y + p.y;
            return tmp;
        }

        friend bool operator==(const Coordinates a, const Coordinates b)
        {
            return (a.x == b.x && a.y == b.y);
        }
        friend bool operator<(const Coordinates a, const Coordinates b)
        {
            return (a.x < b.x && a.y < b.y);
        }
        friend bool operator<=(const Coordinates a, const Coordinates b)
        {
            return (a.x <= b.x && a.y <= b.y);
        }
};

typedef Coordinates Coo;


int main()
{
    int e;
    while(cin >> e, e)
    {
        int least = 1000000;
        //puts("enter while");
        int x,y,z;
        for(int i=0; i*i*i <= e; i++)
        {
            for( int j=0; j*j <= e -i*i*i; j++)
            {
                for( int k=0; k <= e - i*i*i - j*j; k++)
                {
                    if( i*i*i + j*j + k == e && least > i+j+k) { 
                        least = i+j+k; 
                        //cout << "(i,j,k) = " << i <<" "<< j <<" "<<  k << endl;
                    }
                }
            }
        }
        cout << least << endl;
    }
}

C++: #include <iostream>

using namespace std;

int main() {
	int e,x,y,z,small ;
	z=0;
	small=10000000;
	while(cin >> e && e>0){
		while(z*z*z < 1000000){
			y = 0 ;
			while(y*y < 1000000){
				x = e-y*y-z*z*z;
				if(small > x+y+z){
				small = x+y+z;
				}
			y = y+1;
			}
		z = z+1;
		}
	cout << small << endl ;
	}
}

C++: #include <iostream>
using namespace std;
int E,Count;
int solve(int E);

int solve(int E) {
  int x,y,z;
  int min = E;
  for (z=0;z*z*z<=E;z++) {
    for (y=0;y*y<=E-z*z*z;y++) {
      x = E-z*z*z-y*y;
      Count++;
      if (x>=0 && x+y+z<min) {
	min = x+y+z;
      }
    }
  }
  return min;
}
int main() {
  while (cin >> E && E>0) {
    //  cout << "min  : " << solve(E) << endl
    // << "count: " << Count << endl;
    cout << solve(E) << endl;
  }
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<queue>	
#include<functional>
#include<climits>

using namespace std;

namespace MyLib {

//define
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long

//constant
const int MOD = 1000000007;
const int INF = INT_MAX / 3-1;
const double EPS = 1e-9;
const int dx[4] = { 1,0,-1,0 };
const int dy[4] = { 0,1,0,-1 };

//typedef
typedef vector<int> vi;
typedef vector<vector<int>> vvi;

}

using namespace MyLib;



int main() {
	int e;
	while (cin >> e, e) {
		auto ans = tuple<int, int, int>(INF, INF, INF);
		for (int z = 0;z*z*z <= e;z++) 
			for (int y = 0; y*y + z*z*z <= e; y++) {
				int x = e - z*z*z - y*y;
				if (x + y + z < get<0>(ans) + get<1>(ans) + get<2>(ans))
					ans = make_tuple(x, y, z);
				
			}
		cout << get<0>(ans) + get<1>(ans) + get<2>(ans) << endl;

	}

	return 0;
}

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

typedef long long ll;

ll e, m, tmp;

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

    while (cin >> e, e) {
        m = (int)(1e9 + 7);

        for (int y = 0; y <= e; y++) {
            for (int z = 0; z <= e; z++) {
                tmp = e - y * y - z * z * z;
                if (tmp < 0) break;
                else {
                    tmp += y + z;
                    if (m > tmp) m = tmp;
                }
            }
        }

        cout << m << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int main(void){
    int e;
    int m;
    while(true){
        cin >> e;
        if(e == 0) break;
        m = 100000000;
        for(int z = 0;; z++){
            int xy = e - z * z * z;
            if(xy < 0) break;
            for(int y = 0;; y++){
                int x = xy - y * y;
                if(x < 0) break;
                m = min(m, x + y + z);
            }
        }
        cout << m << endl;
    }
}

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

using namespace std;


int main(){

int e,m;

while(cin>>e,e){

int min=100000;

for(int y=0;y*y<=e;y++){
for(int z=0;z*z*z+y*y<=e;z++){
int x=e-y*y-z*z*z;

if(x>=0&&x+y*y+z*z*z==e){
if(min>x+y+z)min=x+y+z;
}
}
}
cout<<min<<endl;
}

return 0;
}

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

using namespace std;

const int INF = 1000000000;

main(){
  int e;
  while(cin >> e && e){
    int m = INF;
    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;
        m = min(m, x + y + z);
      }
    }
    cout << m << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>
using namespace std;
int calcOver(int, int);
int calcM(int, int ,int);

int main() {
  while(true) {
    int e;
    cin >> e;
    if(e == 0) break;
    int y = 0;
    int z = 0;
    int maxover = 0;
    int limity = pow(e, 1.0 / 2.0);
    int limitz = pow(e, 1.0 / 3.0);
    int maxy = limity;
    int maxz = limitz;
    int minm = e;
    //cout << limity << ":" << limitz << endl;
    for(y = limity; y >= 0; --y) {
      for(int z = limitz; z >= 0; --z) {
        int over = calcOver(y, z);
        int m = calcM(e, y, z);
        //cout << y << ":" << z << ":" << over << endl;
        if(e >= over) {
          //cout << "ok" <<endl;
          //if(maxover <= over && ((maxy + maxz) >= (y + z))) {
          if(minm > m) {
          //cout << "ok" <<endl;
            maxy = y;
            maxz = z;
            //maxover = over;
            minm = m;
          }
          break;
        }
      }
    }
    //cout << maxy << ":" << maxz << endl;
    cout << (e - pow(maxy, 2) - pow(maxz, 3) + maxy + maxz) << endl;
  }
  return 0;
}

int calcOver(int y, int z) {
  return (pow(y, 2) + pow(z, 3));
}
int calcM(int e, int y, int z) {
  return (e - pow(y, 2) - pow(z, 3) + y + z);
}