Go: package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtof ...
func Sliceconvtof() []float64 {
	strs := strings.Split(sc.Text(), " ")

	var flts []float64
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		xf := float64(x)
		flts = append(flts, xf)
	}

	return flts
}

//ThirdRoot .
func ThirdRoot(f float64) float64 {
	xn := f / 2
	var dmt float64

	for {
		dmt = math.Pow(xn, 3) - f
		if math.Abs(dmt) < 0.00001*f {
			break
		}

		xn = xn - (dmt / (3 * math.Pow(xn, 2)))
	}

	return xn
}

func main() {

	for sc.Scan() {
		i := Sliceconvtof()
		if i[0] == -1.0 {
			break
		}
		fmt.Printf("%6f\n", ThirdRoot(i[0]))
	}

}

C++: #include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <string>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <queue>
#include <climits>
#include <set>
#include <complex>
#include <cmath>
#include <cstring>
#include <map>
using namespace std;
using ll = long long;
#define MOD 1000000007
#define INF 1LL << 59

double x[1010], y[1010];
int main()
{
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    cout << fixed << setprecision(7);

    long double n;
    while (cin >> n)
    {
        if (n == -1)
            break;
        long double x[101000];
        long double t = n;
        x[1] = t / 2.0;
        int idx = 2;
        while (1)
        {
            x[idx] = x[idx - 1] - (x[idx - 1] * x[idx - 1] * x[idx - 1] - n) / (3 * (x[idx - 1] * x[idx - 1]));

            if (abs(x[idx] * x[idx] * x[idx] - n) < 0.00001 * n)
                break;
            idx++;
        }
        cout << x[idx] << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <fstream>
//#include <tuple>
#include <set>
#include <string.h>
#include <functional>

#define X first
#define Y second
#define MP make_pair
//#define MT make_tuple
#define REP(i, a, n) for(int (i) = (a); (i) < (n); ++(i))
#define FOR(i, n) REP(i, 0, n)
typedef long long ll;
using namespace std;
const int MAX = 500;
const double eps = 0.0000001;

template<class T, class U>
void convert(T &t, U &u)
{
	stringstream ss;
	ss << t;
	ss >> u;
}

int main()
{
	ll q;
	while( cin >> q ){
		if( q == -1 ) break;
		double x = q / 2;
		while(  abs( x * x * x - q ) + eps >= 0.00001 * q ){
			x = x - (x * x * x - q) / ( 3 * x * x );
		}
		printf("%.06f\n", x);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define ALL(a) (a).begin(),(a).end()
#define INF 1000000001
#define MOD 10000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const ull B=100000007;
double rec(double x,double q){
      return x-((x*x*x-q)/(3.0*x*x));
}
int main(){
      double q;
      while(cin>>q&&q!=-1){
            double x=(q/2.0,q);
            REP(i,1000000){
                  x=rec(x,q);
            }
            printf("%.10f\n",x);
      }
}

C++: #include <iostream>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#include <stack>
#include <queue>
#include <map>
#include <bitset>
#include <sstream>
#include <istream>
#include <cmath>
#include <cstdio>

using namespace std;

#define vci vector<int>
#define vcs vector<string>
#define pb push_back
#define sz size()
#define mapii map<int, int>
#define mapci map<char, int>
#define mapsi map<string, int>
#define all(x) x.begin(), x.end()
#define minit(a, i) memset(a, i, sizeof(a));

#define for_(i, a, b) for (int i=(int)a; i<(int)b; i++)
#define for_d(i, a, b) for (int i=(int)a-1; i>=b; i--)
#define for_r(i, a, b, c) for (int i=(int)a; i<(int)b; i += c)
#define for_dr(i, a, b, c) for (int i=(int)a-1; i>=b; i -= c)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }

typedef long long ll;
typedef double D;

const int iINF = 2147483647;
const ll lINF = 9223372036854775807;

template <class T> inline void dbg(T t) { cout << t << endl; }


D EPS = 0.00001;

D solver(D q) {
	D x = q/2.0;
	
	while (fabs(x*x*x - q) >= EPS*q) {
		x = x - (x*x*x-q)/(3*x*x);
	}
	
	return x;
}

int main() {
	ll Q;
	
	while (cin>>Q) {
		if (Q==-1) break;
		D q = Q;
		
		printf("%lf\n", solver(q));
	}
	
	return 0;
}

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

int main() {
  int q;
  while(cin>>q, ~q) {
    double x = (double)q/2.;
    while(true) {
      if (abs(x*x*x - q) < 0.00001*q) break;
      x = x - (x*x*x-q)/(3*x*x);
    }
    printf("%.6f\n", x);
  }
}

C++: #include <iostream>
#include <deque>
#include <sstream>
#include <math.h>
using namespace std;

double distance(int r1, int r2)
{
	double a = pow(abs(r1 - r2), 2);
	double b = pow(r1 + r2, 2);
	return sqrt(-a + b);
}

int main()
{
	int box_width;
	while (cin >> box_width) {
		string line;
		stringstream ss;
		deque<int> cakes;
		getline(cin, line);
		ss << line;
		int r;
		while (ss >> r) {
			cakes.push_back(r);
		}
		sort(cakes.begin(), cakes.end());
		// for (int i = 0; i < cakes.size(); ++i) {
			// cout << cakes[i] << endl;
		// }

		bool ok = false;
		deque<int> save = cakes;

		double length = cakes.front() * 2;
		int prev = cakes.front();
		cakes.pop_front();
		bool front = false;
		while (!cakes.empty()) {
			int current;
			if (front) {
				current = cakes.front();
				cakes.pop_front();
			} else {
				current = cakes.back();
				cakes.pop_back();
			}
			length -= prev;
			length += distance(prev, current);
			length += current;
			prev = current;
			front = !front;
		}
		if (length <= box_width) {
			ok = true;
		}
		// cout << length << ' ';

		cakes = save;
		length = cakes.back() * 2;
		prev = cakes.back();
		cakes.pop_back();
		front = true;
		while (!cakes.empty()) {
			int current;
			if (front) {
				current = cakes.front();
				cakes.pop_front();
			} else {
				current = cakes.back();
				cakes.pop_back();
			}
			length -= prev;
			length += distance(prev, current);
			length += current;
			prev = current;
			front = !front;
		}
		if (length <= box_width) {
			ok = true;
		}
		// cout << length << ' ';

		if (ok) {
			cout << "OK" << endl;
		} else {
			cout << "NA" << endl;
		}
	}
}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int main(){
	ll q;
	while(cin>>q){
		if(q==-1)break;
		const double EPS=(1e-5);
		double x=q/2;
		while(true){
			x =x-(pow(x,3)-q)/(3*pow(x,2));
			if(abs(pow(x,3)-q)<EPS*q)break;
		}
		printf("%,7f\n",x);
	}

	return 0;
}

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

int main()
{
	double a, q;
	cout<<setprecision(6);
	cout<<setiosflags(ios::fixed);
	while (cin>>q, q!=-1) {
		a = q/2.0;
		while ( abs(a*a*a-q) >= 0.00001*q ) a -= (a*a*a-q) / (3.0*a*a);
		cout<<a<<endl;
	}
	return 0;
}