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>
#include<iomanip>
#include<cmath>
using namespace std;

int main ()
{
    int num;
    double x1,y1,x2,y2,x3,y3;

    cin >> num;

    for( int i = 0; i < num; i++ )
    {
        double px = 0, py = 0, r = 0;
        double a, b, c, d, e, f, g;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

        px = ((x1*x1-x3*x3+y1*y1-y3*y3)*(y2-y1)-(x1*x1-x2*x2+y1*y1-y2*y2)*(y3-y1)) / (2*(x2-x1)*(y3-y1)-2*(x3-x1)*(y2-y1));
        
        /*
        a = (x1*x1-x3*x3+y1*y1-y3*y3);
        b = (y2-y1);
        c = (x1*x1-x2*x2+y1*y1-y2*y2);
        d = (y3-y1);
        e = 2*(x2-x1)*(y3-y1);
        f = 2*(x3-x1)*(y2-y1);

        cout << "a: " << a << " b: " << b << " c: " << c << " d: " << d << " e: " << e << " f: " << f << endl;
        g = (a*b-c*d) / (e-f);
        cout << "g: " << g << endl;
        */

        py = ((2*(x1-x2)*px+x2*x2-x1*x1+y2*y2-y1*y1)) / (2*(y2-y1));
        //r = (px-x1)*(px-x1) + (py-y1)*(py-y1);

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

    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef pair<int,string> P;

int main(){
  int N;
  cin >> N;
  while(N--){
    double x1,y1,x2,y2,x3,y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double a = 2*(x2-x1),b = 2*(y2-y1),c = x1*x1 - x2*x2 + y1*y1 - y2*y2;
    double d = 2*(x3-x1),e = 2*(y3-y1),f = x1*x1 - x3*x3 + y1*y1 - y3*y3;
    double x = (b*f - e*c)/(a*e - d*b);
    double y = (c*d - f*a)/(a*e - d*b);
    double r = sqrt((x-x1)*(x-x1) + (y-y1)*(y-y1));
    printf("%.3f %.3f %.3f\n",x,y,r);
  }
}

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

using db = double;

struct poi {
	db x, y;
	void r() { cin >> x >> y; }
	poi operator -(poi p) {
		return {x - p.x, y - p.y};
	}
	poi operator /(db d) {
		return {x / d, y / d};
	}
	db cross(poi p) {
		return x * p.y - y * p.x;
	}
	db len2() {
		return x * x + y * y;
	}
};

poi circum(poi a, poi b, poi c) {
	poi ba = b - a, ca = c - a;
	db lb = ba.len2(), lc = ca.len2(), s = ba.cross(ca);
	return a - poi{ba.y * lc - ca.y * lb,
		ca.x * lb - ba.x * lc} / s / 2;
}

int main() {
	cout << fixed << setprecision(3);
	ios :: sync_with_stdio(false);
	int t; cin >> t;
	while(t --) {
		poi a, b, c;
		a.r(); b.r(); c.r();
		poi o = circum(a, b, c);
		cout << o.x << ' ' << o.y << ' ' << sqrt((o - a).len2()) << '\n';
	}
	return 0;
}

C++: #include<stdio.h>
#include<math.h>
int main(){
    int a;
    scanf("%d",&a);
    while(a--){
        double x1,y1,x2,y2,x3,y3;
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&x3,&y3);
        double a1=2*(x2-x1);
        double b1=2*(y2-y1);
        double c1=x1*x1-x2*x2+y1*y1-y2*y2;
        double a2=2*(x3-x1);
        double b2=2*(y3-y1);
        double c2=x1*x1-x3*x3+y1*y1-y3*y3;
        double x=(b1*c2-b2*c1)/(a1*b2-a2*b1);
        double y=(c1*a2-c2*a1)/(a1*b2-a2*b1);
        double r=hypot(x-x1,y-y1);
        printf("%.3lf %.3lf %.3lf\n",x,y,r);
    }
}

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    double x1,y1,x2,y2,x3,y3;
    while(n>0)
    {
        cin >> x1 >> y1 >>x2 >> y2 >> x3 >> y3;
        double s,v1x,v1y,v2x,v2y;
        v1x = y2-y1;
        v1y = x1-x2;

        v2x = y3-y1;
        v2y = x1-x3;
        double detA = v1x*v2y-v1y*v2x;
        double hx = (x2-x1)/2;
        double hy = (y2-y1)/2;
        s = (v2y*hx -v1y*hy)/detA;
        double ox,oy;
        ox = hx + s*v1x;
        oy = hy + s*v1y;
        if(-0.0005<ox&&ox<0)ox = 0;
        if(-0.0005<oy&&oy<0)oy = 0;
        double r = sqrt((x1-ox)*(x1-ox)+(y1-oy)*(y1-oy));
        printf("%.3f %.3f %.3f\n",ox,oy,r);
        --n;
    }
    return 0;
}

