Go: package main

import (
	"fmt"
	"math"
)

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

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

func circleTriangle() {
	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<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
    int a;
    cin >> a;
    while(a--){
        double x1,y1,x2,y2,x3,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=(b1*c2-b2*c1)/(a1*b2-a2*b1);
         y=(c1*a2-c2*a1)/(a1*b2-a2*b1);
         r=hypot(x-x1,y-y1);
        printf("%.3lf %.3lf %.3lf\n",x,y,r);
    }
}

C++: //Circumscribed Circle of a Triangle
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  scanf("%d", &n);
  for(int i=0; i<n; i++){
    double x1, y1, x2, y2, x3, y3;
    double px, py, r;
    scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
    px=((y1-y2)*(y2-y3)*(y3-y1)+(y1-y2)*(x2+x3)*(x2-x3)+(y3-y2)*(x1+x2)*(x1-x2))/(2*((y1-y2)*(x2-x3)+(y3-y2)*(x1-x2)));
    py=((x1-x2)*(x2-x3)*(x3-x1)+(x1-x2)*(y2+y3)*(y2-y3)+(x3-x2)*(y1+y2)*(y1-y2))/(2*((x1-x2)*(y2-y3)+(x3-x2)*(y1-y2)));
    r=sqrt(pow(x1-px, 2.0)+pow(y1-py, 2.0));
    printf("%.3f %.3f %.3f\n", px, py, r);
  }
  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;float 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<float> a(d,g),b(e,h),c(f,i);
		float 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<iostream>
#include<cstdio>
#include<math.h>
using namespace std;

int main()
{
	int i,n,flg;
	double x1,x2,x3,y1,y2,y3;
	double m1,m2,xm1,xm2,ym1,ym2,xo,yo,r;
	//m1,m2…辺の法線 xm1,ym1…辺の中点の座標

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

		xm1=(x1+x2)/2;
		xm2=(x2+x3)/2;
		ym1=(y1+y2)/2;
		ym2=(y2+y3)/2;
		
		if(y1-y2!=0) 		m1=(-1)*(x1-x2)/(y1-y2);
		else if(y1-y2==0)	flg=1;
		
		if(y2-y3!=0)		m2=(-1)*(x2-x3)/(y2-y3);
		else if(y2-y3==0)	flg=2;
		
		if(flg==0) 	xo=(m1*xm1-m2*xm2+ym2-ym1)/(m1-m2);
		else if(flg==1)xo=xm1;
		else if(flg==2)xo=xm2;

		if(flg==1)yo=m2*(xo-xm2)+ym2;
		else		yo=m1*(xo-xm1)+ym1;
		r=sqrt((x1-xo)*(x1-xo)+(y1-yo)*(y1-yo));
		printf("%.3lf %.3lf %.3lf \n",xo,yo,r);
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 25;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };

int n;
double x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4;

pair<double, double> circumscribed_circle_center( double ax, double ay, double bx, double by, double cx, double cy ) {
	double a1 = 2 * ( bx - ax );
	double b1 = 2 * ( by - ay );
	double c1 = sq( ax ) - sq( bx ) + sq( ay ) - sq( by );
	double a2 = 2 * ( cx - ax );
	double b2 = 2 * ( cy - ay );
	double c2 = sq( ax ) - sq( cx ) + sq( ay ) - sq( cy );
	double x = ( b1 * c2 - b2 * c1 ) / ( a1 * b2 - a2 * b1 );
	double y = ( c1 * a2 - c2 * a1 ) / ( a1 * b2 - a2 * b1 );
	return make_pair( x, y );
}

int main() {
	scanf( "%d", &n );
	for ( int i = 0; i < n; i++ ) {
		scanf( "%lf %lf %lf %lf %lf %lf", &x_1, &y_1, &x_2, &y_2, &x_3, &y_3 );
		pair<double, double> _point = circumscribed_circle_center( x_1, y_1, x_2, y_2, x_3, y_3 );
		double r = sqrt( sq( _point.first - x_1 ) + sq( _point.second - y_1 ) );
		printf( "%.3f %.3f %.3f\n", _point.first, _point.second, r );
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
#define E 1e-10

int main(){
  int n;
  double x1,y1,x2,y2,x3,y3,xp,yp,r;
  cin >> n;
  for(int i=0;i<n;i++){
    cin >>x1>>y1>>x2>>y2>>x3>>y3;
    double a,b,c,d,e,f;
    a=x1-x2;
    b=y1-y2;
    c=x2-x3;
    d=y2-y3;
    e=(x1+x2)/2*a+(y1+y2)/2*b;
    f=(x2+x3)/2*c+(y2+y3)/2*d;
    xp=(d*e-b*f)/(a*d-b*c);
    yp=(-c*e+a*f)/(a*d-b*c);
    r=sqrt((xp-x1)*(xp-x1)+(yp-y1)*(yp-y1));

    if(xp>0) xp=(int)(xp*1000+0.5)/1000.0;
    else if(xp<0) xp=(int)(abs(xp)*1000+0.5)/1000.0*(-1);
    if(yp>0) yp=(int)(yp*1000+0.5)/1000.0;
    else if(yp<0) yp=(int)(abs(yp)*1000+0.5)/1000.0*(-1);
    if(r>0) r=(int)(r*1000+0.5)/1000.0;
    else if(r<0) r=(int)(abs(r)*1000+0.5)/1000.0*(-1);

    if(abs(xp)<0.001)xp+=E;
    if(abs(yp)<0.001)yp+=E;
    if(abs(r)<0.001)r+=E;

    cout << fixed <<setprecision(3);
    cout <<xp<<' '<<yp<<' '<<r<<'\n';
  }
  return 0;
}

C++: #import<complex>
#import<cstdio>
#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++: #define _CRT_SECURE_NO_WARNINGS
#define M_PI 3.14159265358979
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include<iomanip>
#include<vector>
#include<cmath>
#include <algorithm>

using namespace std;

double hankei(double z1,double z2,double dx,double dy){
	 
	double r = sqrt((dx - z1)*(dx - z1) + (dy - z2)*(dy - z2));
	return r;
}


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

		px = ((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));
		py = ((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));

		printf("%.3f %.3f %.3f\n",floor(px * 1000 + 0.5) / 1000,floor(py * 1000 + 0.5) / 1000 ,floor(hankei(x1, y1, px, py) * 1000 + 0.5) / 1000);
	}
	
	return 0;
}