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)
}

Python: import cmath

class Point(object):
    def __init__(self, x, y):
        self.point = complex(x, y)
    def __str__(self):
        return "x = {0}, y = {1}".format(self.point.real, self.point.imag)

class Triangle(Point):
    def __init__(self, a, b, c):
        self.a = a
        self.b = b
        self.c = c
        # ３辺の長さ
        self.edgeA = abs(b.point-c.point)
        self.edgeB = abs(c.point-a.point)
        self.edgeC = abs(a.point-b.point)
        # ３角の大きさ
        self.angleA = Triangle.angle(self.edgeA, self.edgeB, self.edgeC)
        self.angleB = Triangle.angle(self.edgeB, self.edgeC, self.edgeA)
        self.angleC = Triangle.angle(self.edgeC, self.edgeA, self.edgeB)

    # 角度を求める
    def angle(A, B, C):
        return cmath.acos( (B*B+C*C-A*A)/(2*B*C) )


    # 外接円の半径
    def circumscribedCircleRadius(self):
        return abs((self.edgeA/cmath.sin(self.angleA))/2)

    # 外心
    def circumscribedCircleCenter(self):
        A = cmath.sin(2*self.angleA)
        B = cmath.sin(2*self.angleB)
        C = cmath.sin(2*self.angleC)
        X = (self.a.point.real*A + self.b.point.real*B + self.c.point.real*C) / (A+B+C)
        Y = (self.a.point.imag*A + self.b.point.imag*B + self.c.point.imag*C) / (A+B+C)
        return complex(X, Y)

line = list(map(float, input().split()))
p1 = Point(line[0], line[1])
p2 = Point(line[2], line[3])
p3 = Point(line[4], line[5])
T = Triangle(p1, p2, p3)
center = T.circumscribedCircleCenter()
print("{0:.4f} {1:.4f} {2:.4f}".format(center.real, center.imag, T.circumscribedCircleRadius()))

Python: # -*- coding: utf-8 -*-
from math import sqrt
# import numpy as np


n = int(input())

for i in range(n):
    tmp = input().split(' ')
    
    a, b, c = [(float(tmp[i]), float(tmp[i+1])) for i in range(0, len(tmp), 2)]
    
    #A = np.array(((a[0], a[1], 1),
    #              (b[0], b[1], 1),
    #              (c[0], c[1], 1)))
    A_tmp1 = 1/(a[0]*b[1] + a[1]*c[0] + b[0]*c[1] - b[1]*c[0] - a[1]*b[0] - a[0]*c[1])
    A_tmp2 = [[b[1]-c[1], -(a[1]-c[1]), a[1]-b[1]],
              [-(b[0]-c[0]),  (a[0]-c[0]), -(a[0]-b[0])],
              [b[0]*c[1] - b[1]*c[0], -(a[0]*c[1] - a[1]*c[0]), a[0]*b[1] - a[1]*b[0]]]
    A = [list(map(lambda x: A_tmp1*x, A_tmp2[i])) for i in range(3)]
    
    #B = np.array((((-(a[0]**2 + a[1]**2))),
    #              ((-(b[0]**2 + b[1]**2))),
    #              ((-(c[0]**2 + c[1]**2)))))
    B = [[-(a[0]**2 + a[1]**2)],
         [-(b[0]**2 + b[1]**2)],
         [-(c[0]**2 + c[1]**2)]]
    
    
    tmp = [sum([A[i][j]*B[j][0] for j in range(3)]) for i in range(3)]
    # tmp = np.dot(np.linalg.inv(A), B)
    print(tmp)
    
    x = -tmp[0]/2
    y = -tmp[1]/2
    r = sqrt((tmp[0]**2 + tmp[1]**2 - 4*tmp[2])/4)
    
    print('{:.3} {:.3} {:.3}'.format(x, y, r))

Python: from math import hypot

n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().strip().split())

    d = lambda x, y: x*x + y*y
    t21 = [2*(x2-x1), 2*(y2-y1), d(x2,y2) - d(x1,y1)]
    t31 = [2*(x3-x1), 2*(y3-y1), d(x3,y3) - d(x1,y1)]

    det = lambda i, j: t21[i]*t31[j] - t21[j]*t31[i]
    a = det(2,1) / det(0,1)
    b = det(0,2) / det(0,1)
    r = hypot(x1-a, y1-b)

    print('{:.3f} {:.3f} {:.3f}'.format(a, b, r))

Python: from decimal import Decimal
import math
for _ in range(int(input())):
    x1,y1,x2,y2,x3,y3=list(map(Decimal,input().split()))
    a=x1-x3
    b=y2-y3
    c=x2-x3
    d=y1-y3
    e=y1-y2
    f=x1+x3
    g=x2+x3
    X=(b*d*e+a*b*f-c*d*g)/2/(a*b-c*d)
    try:
        Y=-(a/d)*(X-f/2)+(y1+y3)/2
    except:
        Y=-(c/b)*(X-g/2)+(y2+y3)/2
    R=math.sqrt((x1-X)**2+(y1-Y)**2)
    print(" ".join(["{:.3f}".format(i) for i in [X,Y,R]]))

