Go: package main

import (
	"fmt"
	"math"
)

func main() {
	n := scanInt()
	for i := 0; i < n; i++ {
		cal()
	}
}

func scanInt() int {
	var n int
	fmt.Scanf("%d", &n)
	return n
}

func cal() {
	var x1, y1, x2, y2, x3, y3 float64
	fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)
	a := 2 * (x1 - x2)
	b := 2 * (y1 - y2)
	c := 2 * (x1 - x3)
	d := 2 * (y1 - y3)
	e := x1*x1 - x2*x2 + y1*y1 - y2*y2
	f := x1*x1 - x3*x3 + y1*y1 - y3*y3

	px := (d*e - b*f) / (a*d - b*c)
	py := (a*f - c*e) / (a*d - b*c)

	r := math.Sqrt((x1-px)*(x1-px) + (y1-py)*(y1-py))
	fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
}

C++: #include <iostream>

using namespace std;

double dist(double x1, double y1, double x2, double y2){
	return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}

int main(){

	double x[3], y[3];
	int n;

	cin >> n;
	while(n-- > 0){
		for(int i = 0; i < 3; i++){
			cin >> x[i] >> y[i];
		}

		double a = x[1] - x[0];
		double b = y[1] - y[0];
		double c = x[2] - x[1];
		double d = y[2] - y[1];
		double e = a*a + b*b;
		double f = c*c + d*d;

		double p = (e*c - f*a) / (2 * (b*c - a*d));
		double q = (e*d - f*b) / (2 * (a*d - b*c));

		double r = dist(x[0], y[0], p, q);

		cout.setf(ios::fixed);
		cout.precision(4);
		cout << p << ' ' << q << ' ' << r << endl;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int n; scanf("%d", &n);
	rep(i, n) {
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double a = -x1 + x2, b = -y1 + y2, c = (-pow(x1, 2) - pow(y1, 2) + pow(x2, 2) + pow(y2, 2)) / 2;
		double d = -x1 + x3, e = -y1 + y3, f = (-pow(x1, 2) - pow(y1, 2) + pow(x3, 2) + pow(y3, 2)) / 2;
		double y = (c*d - a*f) / (b*d - a*e);
		double x = (c - b*y) / a;
		if (isnan(x))abort();
		printf("%.3lf %.3lf %.3lf\n", x, y, hypot(x1 - x, y1 - y));
	}
}

C++: #include<iostream>
#include<math.h>
#include <iomanip>
using namespace std;
int main() {
	int n;
	cin >> n;

	for (int i = 0;i < n;i++) {
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

		double px, py, r;
		 double A1, B1, C1, A2, B2, C2;
		A1 = 2 * (x2 - x1);
		B1 = 2 * (y2 - y1);
		C1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
		A2 = 2 * (x3 - x1);
		B2 = 2 * (y3 - y1);
		C2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;

		px = (B1*C2 - B2*C1) / (A1*B2 - A2*B1);
		py = (C1*A2 - C2*A1) / (A1*B2 - A2*B1);

		r = sqrt((x1 - px)*(x1 - px) + (y1 - py)*(y1 - py));

		cout << fixed << setprecision(3) << px << " ";
		cout << fixed << setprecision(3) << py << " ";
		cout << fixed << setprecision(3) << r << endl;
	}
	return 0;

}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <complex>
using namespace std;

typedef double D;
typedef complex<D> P;
const D EPS = 1e-9;
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

D cross(P a, P b) {
  return (conj(a)*b).Y;
}

P crosspointLL(P a1, P a2, P b1, P b2) {
  D d1 = cross(b2-b1, b1-a1);
  D d2 = cross(b2-b1, a2-a1);
  if (EQ(d1, 0) && EQ(d2, 0)) return a1;
  return a1 + d1/d2*(a2-a1);
}

P circumcenter(P a, P b, P c) {
  a = (a-c)*0.5;
  b = (b-c)*0.5;
  return c + crosspointLL(a, a*P(1,1), b, b*P(1,1));
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    double x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

    P a, b, c;
    a = P(x1, y1);
    b = P(x2, y2);
    c = P(x3, y3);
    P ansxy = circumcenter(a, b, c);
    printf("%.3f %.3f %.3f\n", ansxy.X, ansxy.Y, hypot(ansxy.X-x1, ansxy.Y-y1));
  }

}

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

