Go: package main

import (
	"fmt"
	"math"
)

func main() {
	var num int
	fmt.Scan(&num)
	for i := 0; i < num; i++ {
		var x1, y1, x2, y2, x3, y3 float64
		fmt.Scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3)

		a := 2 * (x2 - x1)
		b := 2 * (y2 - y1)
		c := 2 * (x3 - x1)
		d := 2 * (y3 - y1)
		e := x2*x2 - x1*x1 + y2*y2 - y1*y1
		f := x3*x3 - x1*x1 + y3*y3 - y1*y1

		// 直線1: ax + by - e = 0
		// 直線2: cx + dy - f = 0
		px := (d*e - b*f) / (a*d - b*c)
		py := (c*e - a*f) / (b*c - a*d)
		r := math.Sqrt((px-x1)*(px-x1) + (py-y1)*(py-y1))
		fmt.Printf("%.3f %.3f %.3f\n", px, py, r)
	}
}

Python: def main():
    import math
    for i in range(int(input())):
        x1,y1,x2,y2,x3,y3=map(float,input().split())

        a=y1-y2
        b=y1-y3

        if a==0:
            x=(x1+x2)/2
            c=(x3-x1)/(y1-y3)
            d=c*(-x1-x3)/2+(y1+y3)/2
            y=c*x+d

        elif b==0:
            x=(x1+x3)/2
            c=(x2-x1)/(y1-y2)
            d=c*(-x1-x2)/2+(y1+y2)/2
            y=c*x+d

        else:
            a=(x2-x1)/(y1-y2)
            b=a*(-x1-x2)/2+(y1+y2)/2
            c=(x3-x1)/(y1-y3)
            d=c*(-x1-x3)/2+(y1+y3)/2

            x=(d-b)/(a-c)
            y=a*x+b

        r=math.sqrt((x-x1)**2+(y-y1)**2)

        print('{:.3f} {:.3f} {:.3f}'.format(x, y, r))

Python: import math
n = int(input())
for i in range(n):
    x1,y1,x2,y2,x3,y3 = map(float,input().split())
    a = 2*(x2 - x1)
    b = 2*(y2 - y1)
    c = x2**2 + y2**2 - x1**2 -y1**2
    d = 2*(x3 - x1)
    e = 2*(y3 - y1)
    f = x3**2 + y3**2 - x1**2 -y1**2
    x = (c*e - f*b)/(a*e - b*d)
    y = (c*d - f*a)/(b*d - e*a)
    r = math.sqrt((x1 - x)**2 + (y1 - y)**2)
    x = round(x,3)
    y = round(y,3)
    r = round(r,3)
    if x == -0.0:
        x = 0.0
    if y == -0.0:
        y = 0.0
    print("{0:.3f}".format(x),end = ' ')
    print("{0:.3f}".format(y),end = ' ')
    print("{0:.3f}".format(r))

Python: 
import sys
import math


def solv(x1, y1, x2, y2, x3, y3):
    if y2 == y1:
        xp = 0.5 * (x1 + x2)
        yp = (x3 - x1)/(y3 - y1) * xp + 0.5 * (y1 + y3 - (x3**2 - x1**2)/(y3 - y1))
    elif y3 == y1:
        xp = 0.5 * (x1 + x3)
        yp = (x2 - x1)/(y2 - y1) * xp + 0.5 * (y1 + y2 - (x2**2 - x1**2)/(y2 - y1))
    else:
        xp = 0.5 * (y3 - y2 - (x3**2 - x1**2)/(y3 - y1) + (x2**2 - x1**2)/(y2 - y1))/((x2 - x1)/(y2 - y1) - (x3 - x1)/(y3 - y1))
        yp = (x2 - x1)/(y2 - y1) * xp + 0.5 * (y1 + y2 - (x2**2 - x1**2)/(y2 - y1))
    r = math.sqrt((x1 - xp)**2 + (y1 - yp)**2)
    return (xp, yp, r)



#input_file = open(sys.argv[1], "r")
#lines = input_file.readlines()
lines = sys.stdin.readlines()
lines.pop(0)

for line in lines:
    l = map((lambda x: float(x)), line.split(' '))
    x1 = l[0]
    y1 = l[1]
    x2 = l[2]
    y2 = l[3]
    x3 = l[4]
    y3 = l[5]
    xp, yp, r = solv(x1, y1, x2, y2, x3, y3)
    print("%5.3f %5.3f %5.3f" % (round(xp, 3), round(yp, 3), round(r, 3)))

