Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

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

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

C++: #pragma GCC optimize("O3")
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

using ll = long long;
using P = pair<int, int>;
using T = tuple<int, int, int>;

template <class T> inline T chmax(T &a, const T b) {return a = (a < b) ? b : a;}
template <class T> inline T chmin(T &a, const T b) {return a = (a > b) ? b : a;}

constexpr int MOD = 1e9 + 7;
constexpr int inf = 1e9;
constexpr long long INF = 1e18;
constexpr double pi = acos(-1);

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

#define X real()
#define Y imag()
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

typedef complex<double> Point, Vector;
typedef pair<Point, Point> Segment, Line;

double cross(Vector a, Vector b){
    return a.X * b.Y - a.Y * b.X;
}

double norm(Vector a){
    return a.X * a.X + a.Y * a.Y;
}

double abs(Vector a){
    return sqrt(norm(a));
}

// 垂直二等分線
Line bisector(Point a, Point b){
    Point A = (a + b) * Point(0.5, 0);
    return Line(A, A + (b - a) * Point(0, pi / 2));
}

// 直線と直線の交点
Point getCrossPointLL(Line l1, Line l2){
    double a = cross(l1.second - l1.first, l2.second - l2.first);
    double b = cross(l1.second - l1.first, l1.second - l2.first);
    if(abs(a) < EPS && abs(b) < EPS) return l2.first;
    return l2.first + (l2.second - l2.first) * (b / a);
}

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

    int n; cin>>n;
    while(n--){
        double x1, y1, x2, y2, x3, y3; cin>>x1>>y1>>x2>>y2>>x3>>y3;
        Point p1 = Point(x1, y1), p2 = Point(x2, y2), p3 = Point(x3, y3);
        Line l1 = bisector(p1, p2), l2 = bisector(p1, p3);
        Point p = getCrossPointLL(l1, l2);
        double r = abs(p - p1);
        printf("%.3f %.3f %.3f\n", p.X, p.Y, r);
    }

    return 0;
}

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

struct Point{double x, y;};

Point center2(Point p1, Point p2, Point p3){
	Point p;
	if(p1.y == p2.y){
		p.x = (p1.x + p2.x) / 2.0;
	}else if(p2.y == p3.y){
		p.x = (p2.x + p3.x) / 2.0;
	}
	p.y = p.x - (p2.x + p3.x) / 2.0;
	p.y *= -(p3.x - p2.x) / (p3.y - p2.y);
	p.y += (p2.y + p3.y) / 2.0;
	return p;
}

Point center(Point p1, Point p2, Point p3){
	if(p1.y == p2.y || p2.y == p3.y) return center2(p1, p2, p3);
	Point p;
	p.x = 0.0;
	p.x += (p3.y - p1.y) / 2.0;
	p.x -= (p2.x * p2.x - p1.x * p1.x) / (2.0 * (p2.y - p1.y));
	p.x += (p3.x * p3.x - p2.x * p2.x) / (2.0 * (p3.y - p2.y));
	p.x /= ((p3.x - p2.x) / (p3.y - p2.y) - (p2.x - p1.x) / (p2.y - p1.y));
	p.y = p.x - (p2.x + p3.x) / 2.0;
	p.y *= -(p3.x - p2.x) / (p3.y - p2.y);
	p.y += (p2.y + p3.y) / 2.0;
	return p;
}

int main(){
	int n;
	Point p1, p2, p3;
	Point p;
	double r;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf", &p1.x, &p1.y, &p2.x, &p2.y, &p3.x, &p3.y);
		p = center(p1, p2, p3);
		r = sqrt((p.x - p1.x) * (p.x - p1.x) + (p.y - p1.y) * (p.y - p1.y));
		printf("%.4lf %.4lf %.4lf\n", p.x, p.y, r);
	}
	return 0;
}

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

