Go: package main

import (
	"fmt"
	"math"
)

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

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

func cal() {
	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 <utility>
using namespace std;


class vec{
public:
	double x;
	double y;
	double normEXP2() const{
		return x*x + y*y;
	}
	vec& operator+(const vec& v){
		x += v.x;
		y += v.y;
		return *this;
	}
	vec& operator-(const vec& v){
		x -= v.x;
		y -= v.y;
		return *this;
	}
	vec& operator*(double scala){
		x *= scala;
		y *= scala;
		return *this;
	}
	double operator*(const vec& v) const{
		return x*v.x + y*v.y;
	}
};


istream& operator>>(istream& i, vec& v){
	i >> v.x >> v.y;
	return i;
}


pair<double, double> cramer(const vec& a, const vec& b){
	pair<double, double> solve;
	solve.first = (2 * a.normEXP2()*b.normEXP2() - 2 * b.normEXP2()*(a*b)) / (4 * a.normEXP2()*b.normEXP2() - 4 * ((a*b)*(a*b)));
	solve.second = (2 * a.normEXP2()*b.normEXP2() - 2 * a.normEXP2()*(a*b)) / (4 * a.normEXP2()*b.normEXP2() - 4 * ((a*b)*(a*b)));

	return solve;
}


int main(){
	int n;
	vec v1, v2, v3;
	vec b, c;
	vec solveVec;
	pair<double, double> solve;
	double x, y;
	double r;

	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> v1 >> v2 >> v3;
		b = v2 - v1;
		c = v3 - v1;
		
		solve = cramer(b, c);
		solveVec = (b*solve.first) + (c*solve.second);

		solveVec = v1 + solveVec;
		r = sqrt(solveVec.normEXP2());

		y = (double)((int)((solveVec.y * 1000) + 0.5)) / 1000;
		r = (double)((int)((r * 1000) + 0.5)) / 1000;
		x = (double)((int)((solveVec.x * 1000) + 0.5)) / 1000;

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

	return 0;
}

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

void circumcenter(double x1, double y1, double x2, double y2, double x3,
                  double y3, double &cx, double &cy) {
  double a1, b1, c1, a2, b2, c2;
  a1 = x2 - x1;
  b1 = y2 - y1;
  c1 = x2 * x2 - x1 * x1 + y2 * y2 - y1 * y1;
  a2 = x3 - x2;
  b2 = y3 - y2;
  c2 = x3 * x3 - x2 * x2 + y3 * y3 - y2 * y2;
  cx = (b2 * c1 - b1 * c2) / (2.0 * (a1 * b2 - a2 * b1));
  cy = (a1 * c2 - a2 * c1) / (2.0 * (a1 * b2 - a2 * b1));
}

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;++i){
        double x1, y1, x2, y2, x3, y3;
        cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
        double px, py, r;
        circumcenter(x1,y1,x2,y2,x3,y3,px,py);
        r = sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1));
        printf("%.3f %.3f %.3f\n",px,py,r);
    }

    return 0;
}

C++: #include <iostream>
#include <algorism>
#include <stdio.h>
#include <cmath>

