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

Python: import math

def da(li):
    x1,y1,x2,y2,x3,y3=[float(i) for i in li]
    xp,yp=(x2-x1)/2,(y2-y1)/2
    xq,yq=(x3-x1)/2,(y3-x1)/2
    t=(xq**2+yq**2-xp*xq-yp*yq)/(xp*yq-xq*yp)
    return x1-(xp-t*yp),y1-(yp+t*xp)
def sis(fl):
    fls=str(fl)
    if len(fls)<6:return fls+"".join(["0" for i in range(5-len(fls))])
    if int(fls[5:6])>4:
        return fls[:4]+str(int(fls[4:5])+1)
    else:
        return fls[:5]

n=int(input())
for i in range(n):
    li=input().split(" ")
    x,y=da(li)
    print(sis(x)+" "+sis(y)+" "+sis(math.sqrt(x**2+y**2)))

Python: from math import sqrt 
for _ in range(int(input())) :
    x1, y1, x2, y2, x3, y3 = [float(temp) for temp in input().split()]
    a = [x1, y1, (x1 ** 2) + (y1 ** 2)]
    b = [x2, y2, (x2 ** 2) + (y2 ** 2)]
    c = [x3, y3, (x3 ** 2) + (y3 ** 2)]
    a1 = [(b[0] - a[0]), (b[1] - a[1]), (b[2] - a[2])]
    b1 = [(c[0] - a[0]), (c[1] - a[1]), (c[2] - a[2])]
    a1[1], a1[2] = (a1[1] / a1[0]), (a1[2] / a1[0])
    b1[1], b1[2] = (b1[1] / b1[0]), (b1[2] / b1[0])
    m = -(a1[2] - b1[2]) / (a1[1] - b1[1])
    l = -(a1[1] * m + a1[2])
    n = -((l * a[0]) + (m * a[1]) + a[2])
    px = -l / 2
    py = -m / 2
    r  = sqrt(((l / 2) ** 2)+((m / 2) ** 2)+n)
    print('{:0.3f} {:0.3f} {:0.3f}'.format(px, py, r))

Python: #!/usr/bin/env 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 = "{0:.3f}".format(g(X))
	Y = "{0:.3f}".format(g(Y))
	R = "{0:.3f}".format(g(R))
	if X == "-0.000" or Y == "-0.000" or R == "-0.000":
		while True:
			X += 0
	print(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
n = int(sys.stdin.readline().rstrip())
for i in range(n):
    x1,y1,x2,y2,x3,y3 = map(float, sys.stdin.readline().rstrip().split(' '))
    p = ((y1-y3)*(y1**2-y2**2+x1**2-x2**2)-(y1-y2)*(y1**2-y3**2+x1**2-x3**2)) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3))
    q = ((x1-x3)*(x1**2-x2**2+y1**2-y2**2)-(x1-x2)*(x1**2-x3**2+y1**2-y3**2)) / (2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3))
    r = math.sqrt((p-x1)**2 + (p-y1)**2)
    print("{:0.3f} {:0.3f} {:0.3f}".format(round(p,3),round(q,3),round(r,3)))

Python: def main():
	import math
	n = int(input())
	w = [0]*6

	for _ in range(n):
		x1, y1, x2, y2, x3, y3 = map(float, input().split())
		w[0] = 2*(x2-x1)
		w[1] = 2*(y2-y1)
		w[2] = x2**2 + y2**2 - x1**2 - y1**2
		w[3] = 2*(x3-x1)
		w[4] = 2*(y3-y1)
		w[5] = x3**2 + y3**2 - x1**2 - y1**2

		x, y = solve(w)

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

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


def solve(w):
	x = (w[2]*w[4]-w[1]*w[5]) / (w[0]*w[4]-w[1]*w[3])
	y = (w[2]*w[3]-w[0]*w[5]) / (w[1]*w[3]-w[0]*w[4])
	x = round(x, 3)
	y = round(y, 3)
	if x == -0.0:
	    x = 0.0
	if y == -0.0:
	    y = 0.0
	return x, y


if __name__ == '__main__':
	main()

Python: for _ in range(int(input())):
    a,d,b,e,c,f=map(float,input().split())
    z=2*(b*f-c*e+c*d-a*f+a*e-b*d)
    x=((e-f)*(a**2+d**2)+(f-d)*(b**2+e**2)+(d-e)*(c**2+f**2))/z
    y=((c-b)*(a**2+d**2)+(a-c)*(b**2+e**2)+(b-a)*(c**2+f**2))/z
    print('{0:.3f} {1:.3f} {2:.3f}'.format(x,y,((a-x)**2+(d-y)**2)**0.5))