C++: #define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

double distance(double x0, double y0, double x1, double y1)
{
	double x = x1 - x0;
	double y = y1 - y0;

	return sqrt(x * x + y * y);
}

int main()
{
	int n;
	for (cin >> n; n--;)
	{
		vector<double> x(3);
		vector<double> y(3);

		for (int i = 0; i < 3; i++)
		{
			cin >> x.at(i) >> y.at(i);
		}

		double a = distance(x.at(1), y.at(1), x.at(2), y.at(2));
		double b = distance(x.at(2), y.at(2), x.at(0), y.at(0));
		double c = distance(x.at(0), y.at(0), x.at(1), y.at(1));

		double cosA = (b * b + c * c - a * a) / (2 * b * c);
		double sinA = sqrt(1 - cosA * cosA);
		double r = a / (2 * sinA);

		double cx = r * cosA;
		double cy = r * sinA;

		cout << fixed << setprecision(3);
		cout << cx << " " << cy << " " << r << endl;
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n;i>=0;i--)]
#define all(v) v.begin(), v.end()
using namespace std;

template<typename T>T inner(complex<T> a,complex<T> b){
	return a.real()*b.real()+a.imag()*b.imag();
}
template<typename T>double theta(complex<T> a,complex<T> b){
	double in = inner(a,b);
	double a_abs = abs(a);
	double b_abs = abs(b);
	return acos(in/(a_abs*b_abs));
}
template<typename T>T deg(T a){
	return a*180/M_PI;
}
int main(){
	complex<double> p[3];
	int n;
	cin >> n;
	rep(i,n){
		double x,y;
		rep(j,3){
			cin >> x >> y;
			p[j] = *(new complex<double>(x,y));
		}
		complex<double> vAB = p[1]-p[0];
		complex<double> vAC = p[2]-p[0];
		complex<double> vBC = p[2]-p[1];
		double a= theta(vAB,vAC);
		double b= theta(-vAB,vBC);
		double c= theta(-vAC,-vBC);
		complex<double> vo =((sin(2*a)*p[0]+sin(2*b)*p[1]+sin(2*c)*p[2])/(sin(2*a)+sin(2*b)+sin(2*c)));
		complex<double> r = p[0]-vo;
		printf("%.3lf %.3lf %.3lf",vo.real(),vo.imag(),abs(r));
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
 
#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
 
typedef long long ll;
typedef pair<int, int> ii;
 
int main(){

	int n;
	cin >> n;
	rep(i, n){
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double vx21, vx31, vy21, vy31, tmp1, tmp2;
		vx21 = 2 * (x1 - x2);
		vx31 = 2 * (x1 - x3);
		vy21 = 2 * (y1 - y2);
		vy31 = 2 * (y1 - y3);
		tmp1 = x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2;
		tmp2 = x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3;
		
		double x, y, r;
		x = (vx31 * tmp1 - vx21 * tmp2) / (vx31 * vy21 - vx21 * vy31);
		y = (vy31 * tmp1 - vy21 * tmp2) / (vy31 * vx21 - vy21 * vx31);
		r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y));
		
		printf("%.3lf %.3lf %.3lf\n", x, y, r);
		
	}
 
	return 0;
}