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

const double EPS = 1E-8;
typedef vector<double> vd;
typedef vector<vd> mat;

// 拡大係数行列で一次方程式系を解く
vector<double> GaussJordan(const mat& A, const vd b) {
  int n = A.size();
  mat B(n, vd(n+1));
  for(int i=0; i<n; i++) {
    for(int j=0; j<n; j++) B[i][j] = A[i][j];
  }
  for(int i=0; i<n; i++) {
    B[i][n] = b[i];
  }

  for(int i=0; i<n; i++) {
    int pivot = i;
    for(int j=i; j<n; j++) {
      if(abs(B[j][i]) > abs(B[pivot][i])) pivot = j;
    }
    swap(B[i], B[pivot]);

    if(abs(B[i][i]) < EPS) return vd();
    
    for(int j=i+1; j<=n; j++) B[i][j] /=B[i][i];
    for(int j=0; j<n; j++) {
      if(i != j) {
	for(int k=i+1; k<=n; k++) B[j][k] -= B[j][i] * B[i][k];
      }
    }
  }
  vd x(n);
  for(int i=0; i<n; i++) x[i] = B[i][n];
  return x;
}

int main() {
  int tcase;
  cin >> tcase;
  while(tcase--) {
    double x[3], y[3];
    cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];
    
    mat A(3, vd(3, 0));
    for(int i=0; i<3; i++) {
      for(int j=0; j<3; j++) {
	if(j == 2) A[i][j] = 1;
	else A[i][j] = (j % 2 ? y[i] : x[i]);
      }
    }
    
    vd b(3);
    for(int i=0; i<3; i++) b[i] = -(x[i]*x[i] + y[i]*y[i]);

    vd v = GaussJordan(A, b);
    
    double cX = -v[0]/2, cY = -v[1]/2;
    double r = sqrt(pow(x[0]-cX, 2) + pow(y[0]-cY, 2));
    printf("%.3f %.3f %.3f\n", cX, cY, r);
  }
  
  return 0;
}

C++: #include <iostream>
#include <cmath>
#include <iomanip>
#define sqr(x) ((x) * (x))
using namespace std;

void equation(double a, double b, double c, double d, double e, double f, double *x, double *y)
{
  *x = (c * e - b * f) / (a * e - b * d);
  *y = (a * f - c * d) / (a * e - b * d);   
}


int main()
{
  int n;
  double x1, y1, x2, y2, x3, y3, x, y;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    x = y = 0;
    equation((2 * (x2 - x1)), (2 * (y2 - y1)), (sqr(x2) + sqr(y2) - sqr(x1) - sqr(y1)), (2 * (x3 - x2)), (2 * (y3 - y2)), (sqr(x3) + sqr(y3) - sqr(x2) - sqr(y2)), &x, &y);
    double r = sqrt(sqr(x1 - x) + sqr(y1 - y));
    cout << fixed << setprecision(3) << x + 0.0001 << ' ' <<  y + 0.0001 << ' ' << r + 0.0001 << endl;
  }
}

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

using namespace std;

inline double sq(double x) {
  return x * x;
}

inline double det(double a, double b, double c, double d) {
  return a * d - b * c;
}

int main() {
  int N;
  scanf("%d", &N);
  for (int I = 0; I < N; I++) {
    double x[3], y[3];
    for (int i = 0; i < 3; i++)
      scanf("%lf%lf", x+i, y+i);
    double a = 2*(x[1]-x[0]),
           b = 2*(y[1]-y[0]),
           c = 2*(x[2]-x[0]),
           d = 2*(y[2]-y[0]),
           e = sq(x[1])-sq(x[0])+sq(y[1])-sq(y[0]),
           f = sq(x[2])-sq(x[0])+sq(y[2])-sq(y[0]),
           p = det(e, b, f, d) / det(a, b, c, d),
           q = det(a, e, c, f) / det(a, b, c, d),
           r = sqrt(sq(p-x[0])+sq(q-y[0]));
    p = round(p * 1000.0) / 1000.0;
    q = round(q * 1000.0) / 1000.0;
    r = round(r * 1000.0) / 1000.0;
    printf("%.3f %.3f %.3f\n", p, q, r);
  }
  return 0;
}

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

int main(){
	double x1,y1,x2,y2,x3,y3,p,q,r;
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
		p = ((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));
		q = ((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));
		r = sqrt((x1 - p) * (x1 - p) + (y1 - q) * (y1 - q));
		printf("%.3f %.3f %.3f\n", p, q, r);
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <math.h>
#include <cstdio>
#include <algorithm>
using namespace std;

double renritux(double a,double b,double c,double d,double e,double f) 
{

	double x;	

		if (a==0){
			x = (f - (e*c/b)) / d;
		}else if(b==0){
			x = c / a;
		}else if(d==0){
			x = (c - (b*f/e)) / a;
		}else if(e==0){
			x = f / d;
		}else{
			x = (f - (e*c/b)) / (d - (e*a/b));
		}
		if (x==-0) x=0;
		
	return x;
  
}

double renrituy(double a,double b,double c,double d,double e,double f) 
{

	double y;	

		if (a==0){
			y = c / b;
		}else if(b==0){
			y = (f - (d*c/a)) / e;
		}else if(d==0){
			y = f / e;
		}else if(e==0){
			y = (c - (a*f/d)) / b;
		}else{
			y = (f - (d*c/a)) / (e - (d*b/a));
		}
		if (y==-0) y=0;
		
	return y;
  
}

double distance(double x1,double y1,double x2,double y2)
{
 
    vector<double> x,y;
    double dist;
    
    x.push_back(x1);
    y.push_back(y1);
    x.push_back(x2);
    y.push_back(y2);
     
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
     
    dist = sqrt((x[1]-x[0])*(x[1]-x[0])+(y[1]-y[0])*(y[1]-y[0]));
     
    return dist;
    
}

int main() {
	int n;
	cin >>n;
	
	for(int i=0;i<n;i++){
		double x1,y1,x2,y2,x3,y3,px,py,r,a,b,c,d,e,f;
		cin >>x1>>y1>>x2>>y2>>x3>>y3;
		
		if (y2!=y1){
			a = (x2-x1)/(y2-y1);
			b = 1;
			c = (x1+x2)*(x2-x1)/(2*(y2-y1)) + (y1+y2)/2;
		}else{
			a = 1;
			b = 0;
			c = (x1+x2)/2;
		}
		
		if (y3!=y1){
			d = (x3-x1)/(y3-y1);
			e = 1;
			f = (x1+x3)*(x3-x1)/(2*(y3-y1)) + (y1+y3)/2;
		}else{
			d = 1;
			e = 0;
			f = (x1+x3)/2;
		}
		px = renritux(a,b,c,d,e,f);
	  	py = renrituy(a,b,c,d,e,f);
	  	
	  	r = distance(px,py,x1,y1);
	  	
		printf("%.3f %.3f %.3f\n",px,py,r);
	
	}	
	return 0;
  
}