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 <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (((ll)1<<31)-1)
#define eps LDBL_EPSILON
#define moder (1000000007)
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
#define ggr getchar();getchar();return 0;
using namespace std;
int n;
double a,b,c,d,e,f;
pair<double,double> func(double A,double B,double C,double D,double E,double F){
    double ans1=(C*E-B*F)/(A*E-B*D),ans2=(C*D-A*F)/(B*D-A*E);
    if(C*E==B*F)ans1=0;
    if(C*D==A*F)ans2=0;
    return {ans1,ans2};
}
signed main(){
    cin>>n;
    rep(i,n){
        cin>>a>>b>>c>>d>>e>>f;
        double A=2*(-a+c),B=2*(-b+d),C=a*a+b*b-c*c-d*d;
        double D=2*(-a+e),E=2*(-b+f),F=a*a+b*b-e*e-f*f;
        pair<double,double> p=func(A,B,-C,D,E,-F);
        double ans1=p.first,ans2=p.second;
        printf("%.3lf %.3lf %.3lf\n",ans1,ans2,hypot(a-ans1,b-ans2));
    }
    ggr;
}

C++: #include<iostream>
#include<iomanip>
#include<math.h>
using namespace std;
typedef struct POINT
{
    double x;
    double y;
}POINT;
double dist(POINT a,POINT b)
{
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
bool cocircle(POINT p1,POINT p2,POINT p3,POINT &q,double &r)
{
  double x12=p2.x-p1.x;
  double y12=p2.y-p1.y;
  double x13=p3.x-p1.x;
  double y13=p3.y-p1.y;
  double z2=x12*(p1.x+p2.x)+y12*(p1.y+p2.y);
  double z3=x13*(p1.x+p3.x)+y13*(p1.y+p3.y);
  double d=2.0*(x12*(p3.y-p2.y)-y12*(p3.x-p2.x));
  //if(abs(d)<EP)                           //共&#32447;，&#22278;不存在
     //return false;
  q.x=(y13*z2-y12*z3)/d;
  q.y=(x12*z3-x13*z2)/d;
  r=dist(p1,q);
  return true;
}
int main()
{
    int n;
    double x1,x2,x3,y1,y2,y3,xp,yp,r;
    cin>>n;
    while(n--)
    {
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        POINT A,B,C,P;
        A.x=x1;
        A.y=y1;
        B.x=x2;
        B.y=y2;
        C.x=x3;
        C.y=y3;
        cocircle(A,B,C,P,r);
        cout<<fixed << setprecision(3)<<P.x<<' '<<P.y<<' '<<r<<endl;
    }

    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <complex>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
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)

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}

// 2直線の交点
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;  // same line
  if (EQ(d2, 0)) throw "kouten ga nai";   // 交点がない
  return a1 + d1/d2 * (a2-a1);
}

// 三角形の外心。点a,b,cは同一線上にあってはならない
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;
  D x1,y1,x2,y2,x3,y3;
  rep(_,n) {
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    P a = P(x1,y1);
    P b = P(x2,y2);
    P c = P(x3,y3);
    P center = circumcenter(a,b,c);
    printf("%.3lf %.3lf %.3lf\n", center.X, center.Y, abs(center - a));
  }
  return 0;
}

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

int main(){
	int n;
	float x1, y1, x2, y2, x3, y3, xp,yp, xq, yq, s1, sr1, s2, sr2;
	float b1, b2, xc, yc, r;
	scanf("%d", &n);
	while(n--){
		scanf("%f%f%f%f%f%f",&x3, &y3, &x2, &y2, &x1, &y1);
		xp=(x2+x1)/2; yp=(y2+y1)/2;
		xq=(x3+x1)/2; yq=(y3+y1)/2;
		sr1=-(x2-x1)/(y2-y1); b1=yp-sr1*xp;
		sr2=-(x3-x1)/(y3-y1); b2=yq-sr2*xq;

		xc=-(b1-b2)/(sr1-sr2);
		yc=sr1*xc+b1;
		r=sqrt((xc-x1)*(xc-x1)+(yc-y1)*(yc-y1));
		printf("%.3f %.3f %.3f\n",xc, yc, r);
	}
	return 0;
}

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));
    cout << x << " " << y << " ";
    printf("%.3f\n", r);
  }
}

C++: #include<stdio.h>
#include<math.h>
int main(){
    int a;
    cin >>a;
    while(a--){
        double x1,y1,x2,y2,x3,y3;
        cin >>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 <stdio.h>
#include <math.h>

using namespace std;


int main(){
	int n;
	double x1,x2,x3,y1,y2,y3,ox,oy,r;
	scanf("%d",&n);

	for(int i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
		ox=((y2-y1)*((y3*y3-y1*y1)+(x3*x3-x1*x1))-(y3-y1)*((y2*y2-y1*y1)+(x2*x2-x1*x1)))/
				(2*((x3-x1)*(y2-y1)-(x2-x1)*(y3-y1)));
		if(y2 != y1){
			oy=(2*(x1-x2)*ox+(y2*y2-y1*y1)+(x2*x2-x1*x1))/(2*(y2-y1));
		}else{
			oy=(2*(x1-x3)*ox+(y3*y3-y1*y1)+(x3*x3-x1*x1))/(2*(y3-y1));
		}

		r = sqrt((ox-x1)*(ox-x1)+(oy-y1)*(oy-y1));
		printf("%.3lf %.3lf %.3lf\n",ox,oy,r);
	}
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
using namespace std;
#define int long long

signed main(){

        int n;
        scanf("%lld",&n);
        for(int i=0;i<n;i++){
                double x1,x2,x3,y1,y2,y3;
                scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
                double t1 = atan2(x2-x1,y2-y1);
                double t2 = atan2(x3-x1,y3-y1);
                double d = sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
                double r = d/sin(abs(t1-t2))/2;
                double d2 = sqrt(r*r-d*d/4);
                double xc = (x3+x2)/2 - (y3-y2)/d*d2;
                double yc = (y3+y2)/2 + (x3-x2)/d*d2;
                printf("%.3f %.3f %.3f\n", xc,yc, r);

        }

        return 0;
}