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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }


struct P{ double x, y; };


int main()
{
	int n;
	cin >> n;
	
	rep(i, n)
	{
		vector<P> v(3);

		rep(i, 3)
			cin >> v[i].x >> v[i].y;

		double a = v[0].x - v[1].x;
		double b = v[0].y - v[1].y;
		double c = v[1].x - v[2].x;
		double d = v[1].y - v[2].y;

		double A = pow(v[1].x, 2.0) - pow(v[0].x, 2.0) + pow(v[1].y, 2.0) + pow(v[0].y, 2.0);
		double B = pow(v[2].x, 2.0) - pow(v[1].x, 2.0) + pow(v[2].y, 2.0) + pow(v[1].y, 2.0);

		double acbd = a * d - b * c;

		double x = -(A * d - B * b) / acbd / 2;
		double y = -(A *-c + B * a) / acbd / 2;

		double r = sqrt(pow(x - v[0].x, 2.0) + pow(y - v[0].y, 2.0));


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

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

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

  std::cin >> n;

  for(int i=0;i<n;i++){
    std::cin >> x1>>y1>>x2>>y2>>x3>>y3;
    a = 2*(x1-x2);
    b = 2*(y1-y2);
    c = +(x1*x1-x2*x2)+(y1*y1-y2*y2);
    d = 2*(x2-x3);
    e = 2*(y2-y3);
    f = +(x2*x2-x3*x3)+(y2*y2-y3*y3);

    x = (double)(c*e-b*f)/(a*e-b*d);
    y = (double)(a*f-c*d)/(a*e-b*d);

    if(x == 0){x = 0;}
    if(y == 0){y = 0;}

    r = sqrt((x-x1)*(x-x1)+(y-y1)*(y-y1));

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

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	complex<double> Ans;
	complex<double> P[3];
	for(int i=0;i<3;i++){
		cin>> P[i].real()>> P[i].imag();
	}
	complex<double> T[2];
	complex<double> K[2];
	for(int i=0;i<2;i++){
		T[i].real() = (P[i].real() + P[i+1].real()) / 2;
		T[i].imag() = (P[i].imag() + P[i+1].imag()) / 2;
		complex<double> N;
		N = (P[i+1]-P[i])/abs(P[i+1]-P[i]);
		K[i].real() =  N.imag();
		K[i].imag() = -N.real();
	}
	double a = (T[1]-T[0]).real();
	double b = (T[1]-T[0]).imag();
	double x0 = K[0].real();
	double y0 = K[0].imag();
	double x1 = K[1].real();
	double y1 = K[1].imag();
	double m = ( a * y0 - b * x0 ) / ( x0 * y1 - x1 * y0 );
	K[1] *= m;
	Ans = K[1] + T[1];

	printf("%.3f %.3f %.3f", Ans.real(), Ans.imag(), abs(Ans-P[0]));
	printf("\n");
	
	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(5);
	int n;
	cin>> n;
	for(int i=0;i<n;i++){
		solve();
	}
	return 0;
}

C++: #include<stdio.h>
#include<iostream>
#include<list>
#include<map>
#include<vector>
#include<algorithm>
#include<string.h>
#include<iomanip>
#include<cmath>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << x << endl;
using namespace std;

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

    cin >> n;
    rep(i,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;
        xans = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
        yans = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
        r = sqrt( (x1 - xans) * (x1 - xans) + (y1 - yans) * (y1 - yans) );
        cout << fixed;
        cout << setprecision(3) << xans << " " << yans << " " << r << endl;
    }
}

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

double jijo(double a){
	return a*a;
}
int main(){
	int n;
	double x1, y1, x2, y2, x3, y3;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
		double a1, a2, b1, b2;
		if(y1==y2){y1+=0.0000001;}
		a1 = (x2-x1)/(y1-y2);
		b1 = (y1+y2)/2.0 - a1*(x1+x2)/2.0;
		if(y1==y3){y1+=0.0000001;}
		a2 = (x3-x1)/(y1-y3);
		b2 = (y1+y3)/2.0 - a2*(x1+x3)/2.0;
		double x, y, d;
		x = (b2-b1)/(a1-a2);
		y = a1*x + b1;
		d = sqrt(jijo(x1-x) + jijo(y1-y));
		printf("%.3lf %.3lf %.3lf\n", x, y, d);
	}
	return 0;
}

C++: #include<iostream>
#include<cmath>
using namespace std;
int main(){
	int k;
	double x[3], y[3], a, b, c, d, e, f, l , m, n;
	cin >> k;
	while(k--){
????????????????cin>> x[0] >> y[0] >> x[1] >> y[1] >> x[2] >> y[2];
		
		a = 2 * (x[1] - x[0]);
		b = 2 * (y[1] - y[0]);
		c = ( (x[1]*x[1]) + (y[1]*y[1]) ) -( (x[0]*x[0]) + (y[0]*y[0]) );
		
		d = 2 * (x[2] - x[0]);
		e = 2 * (y[2] - y[0]);
		f = ( (x[2]*x[2]) + (y[2]*y[2]) ) -( (x[0]*x[0]) + (y[0]*y[0]) );
		
		l = (c*e - f*b) / (a*e - d*b);
		m = (c*d - f*a) / (b*d - e*a);
		
		n = sqrt((l - x[0])*(l - x[0]) + (m - y[0])*(m - y[0]));
		
		cout << fixed << setprecision(3) << l << " " << m << " " << n << endl;
	}
}

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 a = 2 * x1 - 2 * x2, b = 2 * y1 - 2 * y2, c = x1 * x1 - x2 * x2 + y1 * y1 - y2 * y2, d = 2 * x1 - 2 * x3, e = 2 * y1 - 2 * y3, f = x1 * x1 - x3 * x3 + y1 * y1 - y3 * y3;
		double px = (c * e - b * f) / (a * e - b * d), py = (a * f - c * d) / (a * e - b * d), r = hypot(x1 - px, y1 - py);
		cout << fixed << setprecision(3) << px << ' ' << py << ' ' << r << endl;
	}
}

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

using namespace std;

int main(void) {
	int ds;
	
	cin >> ds;
	
	for(int i = 0; i < ds; i++) {
		cin.ignore();
		double X[3] = { 0 };
		double Y[3] = { 0 };
		double ans[3] = { 0 };
		
		double a1, b1, c1, a2, b2, c2;
		
		for(int j = 0; j < 3; j++) {
			cin >> X[j] >> Y[j];
		}
		
		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];
		
		ans[0] = (b1 * c2 - b2 * c1) / (a1 * b2 - a2 * b1);
		ans[1] = (c1 * a2 - c2 * a1) / (a1 * b2 - a2 * b1);
		ans[2] = sqrt( (ans[0] - X[0]) * (ans[0] - X[0]) + (ans[1] - Y[0]) * (ans[1] - Y[0]) );
		
		printf("%.3f %.3f %.3f\n", ans[0], ans[1], ans[2]);
	}
	
	return 0;
}