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<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
int main(){
	double x1, x2, x3, y1, y2, y3;
	int n;
	cin >> n;
	rep(i, n){
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double a = sqrt(pow(x2-x3,2)+pow(y2-y3,2));
		double b = sqrt(pow(x3-x1,2)+pow(y3-y1,2));
		double c = sqrt(pow(x1-x2,2)+pow(y1-y2,2));
		double A = a*a;
		double B = b*b;
		double C = c*c;
		
		cout << (A*(B+C-A)*x1+B*(C+A-B)*x2+C*(A+B-C)*x3)/(A*(B+C-A)+B*(C+A-B)+C*(A+B-C)) << " ";
		cout << (A*(B+C-A)*y1+B*(C+A-B)*y2+C*(A+B-C)*y3)/(A*(B+C-A)+B*(C+A-B)+C*(A+B-C)) << " ";
		cout << a*b*c/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c)) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

struct Point
{
	double x, y;

	Point() : x( 0 ), y( 0 )
	{
		return;
	}

	Point( double x, double y ) : x( x ), y( y )
	{
		return;
	}

	Point operator + ( const Point &a ) const
	{
		return Point( x + a.x, y + a.y );
	}

	Point operator - ( const Point &a ) const
	{
		return Point( x + ( -a.x ), y + ( -a.y ) );
	}

	Point operator * ( const double &a ) const
	{
		return Point( x * a, y * a );
	}

	Point operator / ( const double &a ) const
	{
		return Point( x / a, y / a );
	}

	bool operator < ( const Point &a ) const
	{
		return x == a.x ? y < a.y : x < a.x;
	}
};

double distance( const Point &a, const Point &b )
{
	return sqrt( pow( a.x - b.x, 2. ) + pow( a.y - b.y, 2. ) );
}

double tri2cos( const double &a, const double &b, const double &c )
{
	return ( pow( b, 2. ) + pow( c, 2. ) - pow( a, 2. ) ) / ( 2 * b * c );
}

double cos2sin( const double &cos )
{
	return sqrt( abs( 1 / pow( cos, 2. ) ) );
}

void solve()
{
	Point A, B, C;

	cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y;

	double a = distance( B, C ), b = distance( A, C ), c = distance( A, B );

	double cosA = tri2cos( a, b, c ), cosB = tri2cos( b, c, a ), cosC = tri2cos( c, a, b );
	double sinA = sqrt( abs( 1 / pow( cosA, 2. ) ) );

	double r = a / sinA;
	
	double sin2A = sin( 2 * acos( cosA ) ), sin2B = sin( 2 * acos( cosB ) ), sin2C = sin( 2 * acos( cosC ) );

	Point o = ( A * sin2A + B * sin2B + C * sin2C ) / ( sin2A + sin2B + sin2C );

	cout << o.x << ' ' << o.y << ' ' << r << endl;

	return;
}

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

	cout.precision( 3 );
	cout << fixed;

	int n;
	cin >> n;

	REP( i, 0, n )
	{
		solve();
	}

	return 0;
}

C++: #include<complex>
#include<stdio.h>
#define F(a,b,c) acos((b*b+c*c-a*a)/2/b/c)
int main(){int n;float d,e,f,g,h,i;for(scanf("%d",&n);n--;){scanf("%f%f%f%f%f%f",&d,&g,&e,&h,&f,&i);std::complex<float> a(d,g),b(e,h),c(f,i);float A=abs(b-c),B=abs(c-a),C=abs(a-b),L=F(A,B,C),s=sin(2*L),t=sin(2*F(B,C,A)),u=sin(2*F(C,A,B)),v=s+t+u;printf("%.3f %.3f %.3f\n",(d*s+e*t+f*u)/v,(g*s+h*t+i*u)/v,A/sin(L)/2);}}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <string>
#include <map>
#include <functional>
#include <cmath>
#include <cstdio>
using namespace std;

int main(){
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    double x1, y1, x2, y2, x3, y3, x, y;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    x = ((y1-y3) * (y1 * y1 -y2 * y2 +x1 * x1 -x2 * x2) -(y1-y2) * (y1 * y1 -y3 * y3 +x1 * x1 -x3 * x3)) / (2 * (y1-y3) * (x1-x2)-2 * (y1-y2) * (x1-x3));
    y = ((x1-x3) * (x1 * x1 -x2 * x2 +y1 * y1 -y2 * y2) -(x1-x2) * (x1 * x1 -x3 * x3 +y1 * y1 -y3 * y3)) / (2 * (x1-x3) * (y1-y2)-2 * (x1-x2) * (y1-y3));
    double r;
    r = sqrt(pow(x - x1, 2) + pow(y - y1, 2));
    printf("%.3f %.3f %.3f\n", x, y, r);
  }
}

C++: #include <stdio.h>
#include <math.h>

int main(void)
{
	double x1, y1, x2, y2, x3, y3;
	double X, Y, r;
	double A1, B1, C1, A2, B2, C2;
	int n;
	int i;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf", &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 * (x3 - x1);
		C2 = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
		
		X = (B1 * C2 - B2 * C1) / (A1 * B2 - A2 * B1);
		Y = (C1 * A2 - C2 * A1) / (A1 * B2 - A2 * B1);
		
		r = sqrt((X - x1) * (X - x1) + (Y - y1) * (Y - y1));
		
		printf("%.3lf %.3lf %.3lf\n", X, Y, r);
		
	}
	
	return 0;
}

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

int main() {
  int n;
  double x1, y1, x2, y2, x3, y3;
  double a1, b1, c1, a2, b2, c2;
  double x, y, r;
  cin >> n;
  while (n--) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    a1 = x2-x1;
    b1 = y2-x1;
    c1 = -a1*(x1+x2)*0.5 - b1*(y1+y2)*0.5;
    
    a2 = x3-x2;
    b2 = y3-y2;
    c2 = -a2*(x2+x3)*0.5 - b2*(y2+y3)*0.5;

    y = (a2*c1-a1*c2)/(a1*b2-a2*b1);
    if (a1) {
      x = -(b1*y+c1)/a1;
    } else {
      x = -(b2*y+c2)/a2;
    }
    r = sqrt((x1-x)*(x1-x) + (y1-y)*(y1-y));

    cout.setf(ios::fixed);
    cout.precision(3);
    cout << x << " " << y << " " << r << endl;
  }
}

C++: #include <stdio.h>
#include <math.h>

int
main(void)
{
	char line[80];
	int n;

	if (fgets(line, sizeof line, stdin) == NULL) {
		return 1;
	}
	if (sscanf(line, "%d", &n) != 1) {
		return 1;
	}

	double x1;
	double x2;
	double x3;
	double y1;
	double y2;
	double y3;

	for (int i = 0; i < n; i++) {
		if (fgets(line, sizeof line, stdin) == NULL) {
			return 1;
		}
		if (sscanf(line, "%lf %lf %lf %lf %lf %lf",
				   &x1, &y1, &x2, &y2, &x3, &y3) != 6) {
			return 1;
		}

		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 a = sqrt(pow(x2-x3, 2) + pow(y2-y3, 2));
		double b = sqrt(pow(x3-x1, 2) + pow(y3-y1, 2));
		double c = sqrt(pow(x1-x2, 2) + pow(y1-y2, 2));

		double px = (b1*c2 - b2*c1)/(a1*b2 - a2*b1);
		double py = (c1*a2 - c2*a1)/(a1*b2 - a2*b1);
		double r = (a*b*c) / sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));

		printf("%.3f %.3f %.3f\n", px, py, r);
	}

	return 0;
}