int main(){

	int n;
	double x1, y1, x2, y2, x3, y3;
	double la, lb, lc;
	double a, b, c;
	
	double r;
	double px, py;

	cin >> n;

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

		//lc = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
		la = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3);
		//lb = (x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1);

		a = fabs((atan2( y2 - y1, x2 - x1 ) - atan2( y3 - y1, x3 - x1 )));
		b = fabs((atan2( y1 - y2, x1 - x2 ) - atan2( y3 - y2, x3 - x2 )));
		c = fabs((atan2( y1 - y3, x1 - x3 ) - atan2( y2 - y3, x2 - x3 )));


		if( a >= PI ) a=2*PI-a;
		if( b >= PI ) b=2*PI-b;
		if( c >= PI ) c=2*PI-c;


		r = sqrt(la) / (sin(a)*2);
		px = ( sin(2*a) * x1 + sin(2*b) * x2 + sin(2*c) * x3 ) / (sin(2*a)+sin(2*b)+sin(2*c));
		py = ( sin(2*a) * y1 + sin(2*b) * y2 + sin(2*c) * y3 ) / (sin(2*a)+sin(2*b)+sin(2*c));

		r = floor(r*1000+0.5)/1000;
		px = floor(px*1000+0.5)/1000;
		py = floor(py*1000+0.5)/1000;

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

	}
	return 0;
}

C++: #include<complex>
#include<stdio.h>
#include<cmath>
#define F(a,b,c) acos((b*b+c*c-a*a)/2/b/c)
int main(){
	int n;double d,e,f,g,h,i;
	for(scanf("%d",&n);n--;){
		scanf("%lf%lf%lf%lf%lf%lf",&d,&g,&e,&h,&f,&i);
		std::complex<double> a(d,g),b(e,h),c(f,i);
		double A=abs(b-c),B=abs(c-a),C=abs(a-b),
		s=sin(2*F(A,B,C)),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(F(A,B,C))/2);
	}
}

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

int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		float x1, y1, x2, y2, x3, y3;
		scanf("%f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3);
		float a = (x2 - x3)*(x2 - x3) + (y2 - y3)*(y2 - y3);
		float b = (x1 - x3)*(x1 - x3) + (y1 - y3)*(y1 - y3);
		float c = (x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2);
		float s = ((x2-x1)*(y3-y1) - (x3-x1)*(y2-y1)) / 2;
		float x = (a*(b + c - a)*x1 + b*(c + a - b)*x2 + c*(a + b - c)*x3) / (16*s*s);
		float y = (a*(b + c - a)*y1 + b*(c + a - b)*y2 + c*(a + b - c)*y3) / (16*s*s);
		float r = sqrt((x-x1)*(x-x1) + (y-y1)*(y-y1));
		printf("%.3f %.3f %.3f\n", x, y, r);
	}
	return 0;
}

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

typedef pair<double,double>vec;

vec operator + (vec v1,vec v2){
    return make_pair(v1.first+v2.first,v1.second+v2.second);
}

vec operator - (vec v1,vec v2){
    return make_pair(v1.first-v2.first,v1.second-v2.second);
}

vec operator * (double v,vec v2){
    return make_pair(v*v2.first,v*v2.second);
}

vec operator / (vec v1,double d){
    return make_pair(v1.first/d,v1.second/d);
}

int norm2(vec v1,vec v2){
    return (v1-v2).first*(v1-v2).first+(v1-v2).second*(v1-v2).second;
}

int main(){
    double x1,x2,x3,y1,y2,y3,n,r,x4,y4;
    cin>>n;
    while(n--){
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        vec A = make_pair(x1,y1);
        vec B = make_pair(x2,y2);
        vec C = make_pair(x3,y3);
        double a2,b2,c2,a,b,c,cosA,cosB,cosC,sinA,sinB,sinC,cos2A,cos2B,cos2C,sin2A,sin2B,sin2C;
        a2=norm2(B,C);
        b2=norm2(A,C);
        c2=norm2(A,B);
        a=sqrt(a2);
        b=sqrt(b2);
        c=sqrt(c2);
        cosA=(b2+c2-a2)/(2*b*c);
        cosB=(a2+c2-b2)/(2*c*a);
        cosC=(b2+a2-c2)/(2*b*a);
        sinA=sqrt(1-cosA*cosA);
        sinB=sqrt(1-cosB*cosB);
        sinC=sqrt(1-cosC*cosC);
        r=(a/sinA)/2;
        cos2A=cosA*cosA-sinA*sinA;
        cos2B=cosB*cosB-sinB*sinB;
        cos2C=cosC*cosC-sinC*sinC;
        sin2A=2*sinA*cosA;
        sin2B=2*sinB*cosB;
        sin2C=2*sinC*cosC;
        
        vec v=(sin2A*A+sin2B*B+sin2C*C )   /    (sin2A+sin2B+sin2C);
        printf("%.3f %.3f %.3f\n",v.first,v.second,r);
    }
    
}