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 <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define IREP(it,array) for(vector<int>::iterator it=array.begin(); it!=array.end(); ++it)
#define SREP(it,array) for(vector<string>::iterator it=array.begin(); it!=array.end(); ++it)
#define MP make_pair
typedef long long LL;
#define EPS (1e-3)
double zero(double d){
  return d < EPS ? 0.0 : d;
}

double getLen(double dx, double dy){
  dx = abs(dx);
  dy = abs(dy);
  return sqrt( dx*dx + dy*dy );
}



int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(3);

  int INF = 1000000;

  int n;
  cin>>n;
    
    REP(tar,n){
      double x1,y1,x2,y2,x3,y3;
      cin >>x1>>y1>>x2>>y2>>x3>>y3;

      double a = getLen(x1-x2,y1-y2);
      double b = getLen(x2-x3,y2-y3);
      double c = getLen(x3-x1,y3-y1);
      
      double A = acos((b*b+c*c-a*a)/(2.0*b*c));
      double B = acos((c*c+a*a-b*b)/(2.0*c*a));
      double C = acos((b*b+a*a-c*c)/(2.0*b*a));

      double A2 = sin(A*2);
      double B2 = sin(B*2);
      double C2 = sin(C*2);

      double px = ((x1*A2 + x2*B2 + x3*C2)/(A2+B2+C2));
      double py = ((y1*A2 + y2*B2 + y3*C2)/(A2+B2+C2));

      double R = a / (2.0*sin(A));

      cout << zero(px) << " " << zero(py) << " " << zero(R) << endl;
    }
    
  


  return 0;
}

C++: #include <stdio.h>
#include <math.h>
 
int main()
{
    int i, n;
    double x1, x2, x3, y1, y2, y3;
    double a, b, c, d, e, f;
    double X1, Y1, r;
     
    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%lf %lf %lf %lf %lf %lf",&x1, &y1, &x2, &y2, &x3, &y3);
        a = 2 * (x2 - x1);
        b = 2 * (y2 - y1);
        c = x1*x1 - x2*x2 + y1*y1 - y2*y2;
        d = 2 * (x3 - x1);
        e = 2 * (y3 - y1);
        f = x1*x1 - x3*x3 + y1*y1 - y3*y3;
         
        X1 = (b*f - e*c) / (a*e - d*b);
        Y1 = (c*d - f*a) / (a*e - d*b);
        r  = sqrt((X1-x1)*(X1-x1) + (Y1-y1)*(Y1-y1));
         
        X1 *= 1000;
        Y1 *= 1000;
        r  *= 1000;
         
        X1 = (int)(X1 > 0.0 ? X1+0.5 : X1-0.5);
        Y1 = (int)(Y1 > 0.0 ? Y1+0.5 : Y1-0.5);
        r  = (int)(r  > 0.0 ? r +0.5 : r -0.5);
         
        X1 = (double)X1/1000;
        Y1 = (double)Y1/1000;
        r  = (double)r /1000;
         
        printf("%.3f %.3f %.3f\n", X1, Y1, r);
         
         
    }
     
    return 0;
}

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

using namespace std;

int main(){
	int n;
	double x1, y1, x2, y2, x3, y3;
	double x, y, r;
	double a1, a2, b1, b2, c1, c2;

	cin >> n;
	while (n--){
		cin >> 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 * (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("%.3f %.3f %.3f\n", x, y, r);
	}

	return 0;
}

C++: #include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
 
using namespace std;
 
#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)
 
typedef vector<int> vi;
 
int main()
{
    int n;
    scanf("%d", &n);
    rep(i, n){
        double x1, y1, x2, y2, x3, y3;
        scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
        double a1 = 2.0*(x2-x1);
        double b1 = 2.0*(y2-y1);
        double c1 = x1*x1 - x2*x2 + y1*y1 - y2*y2;
        double a2 = 2.0*(x3-x1);
        double b2 = 2.0*(y3-y1);
        double c2 = x1*x1 - x3*x3 + y1*y1 - y3*y3;
 
        double px = (b1*c2-b2*c1)/(a1*b2-a2*b1);
        double py = (c1*a2-c2*a1)/(a1*b2-a2*b1);
        printf("%.3f %.3f %.3f\n", px, py, sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1)));
    }
 
    return 0;
}

C++: #include <algorithm>
#include <vector>
#include <cstdio>
#include <utility>
#include <complex>

using namespace std;

static const double EPS=1e-12;
static const double INF=1e24;
static const double PI=3.141592653589793;

using Point=complex<double>;
using Plane=vector<Point>;

namespace std {
    bool operator<(const Point &a, const Point &b) {
        return real(a)!=real(b)? real(a)<real(b) : imag(a)<imag(b);
    }
}

double cross_prod(const Point &a, const Point &b) {
    return imag(conj(a)*b);
}

double dot_prod(const Point &a, const Point &b) {
    return real(conj(a)*b);
}

struct Line: public pair<Point, Point> {
    Line() {}
    Line(const Point &a, const Point &b) {
        first = a;
        second = b;
    }
};

struct LineSeg: public pair<Point, Point> {
    LineSeg() {}
    LineSeg(const Point &a, const Point &b) {
        first = a;
        second = b;
    }
};

struct Circle {
    Point p;
    double r;
    Circle() {}
    Circle(const Point &p, const double r): p(p), r(r) {}
};

Point get_ipoint(const Line &l, const Line &m) {
    double x1=l.first.real(), x2=l.second.real();
    double x3=m.first.real(), x4=m.second.real();
    double y1=l.first.imag(), y2=l.second.imag();
    double y3=m.first.imag(), y4=m.second.imag();

    double x=(y4-y3)*(x4-x1)-(x4-x3)*(y4-y1);
    double d=(y4-y3)*(x2-x1)-(x4-x3)*(y2-y1);

    return Point(x1, y1) + (x/d)*Point(x2-x1, y2-y1);
}

bool testcase_ends() {
    double x, y;
    if (scanf("%lf %lf", &x, &y) == EOF)
        return 1;

    Point A(x, y);
    scanf("%lf %lf", &x, &y);
    Point B(x, y);
    scanf("%lf %lf", &x, &y);
    Point C(x, y);

    Line l((A+B)/2.0, (A+B)/2.0+(B-A)*polar(1.0, PI/2));
    Line m((B+C)/2.0, (B+C)/2.0+(C-B)*polar(1.0, PI/2));

    Point P=get_ipoint(l, m);
    double r=abs(P-A);
    printf("%.3f %.3f %.3f\n", P.real(), P.imag(), r);

    return 0;
}

int main() {
    size_t n;
    scanf("%zu", &n);

    for (size_t i=0; i<n; ++i)
        if (testcase_ends())
            return 1;

    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main()
{
	double n;
	double x1, x2, x3,y1,y2,y3;
	cin >> n;
	cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
	double px, py, r;
	double A = (x2 - x1)*(y3 - y2) - (y2 - y1)*(x3 - x2);
	px = 0.5*((y3 - y2)*(x2*x2 - x1*x1 + y2*y2 - y1*y1) - (y2 - y1)*(x3*x3 - x2*x2 + y3*y3 - y2*y2)) / A;
	py = 0.5*(-(x3 - x2)*(x2*x2 - x1*x1 + y2*y2 - y1*y1) + (x2 - x1)*(x3*x3 - x2*x2 + y3*y3 - y2*y2)) / A;
	double a = px - x1;
	double b = py - y1;
	double r0 = (a*a + b*b);
	double r1 = sqrt(r0);
	cout << fixed << setprecision(10) << px << " "<< py << " " << r1 <<  endl;
}