Python: import math
for _ in range(int(input())):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    p = ((y1-y3)*(y1**2 -y2**2 +x1**2 -x2**2) -(y1-y2)*(y1**2 -y3**2 +x1**2 -x3**2)) / 2/ ((y1-y3)*(x1-x2)-(y1-y2)*(x1-x3))
    q = ((x1-x3)*(x1**2 -x2**2 +y1**2 -y2**2) -(x1-x2)*(x1**2 -x3**2 +y1**2 -y3**2)) / 2/ ((x1-x3)*(y1-y2)-(x1-x2)*(y1-y3))
    r = math.sqrt((x1 - p) ** 2 + (y1 - q) ** 2)
    print("{:.3f} {:.3f} {:.3f}".format(p, q, r))

Python: from math import sin,cos,sqrt
n=int(input())
out=[]
for i in range(n):
	I=list(map(float,input().split(" ")))
	#( (x_0,y_0), (x_1,y_1) , (x_2,y_2) )
	a_1=I[2]-I[0] #x_1-x_0
	a_2=I[4]-I[0] #x_2-x_0
	b_1=I[3]-I[1] #y_1-y_0
	b_2=I[5]-I[1] #y_2-y_0
	#print(a_1,b_1,a_2,b_2)

	K=(a_2**2 -a_2*b_2+a_1**2-a_1*b_1)/(a_2*b_1-a_1*b_2)

	O_x=0.5*(b_1-K*b_2)
	O_y=0.5*(b_2+K*b_1)
	O_R=sqrt( (I[0]-O_x)**2  + (I[1]-O_y)**2 )

	out.append( '{:.3f} {:.3f} {:.3f}'.format(O_x,O_y,O_R) )



for i in out:
	print(i)

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 math
n=int(input())
for i in range(n):
    x1,y1,x2,y2,x3,y3=[float(i) for i in input().split()]
    t1=x1*(x2+x3-x1)+y1*(y2+y3-y1)
    t2=x2*(x1+x3-x2)+y2*(y1+y3-y2)
    t3=x3*(x1+x2-x3)+y3*(y1+y2-y3)
    px=(t1*x1+t2*x2+t3*x3)/(t1+t2+t3)
    py=(t1*y1+t2*y2+t3*y3)/(t1+t2+t3)
    r=math.hypot(px-x1,py-y1)
    print("{0} {1} {2}".format(round(px,3),round(py,3),round(r,3)))

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.hypot(x1 - px, y1 - py)
    print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))

Python: import math
n = int(input())
    
for i in range(n) :
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    py = ((x3-x1)*(x1**2 + y1**2 - x2**2 - y2**2) - (x2-x1)*(x1**2 + y1**2 - x3**2 - y3**2)) / (2*(x3-x1)*(y1-y2) - 2*(x2-x1)*(y1-y3))
    if x1 == x2 :
        px = (2*(y1-y3)*py - x1**2 - y1**2 + x3**2 + y3**2) / (2*(x3 - x1))
    else :
        px = (2*(y1-y2)*py - x1**2 - y1**2 + x2**2 + y2**2) / (2*(x2 - x1))
    r = math.sqrt((px - x1)**2 + (py -y1)**2)

    print('{:.3f}'.format(px), '{:.3f}'.format(py), '{:.3f}'.format(r))

Python: import math
deta=[float(i) for i in input().split()]
h1=math.sqrt((deta[2]-deta[0])**2+(deta[3]-deta[1])**2)
h2=math.sqrt((deta[4]-deta[2])**2+(deta[5]-deta[3])**2)
h3=math.sqrt((deta[0]-deta[4])**2+(deta[1]-deta[5])**2)
sub=(h1+h2+h3)/2
s=math.sqrt(sub*(sub-h1)*(sub-h2)*(sub-h3))
sum=((h1*h2*h3)/s)/4

a=2*deta[2]-2*deta[0]
b=2*deta[3]-2*deta[1]
c=-(deta[0]**2+deta[1]**2-(deta[2]**2)-(deta[3]**2))
d=2*deta[4]-2*deta[2]
e=2*deta[5]-2*deta[3]
f=-(deta[2]**2+deta[3]**2-(deta[4]**2)-(deta[5]**2))

x=(e*c-b*f)/(a*e-b*d)
y=(a*f-c*d)/(a*e-b*d)
print("{0:.3f} {1:.3f} {2:.3f}".format(x,y,sum))