Python: from math import *
def g(x):
    y = (int((1000 * abs(x)) * 2 + 1) // 2) / 1000
    if x < 0:
        y *= -1
    return y
def f(x):
    a = (x[2] - x[4]) * (x[1] - x[3]) - (x[0] - x[2]) * (x[3] - x[5])
    b = (x[0] - x[2]) * (x[4] - x[0]) - (x[5] - x[1]) * (x[1] - x[3])
    l = 0.5 * b / a
    X = 0.5 * x[2] + 0.5 * x[4] + l * (x[3] - x[5])
    Y = 0.5 * x[3] + 0.5 * x[5] + l * (x[4] - x[2])
    R = sqrt((X - x[0]) ** 2 + (Y - x[1]) ** 2)
    X = g(X)
    Y = g(Y)
    R = g(R)
    print("{0:.3f} {1:.3f} {2:.3f}".format(X, Y, R))
n = int(input())
a = []
for _ in range(n):
    a.append(list((map(float, input().split()))))
for i in a:
    f(i)

Python: 
import sys
import math


def solv(x1, y1, x2, y2, x3, y3):
    if y2 == y1:
        xp = 0.5 * (x1 + x2)
        yp = (x3 - x1)/(y3 - y1) * xp + 0.5 * (y1 + y3 - (x3**2 - x1**2)/(y3 - y1))
    elif y3 == y1:
        xp = 0.5 * (x1 + x3)
        yp = (x2 - x1)/(y2 - y1) * xp + 0.5 * (y1 + y2 - (x2**2 - x1**2)/(y2 - y1))
    else:
        xp = 0.5 * (y3 - y2 - (x3**2 - x1**2)/(y3 - y1) + (x2**2 - x1**2)/(y2 - y1))/((x2 - x1)/(y2 - y1) - (x3 - x1)/(y3 - y1))
        yp = (x2 - x1)/(y2 - y1) * xp + 0.5 * (y1 + y2 - (x2**2 - x1**2)/(y2 - y1))
    r = math.sqrt((x1 - xp)**2 + (y1 - yp)**2)
    return (xp, yp, r)



#input_file = open(sys.argv[1], "r")
#lines = input_file.readlines()
lines = sys.stdin.readlines()
lines.pop(0)

for line in lines:
    l = map((lambda x: float(x)), line.split(' '))
    x1 = l[0]
    y1 = l[1]
    x2 = l[2]
    y2 = l[3]
    x3 = l[4]
    y3 = l[5]
    xp, yp, r = solv(x1, y1, x2, y2, x3, y3)
    print("%5.3f %5.3f %5.3f" % (xp, yp, r))

Python: for _ in[0]*int(input()):
 a,b,c,d,e,f=map(int,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-d)+(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:.4} {y:.4} {(x*x+y*y)**.5:.4}")

Python: n = int(input())
import math
for _ in range(n):
    ax,ay,bx,by,cx,cy = [float(i) for i in input().split()]
    ab = math.sqrt((ax-bx)**2+(ay-by)**2)
    bc = math.sqrt((bx-cx)**2+(by-cy)**2)
    ca = math.sqrt((cx-ax)**2+(cy-ay)**2)
    cos_a = (ab**2+ca**2-bc**2)/(2*ab*ca)
    sin_a = math.sqrt(1-cos_a**2)
    r = bc/(2*sin_a)
    px = ((ay-cy)*(ay**2 -by**2 +ax**2 -bx**2) -(ay-by)*(ay**2 -cy**2 +ax**2 -cx**2)) / (2*(ay-cy)*(ax-bx)-2*(ay-by)*(ax-cx))
    py = ((ax-cx)*(ax**2 -bx**2 +ay**2 -by**2) -(ax-bx)*(ax**2 -cx**2 +ay**2 -cy**2)) / (2*(ax-cx)*(ay-by)-2*(ax-bx)*(ay-cy))
    def round3(x):
        x_ = x*10**3
        if x_%1 < 0.5:
            x_ = math.floor(x_)
        else:
            x_ = math.ceil(x_)
        return x_*10**(-3)
        
            
    print("{:.3f} {:.3f} {:.3f}".format(round3(px),round3(py),round3(r)))

Python: import math

n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    a1 = x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2
    a2 = y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2
    px = ((y1 - y3) * a1 - (y1 - y2) * a2) / \
        (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3))
    py = ((x1 - x3) * a1 - (x1 - x2) * a2) / \
        (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3))
    r = math.sqrt(px ** 2 + py ** 2)
    print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))

Python: import math

def run():
    n = int(input())
    epsilon = 1e-16
    for _ in range(n):
        x1, y1, x2, y2, x3, y3 = list(map(float, input().split()))
        u1 = (x1-x3)*(x2-x1)*(x3-x2)
        u2 = (x2-x1)*(y3-y2)*(y3+y2)
        u3 = (x3-x2)*(y2-y1)*(y2+y1)
        v = x1*x2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 + x3*y2
        Py = (-u1 + u2 - u3) / v / 2
        Px = (x2**2 - x1**2 + y2**2 - y1**2 - (y2 - y1)*Py) / (x2-x1 + epsilon) / 2
        r = math.sqrt((Px-x1)**2 + (Py-y1)**2)
        print('{0:.3f} {1:.3f} {2:.3f}'.format(round(Px,3), round(Py,3), round(r,3)))

if __name__ == '__main__':
    run()

Python: def f1(a, b, c, d):  # 2点の中心を通り垂直な線の傾きと切片
    k = (a - c) / (d - b)
    h = ((b + d) - k * (a + c)) / 2
    return k, h


def f2(a, b, c, d):  # 2直線との交点
    x = (d - b) / (a - c)
    y = a * x + b

    return x, y


def f3(a, b, c, d):
    return ((c - a) ** 2 + (d - b) ** 2) ** 0.5


def main():
    N = int(input())
    for i in range(N):
        a, b, c, d, e, f = map(float, input().split())
        T = []
        if not b == d:
            k, h = f1(a, b, c, d)
            T.append((k, h))
        if not d == f:
            k, h = f1(c, d, e, f)
            T.append((k, h))
        if not  f == b:
            k, h = f1(e, f, a, b)
            T.append((k, h))
        x, y = f2(T[0][0], T[0][1], T[1][0], T[1][1])
        r = f3(x, y, a, b)
        print(f'{round(x, 3):.3f} {round(y, 3):.3f} {round(r, 3):.3f}')


if __name__ == '__main__':
    main()