Python: from decimal import Decimal
import math
for _ in range(int(input())):
    x1,y1,x2,y2,x3,y3=list(map(Decimal,input().split()))
    a=x1-x3
    b=y2-y3
    c=x2-x3
    d=y1-y3
    e=y1-y2
    f=x1+x3
    g=x2+x3
    X=(b*d*e+a*b*f-c*d*g)/2/(a*b-c*d)
    try:
        Y=-(a/d)*(X-f/2)+(y1+y3)/2
    except:
        Y=-(c/b)*(X-g/2)+(y2+y3)/2
    R=math.sqrt((x1-X)**2+(y1-Y)**2)
    print(" ".join(["{:.3f}".format(i) for i in [X,Y,R]]))

Python: from math import sqrt

def circle(x1, y1, x2, y2, x3, y3):
    if x1 == 0:
        dx = 1
        x1 = x1 + dx
        x2 = x2 + dx
        x3 = x3 + dx
    else:
        dx = 0
    if y2 == 0:
        dy = 1
        y1 = y1 + dy
        y2 = y2 + dy
        y3 = y3 + dy
    else:
        dy = 0
    A = [[x1, y1, 1, 1, 0, 0],[x2, y2, 1, 0, 1, 0],[x3, y3, 1, 0, 0, 1]]
#    print(A)
    for i in range(3):
        A[0] = [x/A[0][0] for x in A[0]]
        A[1] = [A[1][j] - A[1][0] * A[0][j] for j in range(6)]
        A[2] = [A[2][j] - A[2][0] * A[0][j] for j in range(6)]
#        print(A)
        for j in range(3):
            A[j] = A[j][1:] + A[j][:1]
        A = A[1:] + A[:1]
#        print(A)
    for i in range(3):
        A[i] = A[i][:3]
#    print(A)
    V = [-x1**2-y1**2, -x2**2-y2**2, -x3**2-y3**2]
    M = [(A[i][0] * V[0] + A[i][1] * V[1] + A[i][2] * V[2]) for i in range(3)]
    xcenter = -0.5 * M[0] - dx
    ycenter = -0.5 * M[1] - dy
    radius = sqrt((M[0]**2) /4 + (M[1]**2) /4 - M[2])
    return xcenter, ycenter, radius

n = int(input())
for line in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    xc, yc, ra = circle(x1, y1, x2, y2, x3, y3)
    print(xc, yc,ra)

Python: n = int(input())
ans = []
for i in range(n):
    ax,ay,bx,by,cx,cy = map(float, input().split(" "))
    a,b,c = 2*(ax-bx),2*(ay-by),(ax+bx)*(ax-bx)+(ay+by)*(ay-by)
    d,e,f = 2*(ax-cx),2*(ay-cy),(ax+cx)*(ax-cx)+(ay+cy)*(ay-cy)
    det = a*e-b*d
    px = (c*e-b*f)/det
    py = (a*f-c*d)/det
    if abs(px) < 1e-4:
        px = 0.0
    if abs(py) < 1e-4:
        py = 0.0
    r = ((ax-px)**2+(ay-py)**2)**(1/2)
    ans.append([px,py,r])
for i in range(n):
    print("{0:.3f}".format(ans[i][0]),"{0:.3f}".format(ans[i][1]),"{0:.3f}".format(ans[i][2]))

Python: def simultaneous_equasion(a, b, c, d, e, f):
    "??£???????¨????"
    det = a * d - b * c
    a11 = d / det
    a12 = - b / det
    a21 = - c / det
    a22 = a / det
    return a11 * e + a12 * f, a21 * e + a22 * f

n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    # (x1, y1), (x2, y2)????????´????????????
    # 2 * (x2 - x1) * x + 2 * (y2 - y1) * y = (y2 - y1) ^ 2 + (x2 - x1) ^ 2
    a = 2 * (x2 - x1)
    b = 2 * (y2 - y1)
    c = 2 * (x3 - x1)
    d = 2 * (y3 - y1)
    e = (y2 - y1) ** 2 + (x2 - x1) ** 2
    f = (y3 - y1) ** 2 + (x3 - x1) ** 2
    px, py = simultaneous_equasion(a, b, c, d, e, f)
    print("%.3f %3f" % (round(px, 3), round(py, 3)))

Python: for _ in[0]*int(input()):
 a,b,c,d,e,f=map(float,input().split())
 x=((a*a+b*b)*(d-f)+(c*c+d*d)*(f-b)+(e*e+f*f)*(b-d))/2/(a*(d-f)+c*(f-b)+e*(b-d))
 y=((a*a+b*b)*(c-e)+(c*c+d*d)*(e-a)+(e*e+f*f)*(a-c))/2/(b*(c-e)+d*(e-a)+f*(a-c))
 print(f"{x:.3f} {y:.3f} {(x*x+y*y)**.5:.3f}")