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 <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>
#include <complex>
 
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
 
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef complex<double> P;
int n;
 
double cross(P p1,P p2) {
    return (real(p1)*imag(p2) - imag(p1)*real(p2));
}
double calc_S(P p1,P p2,P p3) {
    double ret = 0.0;
    p1 -= p3;
    p2 -= p3;
 
    ret = cross(p1,p2)/2.0;
     
    return abs(ret);
}
 
int main() {
    cin>>n;
    while(n-->0) {
        double x1_,y1_;
        double x2_,y2_;
        double x3_,y3_;
        cin>>x1_>>y1_>>x2_>>y2_>>x3_>>y3_;
        P p1(x1_,y1_);
        P p2(x2_,y2_);
        P p3(x3_,y3_);
        P A = p1-p2;
        P B = p2-p3;
        P C = p1-p3;
        double S = calc_S(p1,p2,p3);
        double R = abs(A)*abs(B)*abs(C)/S;
        R /= 4.0;
         
        P A1 = 2.0*(p2-p1);
        P B1 = 2.0*(p3-p1);
        P C1 = P(norm(p1)-norm(p2),norm(p1)-norm(p3));
        double X = cross(P(imag(A1),imag(B1)),C1)/cross(A1,B1);
        double Y = cross(C1,P(real(A1),real(B1)))/cross(A1,B1);
        printf("%.3lf %.3lf %.3lf\n",X,Y,R);
 
    }
    return 0;
}

C++: #!/usr/bin/env python
from math import *
def g(x):
	y = (int((1000 * abs(x)) * 2 + 1) // 2) / 1000
	if x < 0:
		y *= -1
	return y
def func(x):
	x1, y1, x2, y2, x3, y3 = x
	
	a = x1 - x2
	b = y1 - y2
	c = (x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2) / 2
	d = x1 - x3
	e = y1 - y3
	f = (x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3) / 2
	x = (e * c - b * f) / (a * e - b * d)
	y = (a * f - d * c) / (a * e - b * d)
	r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y))
	x = "{0:.3f}".format(g(x))
	y = "{0:.3f}".format(g(y))
	r = "{0:.3f}".format(g(r))
	print(x + " " + y + " " + r)
n = int(input())
a = []
for _ in range(n):
	a.append(list((map(float, input().split()))))
for i in a:
	func(i)

C++: #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
#define x1 0
#define y1 1
#define x2 2
#define y2 3
#define x3 4
#define y3 5

int main()
{
	int n;
	double xy[6],a,b,c,d,e,f,x,y,r;

	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<6;j++)
			cin>>xy[j];

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

		x=(d*e-b*f)/(a*d-b*c);
		y=(a*f-c*e)/(a*d-b*c);
		r=sqrt(pow(xy[x1]-x,2)+pow(xy[y1]-y,2));

		x+=0.0005;
		y+=0.0005;
		r+=0.0005;

		printf("%.3lf %.3lf %.3lf\n",x,y,r);
	}
}

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

using namespace std;

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

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

using namespace std;

int main()
{
	double A1, B1, C1, A2, B2, C2;
	double X1, X2, X3, Y1, Y2, Y3;
	double X, Y, R;

	int n;
	cin>>n;

	for(int i = 0; i < n; i++){
		cin>>X1>>Y1>>X2>>Y2>>X3>>Y3;

		A1=2*(X2-X1);
		B1=2*(Y2-Y1);
		C1=pow(X1,2)-pow(X2,2)+pow(Y1,2)-pow(Y2,2);
		A2=2*(X3-X1);
		B2=2*(Y3-Y1);
		C2=pow(X1,2)-pow(X3,2)+pow(Y1,2)-pow(Y3,2);

		X = (B1*C2-B2*C1)/(A1*B2-A2*B1);
		Y = (C1*A2-C2*A1)/(A1*B2-A2*B1);

		R = sqrt(pow(X-X1,2)+pow(Y-Y1,2));

		if(X >= 0) X = ((double)((int)(X*1000+0.5)))/1000;
		else X = ((double)((int)(X*1000-0.5)))/1000;
		if(Y >= 0) Y = ((double)((int)(Y*1000+0.5)))/1000;
		else Y = ((double)((int)(Y*1000-0.5)))/1000;
		R = ((double)((int)(R*1000+0.5)))/1000;

		printf("%.3f %.3f %.3f",X, Y, R);
	}
	//cin.sync(); cin.get();
}

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

int main(void)
{
  int n;
  scanf("%d", &n);

  int i;
  for(i=0; i<n; ++i){
    double x1,y1,x2,y2,x3,y3;
    scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
    double det = x1*y2-x1*y3+x2*y3-x2*y1+x3*y1-x3*y2;
    double a = ((y2-y3)*(-x1*x1-y1*y1)+(y3-y1)*(-x2*x2-y2*y2)+(y1-y2)*(-x3*x3-y3*y3))/det;
    double b = ((x3-x2)*(-x1*x1-y1*y1)+(x1-x3)*(-x2*x2-y2*y2)+(x2-x1)*(-x3*x3-y3*y3))/det;
    double c = ((x2*y3-x3*y2)*(-x1*x1-y1*y1)+(x3*y1-x1*y3)*(-x2*x2-y2*y2)+(x1*y2-x2*y1)*(-x3*x3-y3*y3))/det;
    double xp = -a/2;
    double yp = -b/2;
    double r = sqrt(xp*xp+yp*yp-c);

    printf("%.3f %.3f %.3f\n", xp, yp, r);
  }

  return 0;
}

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

double fpx(double a, double b, double c, double d, double e, double f);
double fpy(double a, double b, double c, double d, double e, double f);
double  fr(double a, double b, double c, double d);
string toStr(double a);
string intToString(int a);

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

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

    cout << toStr(px) << " " << toStr(py) << " " << toStr(r) << endl;
  }
}


double fpx(double x1, double y1, double x2, double y2, double x3, double y3) {
  double a1, a2, b1, b2, c1, c2;

  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;

  return (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
}

double fpy(double x1, double y1, double x2, double y2, double x3, double y3) {
  double a1, a2, b1, b2, c1, c2;

  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;

  return (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
}

double fr(double x1, double y1, double x2, double y2) {
  return sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
}

string toStr(double d) {
  string pm = "", val = "";
  if (d < 0) {
    pm = "-";
    d = -d;
  }

  int ipart = (int)d;
  int fpart = (int)( (d - (double)ipart) * 10000) + 10005;

  val = pm + intToString(ipart) + "." + intToString(fpart).substr(1, 3);
  return val;
}

string intToString(int n) {
  stringstream ss;
  ss << n;
  return ss.str();
}