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 <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <iomanip>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define SQ(i) ((i) * (i))
using namespace std;

int main(){
  double x1, y1, x2, y2, x3, y3;
  double a1, b1, c1, a2, b2, c2, x, y, a, b, c, cos_a, sin_a, r;
  int n;
  scanf("%d", &n);
  while(n--){
    scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
    a1 = 2 * (x2 - x1); a2 = 2 * (x3 - x1);
    b1 = 2 * (y2 - y1); b2 = 2 * (y3 - y1);
    c1 = SQ(x1) - SQ(x2) + SQ(y1) - SQ(y2);
    c2 = SQ(x1) - SQ(x3) + SQ(y1) - SQ(y3);
    x = (b1 * c1 - b2 * c1) / (a1 * b2 - a2 * b1);
    y = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);

    r = SQ(x3-x) + SQ(y3 - y);
    r = sqrt(r);
    printf("%.3f %.3f %.3f\n",x, y, r);
  }
  return 0;
}

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

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 c1 = (x1 + x2) / 2;
		double c2 = (x1 + x3) / 2;
		double d1 = (y1 + y2) / 2;
		double d2 = (y1 + y3) / 2;
		double k1 = (y2 - y1) / (x2 - x1);
		double k2 = (y3 - y1) / (x3 - x1);
		double px = (k1 * k2 * (d2 - d1) + c2 * k1 - c1 * k2) / (k1 - k2);
		double py = (c2 - c1 + k2 * d2 - k1 * d1) / (k2 - k1);
		double r = sqrt((px - x1)*(px - x1) + (py - y1)*(py - y1));
		cout << setprecision(3);
		cout << fixed;
		cout << px << " " << py <<" "<<r<< endl;
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
int main(){

  double x1,x2,x3,y1,y2,y3;
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    cin>>x1>>y1>>x2>>y2>>x3>>y3;
    double ax,ay,a,b,c,d,e,f,r;
    if(y2!=y1){
      a=-(x2-x1)/(y2-y1);
      b=-1;
      c=-a*(x1+x2)/2+(y1+y2)/2;
    }else{
      a=1;
      b=0;
      c=(x1+x2)/2;
    }
    if(y3!=y2){
      d=-(x3-x2)/(y3-y2);
      e=-1;
      f=-a*(x2+x3)/2+(y2+y3)/2;
    }else{
      d=1;
      e=0;
      f=(x2+x3)/2;
    }
    ax=(c*e-b*f)/(a*e-b*d);
    ay=(a*f-c*d)/(a*e-b*d);
    if(ax==0)
      ax=0;
    if(ay==0)
      ay=0;
    r=sqrt((x1-ax)*(x1-ax)+(y1-ay)*(y1-ay));
    printf("%0.3f %0.3f %0.3f\n",ax,ay,r);
  }

}

  //y=a(x-a1)+b1
  //y=ax-a*a1+b1
  //ax-y=-a*a1+b1

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

int d(int x1,int y1,int x2,int y2) {
    int k;
    k = sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
    return k;
}
int main()
{
    int n;
    cin >> n;
    for (int k = 0; k < n; k++) {
        int A[3][2];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 2; j++) {
                cin >> A[i][j];
            }
        }
        cout << d(A[0][0], A[0][1], A[1][0], A[1][1]) << endl;
        cout << d(A[1][0], A[1][1], A[2][0], A[2][1]) << endl;
        cout << d(A[2][0], A[2][1], A[0][0], A[0][1]) << endl;
    }
    
    return 0;
}

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

void gradcut(double *a,double *b,double x1,double y1,double x2,double y2);
double fixzero(double z){
    if (fabs(z) < 1e-6) return fabs(z);
    else return z;
}
int main() {
    double x[3],y[3],a[2],b[2],rx,ry,r;
    int n;
    std::cin >> n;
    for(int j=0;j<n;j++){
        int am=0,add=1;;
        for(int i=0;i<3;i++) std::cin >> x[i] >> y[i];
        for(int i=0;i<3;i++){
            if(i==2) add=-2;
            if(x[i]!=x[i+add]&&y[i]!=y[i+add]){
                gradcut(&a[am],&b[am],x[i],x[i+add],y[i],y[i+add]);
                am++;
                if(am>2) break;
            }else if(x[i]==x[i+add]){
                a[am]=0;
                b[am]=(y[i]+y[i+add])/2;
                am++;
                if(am>2) break;
            }
        }


        rx = (b[1]-b[0])/(a[0]-a[1]);
        ry = a[0]*rx+b[0];
        r=sqrt((x[0]-rx)*(x[0]-rx)+(y[0]-ry)*(y[0]-ry));
        printf("%.3f %.3f %.3f\n",fixzero(rx),fixzero(ry),fixzero(r));
    }
    return 0;
}

void gradcut(double *a,double *b,double x1,double x2,double y1,double y2){
    *a=-(x2-x1)/(y2-y1);
    *b=(y1+y2)/2-(*a)*(x1+x2)/2;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#define fi first
#define se second
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=10000009;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };
int main() {
	double x1,y1,x2,y2,x3,y3,px,py,r;
	double a1,a2,a3,a4;
 	int n,count=0;
 	cin>>n;
	while(true){
		if(count==n) break;
		cin>>x1>>y1>>x2>>y2>>x3>>y3;
		a1=(y1-y3)*(y1*y1-y2*y2+x1*x1-x2*x2)-(y1-y2)*(y1*y1-y3*y3+x1*x1-x3*x3);
		a2=(y1-y3)*(x1-x2)-(y1-y2)*(x1-x3);
		a2*=2.0;
		a3=(x1-x3)*(x1*x1-x2*x2+y1*y1-y2*y2)-(x1-x2)*(x1*x1-x3*x3+y1*y1-y3*y3);
		a4=(x1-x3)*(y1-y2)-(x1-x2)*(y1-y3);
		a4*=2.0;
		px=a1/a2;
		py=a3/a4;
		r=(px-x1)*(px-x1)+(py-y1)*(py-y1);
		r=pow(r,0.5);
		printf("%.3lf %.3lf %.3lf\n",px,py,r);
		count++;
	}
}

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

double calc_coefficient(double a,double b,double c) {
  return a*a * (b*b + c*c - a*a);
}
double calc_edge(double x1,double y1,double x2,double y2) {
  return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}
double calc_surface(double a,double b,double c) {
  double s = (a + b + c) / 2.0;
  return s * (s-a) * (s-b) * (s-c);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(3);
  cout.setf(ios::fixed);

  int n;
  cin >> n;
  while(n--) {
    double x1,y1,x2,y2,x3,y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    double a = calc_edge(x2,y2,x3,y3);
    double b = calc_edge(x3,y3,x1,y1);
    double c = calc_edge(x1,y1,x2,y2);

    double px = calc_coefficient(a,b,c)*x1 + calc_coefficient(b,c,a)*x2 + calc_coefficient(c,a,b)*x3;
    px = px / (16 * calc_surface(a,b,c));
    double py = calc_coefficient(a,b,c)*y1 + calc_coefficient(b,c,a)*y2 + calc_coefficient(c,a,b)*y3;
    py = py / (16 * calc_surface(a,b,c));
    cout << px << " " << py << " " <<  calc_edge(px,py,x1,y1) << endl;
  }


}