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 <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

int main(){
    int n;
    cin >> n;
    REP(i, n){
        double x1, x2, x3, y1, y2, y3, div;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        div = x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2);
        double r1, r2, r3, X, Y, R;
        r1 = x1*x1 + y1*y1;
        r2 = x2*x2 + y2*y2;
        r3 = x3*x3 + y3*y3;
        X = r1*(y2-y3) + r2*(y3-y1) + r3*(y1-y2);
        Y = r1*(x3-x2) + r2*(x1-x3) + r3*(x2-x1);
        X = X / div / 2;
        Y = Y / div / 2;
        R = sqrt((X-x1)*(X-x1)+(Y-y1)*(Y-y1));
        printf("%.3f %.3f %.3f\n", X, Y, R);
    }
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int main() {
	int n; scanf("%d", &n);
	rep(i, n) {
		double x1, y1, x2, y2, x3, y3;
		cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
		double a = -x1 + x2, b = -y1 + y2, c = (-pow(x1, 2) - pow(y1, 2) + pow(x2, 2) + pow(y2, 2)) / 2;
		double d = -x1 + x3, e = -y1 + y3, f = (-pow(x1, 2) - pow(y1, 2) + pow(x3, 2) + pow(y3, 2)) / 2;
		double y = (c*d - a*f) / (b*d - a*e);
		double x = (c - b*y) / a;
		string s = to_string(x);
		if (s == "-nan(ind)")abort();
		printf("%.3lf %.3lf %.3lf\n", x, y, hypot(x1 - x, y1 - y));
	}
}

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

double a,b,c,d,e,f,x,y,r;
int n;

double ifof(double a){
	int n = a*10000;
	if(n%10 >= 5)
		n+=10;
	else if(n%10 <= -5)
		n-=10;
	return n/10000.0;
}

double solvex(){
	double k,l;
	k = (c*c)-(a*a)+(d*d)-(b*b)-(2*y*(d-b));
	l = 2*(c-a);
	return k/l;
}

double solvey(){
	double k,l;
	k = ((e-a)*((c*c)-(a*a)+(d*d)-(b*b)))-((c-a)*((e*e)-(a*a)+(f*f)-(b*b)));
	l = 2*(((d-b)*(e-a))-((f-b)*(c-a)));
	return k/l;
}

int main(){
	std::cin >> n;
	for(int i=0; i<n; i++){
		std::cin >> a >> b >> c >> d >> e >> f;
		y = solvey();
		x = solvex();
		r = std::sqrt(((x-a)*(x-a)) + ((y-b)*(y-b)));
		std::printf("%.3f %.3f %.3f\n",ifof(x),ifof(y),ifof(r));
	}
	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;
}

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 <iostream>
#include <cmath>
#include <cstdio>
using namespace std;

int w(int n)
{
  return n * n;
}

int main()
{
  double x1, y1, x2, y2, x3, y3;
  int n;
  double a, b, c, x, y;
  double px, py, r;

  cin >> n;

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

    a = sqrt(w(x1 - x2) + w(y1 - y2));
    b = sqrt(w(x2 - x3) + w(y2 - y3));
    c = sqrt(w(x3 - x1) + w(y3 - y1));
    px = ((y1 - y3) * (w(y1) - w(y2) + w(x1) - w(x2)) - (y1 - y2) * (w(y1) - w(y3) + w(x1) - w(x3))) / (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3));
    py = ((x1 - x3) * (w(x1) - w(x2) + w(y1) - w(y2)) - (x1 - x2) * (w(x1) - w(x3) + w(y1) - w(y3))) / (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3));
    //r = (a * b * c) / sqrt((a + b + c) * (b + c - a) * (a - b + c) * (a + b - c));
    x = ((a * a) - ((b * b) + (c * c))) / (-2 * b * c);
    y = sqrt(1 - x * x);
    r = a / (2 * y);
    printf("%.3f %.3f %.3f\n", px, py, r);
  }

  return 0;
}

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

using namespace std;

int main()
{
	int n;
	double x[3], y[3], a1, b1, c1, a2, b2, c2, px, py, r;

	cin >> n;

	for(int i=0; i<n; i++)
	{
		cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];

		a1 = 2 * (x[1]-x[0]);
		b1 = 2 * (y[1]-y[0]);
		c1 = (x[0]*x[0]) - (x[1]*x[1]) + (y[0]*y[0]) - (y[1]*y[1]);
		a2 = 2 * (x[2]-x[0]);
		b2 = 2 * (y[2]-y[0]);
		c2 = (x[0]*x[0]) - (x[2]*x[2]) + (y[0]*y[0]) - (y[2]*y[2]);
		px = (b1*c2 - b2*c1)/(a1*b2 - a2*b1);
		py = (c1*a2 - c2*a1)/(a1*b2 - a2*b1);
		r  = sqrt((px-x[0])*(px-x[0]) + (py-y[0])*(py-y[0]));

		printf("%.3f %.3f %.3f\n", px, py, r);
	}

	return 0;
}

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

int main(){

  double x1,y1,x2,y2,x3,y3;
  double px,py;
  int n;

  cin >> n;

  for(int i=0; i<n; i++){
    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));
    cout << px <<" "<< py <<" ";
    printf("%.3f\n", sqrt((px-x1)*(px-x1)+(py-y1)*(py-y1))+0.0005);

  }


  return 0;
}