using namespace std;
double min(double x0, double x1, double x2){ return min(min(x0, x1), x2); }
double max(double x0, double x1, double x2){ return max(max(x0, x1), x2); }
double d(double x, double y, double p, double q){ return sqrt((p-x)*(p-x)+(q-y)*(q-y)); }
double diff(double x0, double x1, double x2){ return max(x0,x1,x2)-min(x0,x1,x2); }
int main(){
	double x[3], y[3];
	cin >> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];

	double ax,ay, r;
	double p, q;
	ax = (max(x[0],x[1],x[2]) + min(x[0],x[1],x[2]))/2;
	ay = (max(y[0],x[1],x[2]) + min(x[0],x[1],x[2]))/2;
	p = (max(x[0],x[1],x[2]) + min(x[0],x[1],x[2]))/4;
	q = (max(y[0],x[1],x[2]) + min(x[0],x[1],x[2]))/4;

	for(int i=0; i<10; i++){
		p = (max(x[0],x[1],x[2]) + min(x[0],x[1],x[2]))/4;
		q = (max(y[0],x[1],x[2]) + min(x[0],x[1],x[2]))/4;
		while(1){
		if(diff(d(x[0],y[0],ax+p,ay),d(x[1],y[1],ax+p,ay),d(x[2],y[2],ax+p,ay)) > diff(d(x[0],y[0],ax-p,ay),d(x[1],y[1],ax-p,ay),d(x[2],y[2],ax-p,ay))){
			ax -= p;
		}
		else if(diff(d(x[0],y[0],ax+p,ay),d(x[1],y[1],ax+p,ay),d(x[2],y[2],ax+p,ay)) < diff(d(x[0],y[0],ax-p,ay),d(x[1],y[1],ax-p,ay),d(x[2],y[2],ax-p,ay)) ){
			ax += p;
		}
		if(p<0.0001) break;

		p /= 2;
		}

		while(1){
		if(diff(d(x[0],y[0],ax,ay+q),d(x[1],y[1],ax,ay+q),d(x[2],y[2],ax,ay+q)) > diff(d(x[0],y[0],ax,ay-q),d(x[1],y[1],ax,ay-q),d(x[2],y[2],ax,ay-q))){
			ax -= q;
		}
		else if(diff(d(x[0],y[0],ax,ay+q),d(x[1],y[1],ax,ay+q),d(x[2],y[2],ax,ay+q)) < diff(d(x[0],y[0],ax,ay-q),d(x[1],y[1],ax,ay-q),d(x[2],y[2],ax,ay-q))){
			ax += q;
		}
		if(q<0.0001) break;

		q /= 2;
		}
	}

	double a, b, c;
	a = d(x[0],y[0],x[1],y[1]); b = d(x[1],y[1],x[2],y[2]); c = d(x[2],y[2],x[0],y[0]);
	r = sqrt((a*a+b*b+c*c)*(a*a+b*b+c*c) - (a*a*a*a + b*b*b*b + c*c*c*c))/4;
	r *= 2/(a+b+c);

	printf("%.3f %.3f %.3f\n",ax, ay, r);
	return 0;
}

C++: #include "stdio.h"
#include <iostream>
using namespace std;

/** Problem0010 : CIrcumscribed Circle of a Triangle **/
int main()
{
	int N;
	double X1, Y1, X2, Y2, X3, Y3;
	double a, b, c, d, e, f, l, m, n;
	cin >> N;
	for (int i=0; i<N; i++) {
		cin >> X1 >> Y1 >> X2 >> Y2 >> X3 >> Y3;
		a = X1-X2; b = Y1-Y2; c = -(X1*X1+Y1*Y1-X2*X2-Y2*Y2);
		d = X2-X3; e = Y2-Y3; f = -(X2*X2+Y2*Y2-X3*X3-Y3*Y3);
		l = (c*e - b*f)/(e*a - b*d); m = (c*d - a*f)/(b*d - a*e);
		n = -(X1*X1+Y1*Y1+l*X1+m*Y1);
		printf("%.3f %.3f %.3f\n",l*-0.5,m*-0.5,sqrt(l*l+m*m-n*4.0)/2.0);
	}
	return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};

int main()
{
  int N;
  cin >>N;
  double x1,y1,x2,y2,x3,y3;
  for(int i = 0;i < N;i++){
    cin >>x1>>y1>>x2>>y2>>x3>>y3;
    double a =(x1-x2);
    double b =(y1-y2);
    double c = -(pow(x1,2)+pow(y1,2))+(pow(x2,2)+pow(y2,2));
    double d =(x2-x3);
    double e =(y2-y3);
    double f =-(pow(x2,2)+pow(y2,2))+(pow(x3,2)+pow(y3,2));
    double l =(c*e-f*b)/(a*e-d*b);
    double m =(c*d-a*f)/(b*d-a*e);
    double n = -(pow(x1,2)+pow(y1,2))-(l*x1+m*y1);
    double x = -l/2;
   
    double y =-m/2;
   
    double r =(sqrt(pow(l,2)+pow(m,2)-4*n))/4.0;
    printf("%.3f %.3f %.3f\n",x,y,r);
  }
  
  return 0;
}

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

int main()
{
    int n;
    double x1,y1,x2,y2,x3,y3,x,y,r,d,dx1,dx2,dx3;
    cin>>n;
    while(n--)
    {
        cin>>x1>>y1>>x2>>y2>>x3>>y3;
        d=2*(x1*(y2-y3)+x2*(y3-y1)+x3*(y1-y2));
        dx=x1*x1+y1*y1;
        dx2=x2*x2+y2*y2;
        dx3=x3*x3+y3*y3;
        x=(dx1*(y2-y3)+dx2*(y3-y3)+dx3*(y1-y2))/d;
        y=(dx1*(x3-x2)+dx2*(x1-x3)+dx3*(x2-x1))/d;
        r=sqrt(pow(x1-x,2)+pow(y1-y,2));
        printf("%.3lf %.3lf %.3lf\n",x,y,r);
    }
    return 0;
}