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 <cstdio>
#include <cmath>

using namespace std;

int main() {
	long long int n;
	while (cin >> n) {
		if (n == -1) {
			break;
		}
		long double q;
		q = (long double)n / 2.0;
		while (q > 1300 || q < -1300 || fabs(q*q*q-n) >= 0.00001*q) {
			q = (2.0 * q / 3.0) + ((n/3.0)/q)/q;
		}
		printf("%.6f\n", q);
	}
	return 0;
}

C++: #include <iostream>
#include <deque>
#include <sstream>
#include <cmath>
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 <iostream>
#include <cmath>
#include <iomanip>
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);
    }
    cout<<setprecision(10)<<x<<endl;
  }
}

C++: #include <cstdio>
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main(){
	int q;
	while(cin >> q,q!=-1){
		double ans = q/2;
		while(1){
			if(fabs(ans*ans*ans -q) < 0.00001)break;
			double D = ans-((ans*ans*ans-q)/(ans*ans*3));
			ans = D;
		}
		printf("%.6lf\n",ans);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
  
using namespace std;
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
  
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
  
#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

#define INF 1000000000

typedef long double Real;
#define EPS 1e-11
#define EQ(x) (-EPS<x && x<EPS)
typedef complex<Real> P;
Real dot(P a,P b){return real(conj(a)*b);}
Real cross(P a,P b){return imag(conj(a)*b);}

int main(){
  cout.precision(12);
  while(true){
    Real x;
    cin>>x;
    if(x==-1)break;
    Real a = x/2.0;
    while(abs(a*a*a-x)>=0.0000001*x){
      a = a-(a*a*a-x)/(3.0*a*a);
    }
    cout<<fixed<<a<<endl;
  }
  return 0;
}

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

//AOJ0080
#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int main(void){

double q;
	
	while( cin >> q){
		if(q==-1 || cin.eof()) break;
		double x = q / 2;
		while(1){
			x = x - (x*x*x - q)/(3*x*x);
			if(abs(x*x*x-q) < 0.00001*q) break;
		}
		printf("%.6f\n",x);
	}
	return 0;
	
}

C++: #include<iostream>
#include<stdio.h>
#include<cmath>
#define EPS 0.00000001
using namespace std;


bool eq(double x,double y){
  if(abs(x-y)<EPS)return true;
  else return false;
}

int n;
double q;
double t[1000000];
int main(){
  while(cin>>n){
    if(n==-1)break;
    t[1]=n/2.0;
    for(int i=1;i<1000000;i++){
      if(i==1)t[i]=n/2.0;
      else t[i]=t[i-1]-(t[i-1]*t[i-1]*t[i-1]-(double)n)/(3.0*t[i-1]*t[i-1]);

      if(eq(t[i]*t[i]*t[i],n)){
	//cout<<t[i]<<endl;
	printf("%.6f\n",t[i]);
	break;
      }
    }
    
  }
}

C++: import sys
for e in sys.stdin:print(float(e)**(1/3))


####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
####################################################
########################################################################################################
####################################################
####################################################
########################################################################################################v
############################################################################################################################################################
####################################################
####################################################
####################################################
########################################################################################################v
vv####################################################v

C++: #include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int x;
int main() {
	while (true) {
		cin >> x; if (x == -1) { break; }
		cout << fixed << setprecision(20) << pow(1.0*x, 1.0 / 3.0) << endl;
	}
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

int main()
{
  double q, x, cx;

  while (scanf("%lf", &q), q != -1){
    x = q * 0.5;
    while (abs(x * x * x - q) >= (0.00001 * q)){
      x = x - (x * x * x - q) / (3 * x * x);
    }
    printf("%.6f\n", x);
  }
}

C++: #include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

int main() {
	double q;
	while (cin >> q && q != -1) {
		double x = q / 2;
		while (1) {
			double n = fabs(pow(x, 3) - q);
			if (n < 0.00001)
				break;
			x = x - (n / (3 * pow(x, 2)));
		}
		cout << fixed << setprecision(6) << x << endl;
	}
	return 0;
}