int main() {
    int n;
    cin >> n;
    while(n--) {
        double x1, x2, x3, y1, y2, y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        double a1, a2, b1, b2, c1, c2,x, y, r;
        a1 = 2*(x2-x1);
        b1 = 2*(y2-y1);
        c1 = x1*x1-x2*x2+y1*y1-y2*y2;
        a2 = 2*(x3-x1);
        b2 = 2*(y3-y1);
        c2 = x1*x1-x3*x3+y1*y1-y3*y3;
        
        x = (double)(b1*c2-b2*c1)/(double)(a1*b2-a2*b1);
        y = (double)(c1*a2-c2*a1)/(double)(a1*b2-a2*b1);
        r = (double)sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));
        
        cout << x << " " << y << " " << r << endl;
    }
    return 0;
}

C++: #include<complex>
#include<cstdio>
#include<cmath>
using namespace std;typedef complex<double> P;class Tr{P a,b,c;double A,B,C;double x,y,z;double F(double a,double b, double c){return acos((b*b+c*c-a*a)/(2*b*c));}public:Tr(P p1, P p2, P p3){a=p1;b=p2;c=p3;B=abs(c-a);A=abs(b-c);C=abs(a-b);x=F(A,B,C);y=F(B,C,A);z=F(C,A,B);}double R(){return A/sin(x)/2.;}double X(){double A=sin(2*x),B=sin(2*y),C=sin(2*z);return(a.real()*A+b.real()*B+c.real()*C)/(A+B+C);}double Y(){double A=sin(2*x),B=sin(2*y),C=sin(2*z);return(a.imag()*A+b.imag()*B+c.imag()*C)/(A+B+C);}};int main(){int n;double d,e,f,g,h,i;scanf("%d",&n);for(;n--;){scanf("%lf%lf%lf%lf%lf%lf",&d,&g,&e,&h,&f,&i);P a(d,g),b(e,h),c(f,i);Tr T(a,b,c);printf("%.3f %.3f %.3f\n",T.X(),T.Y(),T.R());}}

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

int main(){
	double x1 , y1 , x2 , y2 , x3 , y3;
	double a1 , b1 , c1 , a2 , b2 , c2;
	double a , b , c;
	double px , py , r;
	double tmp;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	a1=2*(x2-x1);
	b1=2*(y2-y1);
	c1=x1*x1-x2*x2+y1*y1-y2*y2;
	a2=2*(x3-x1);
	b2=2*(y3-y1);
	c2=x1*x1-x3*x3-y1*y1-y3*y3;
	px=(b1*c2-b2*c1)/(a1*b2-a2*b1);
	py=(c1*a2-c2*a1)/(a1*b2-a2*b1);
	a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
	b=sqrt((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3));
	c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
	//(a/(2*r))*(a/(2*r))+((b*b-c*c-2a)/2*b*c)*((b*b-c*c-2a)/2*b*c)=1
	r=a/(2*sqrt(1-((b*b+c*c-a*a)/(2*b*c))*((b*b+c*c-a*a)/(2*b*c))));
	tmp=px*1000+0.5;
	px=(int)tmp;
	px/=1000;
	tmp=px*1000+0.5;
	py=(int)tmp;
	py/=1000;
	tmp=r*1000+0.5;
	r=(int)tmp;
	r/=1000;
	cout << fixed << setprecision(3) << px << " " << py << " " << r << endl;
	return 0;
}

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

using namespace std;

#define reep(i, f, n) for (int i = f; i < n; ++i)
#define rep(i, n) reep(i, 0, n)


int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    float x1,x2,x3,y1,y2,y3,gx,gy,G,Xc,Yc,r;

    int n,m;
    std::cin >> n;
    for (int i=0;i<n;i++) {
        scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
        gx = (x1+x2+x3)/3;
        gy = (y1+y2+y3)/3;
        G =( y2*x1-y1*x2 +y3*x2-y2*x3 +y1*x3-y3*x1 );
        Xc = ((x1*x1+y1*y1)*(y2-y3)+(x2*x2+y2*y2)*(y3-y1)+(x3*x3+y3*y3)*(y1-y2))/(2*G);
        Yc =-((x1*x1+y1*y1)*(x2-x3)+(x2*x2+y2*y2)*(x3-x1)+(x3*x3+y3*y3)*(x1-x2))/(2*G);
        r = sqrt( (x1 - Xc) * (x1 - Xc) + (y1 - Yc) * (y1 - Yc) );
        printf("%.3f %.3f %.3f\n", Xc, Yc, r);
    }
    return EXIT_SUCCESS;
}