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 run():
    n = int(input())
    epsilon = 1e-40
    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: 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: import math
 
n = int(input())
positions = []
for i in range(n):
  positions.append(list(map(float, input().split())))
  
for i in range(n):
  ra = [positions[i][0],positions[i][1]]
  rb = [positions[i][2],positions[i][3]]
  rc = [positions[i][4],positions[i][5]]
 
  A = (rb[0]-rc[0])**2+(rb[1]-rc[1])**2
  B = (rc[0]-ra[0])**2+(rc[1]-ra[1])**2
  C = (ra[0]-rb[0])**2+(ra[1]-rb[1])**2
 
  P = A * (B+C-A)
  Q = B * (C+A-B)
  R = C * (A+B-C)
 
  rcc_x = (P*ra[0] + Q*rb[0] + R*rc[0]) / (P+Q+R)
  rcc_y = (P*ra[1] + Q*rb[1] + R*rc[1]) / (P+Q+R)
 
  radius = math.sqrt((rcc_x-positions[i][0])**2+(rcc_y-positions[i][1])**2)
  print("{0:.3f} {1:.3f} {2:.3f}".format(rcc_x,rcc_y,radius))

Python: n = int(input())
datasets = [0]*n
#datasets[k] == [x1k,y1k,x2k,y2k,x3k,y3k]
for i in range(0,n):
  datasets[i] = list(map(float,input().split()))

for data in datasets:
  x1p2=(data[0]+data[2])
  x1m2=(data[0]-data[2])
  x1p3=(data[0]+data[4])
  x1m3=(data[0]-data[4])
  y1p2=(data[1]+data[3])
  y1m2=(data[1]-data[3])
  y1p3=(data[1]+data[5])
  y1m3=(data[1]-data[5])
  x=(x1p2*x1m2*y1m3+y1p2*y1m2*y1m3-x1p3*x1m3*y1m2-y1p3*y1m3*y1m2)/(2*(x1m2*y1m3-x1m3*y1m2))
  y=(y1p2*y1m2*x1m3+x1p2*x1m2*x1m3-y1p3*y1m3*x1m2-x1p3*x1m3*x1m2)/(2*(y1m2*x1m3-y1m3*x1m2))
  r=((x-data[0])**2+(y-data[1])**2)**(1/2)
  if x == 0.000:
    x=0
  if y == 0.000:
    y=0
  print("{0:.3f} {1:.3f} {2:.3f}\n".format(x,y,r))

Python: 
import math

PI = math.pi
EPS = 10**-10

def edge(a, b):
    return ((a[0]-b[0])**2+(a[1]-b[1])**2)**.5

def area(a, b, c):
    s = (a+b+c)/2
    return (s*(s-a)*(s-b)*(s-c))**.5

def LawOfCosines(a, b, c): #余弦定理
    return math.acos( (b*b+c*c-a*a) / (2.0*b*c) );

def is_same(x, y): 
    return abs(x-y) < EPS

class Triangle:
    def __init__(self, p):
        a, b, c = p
        self.a = a
        self.b = b
        self.c = c

        self.edgeA = edge(b, c)
        self.edgeB = edge(c, a)
        self.edgeC = edge(a, b)

        self.area = area(self.edgeA, self.edgeB, self.edgeC)

        self.angleA = LawOfCosines(self.edgeA, self.edgeB, self.edgeC)
        self.angleB = LawOfCosines(self.edgeB, self.edgeC, self.edgeA)
        self.angleC = LawOfCosines(self.edgeC, self.edgeA, self.edgeB)

    def circumscribeadCircleRadius(self): #外接円の半径を返す
        return self.edgeA / math.sin(self.angleA) / 2.0

    def circumscribedCircleCenter(self): #外接円の中心の座標を返す
        a = math.sin(2.0*self.angleA);
        b = math.sin(2.0*self.angleB);
        c = math.sin(2.0*self.angleC);
        X = (self.a[0] * a + self.b[0] * b + self.c[0] * c) / (a+b+c);
        Y = (self.a[1] * a + self.b[1] * b + self.c[1] * c) / (a+b+c);
        return X, Y

    def inscribedCircleRadius(self): #内接円の半径
        return 2 * self.area / (self.edgeA + self.edgeB + self.edgeC)

    def inscribedCircleCenter(self): #内接円の中心の座標
        points = [self.a, self.b, self.c]
        edges = [self.edgeA, self.edgeB, self.edgeC]
        s = sum(edges)
        return [sum([points[j][i]*edges[j] for j in range(3)])/s for i in range(2)]

    def isInner(self, p): #点が三角形の内側か判定
        cross = lambda a, b: a[0]*b[1]-a[1]*b[0]

        c1 = 0
        c2 = 0
        points = [self.a, self.b, self.c]
        for i in range(3):
            a = [points[i][0]-points[(i+1)%3][0], points[i][1]-points[(i+1)%3][1]]
            b = [points[i][0]-p[0],  points[i][1]-p[1]]
            c = cross(a, b)
            if c > 0:
                c1 += 1
            elif c < 0:
                c2 += 1
        if c1 == 3 or c2 == 3:
            return True
        else:
            return c1+c2 != 3 and (c1 == 0 or c2 == 0)


if __name__ == "__main__":
    n = int(input())
    for _ in range(n):
        points = []
        c = list(map(float, input().split()))
        points = [(c[i], c[i+1]) for i in range(0, 6, 2)]
        t = Triangle(points)

        #外接円
        x, y = t.circumscribedCircleCenter()
        r = t.circumscribeadCircleRadius()
        print("{:.3f} {:.3f} {:.3f}".format(x,y,r))

Python: import sys
f = sys.stdin

def take2(iterable):
    while True:
        yield next(iterable), next(iterable)
#外積
def cross(v1, v2):
    return v1.real * v2.imag - v1.imag * v2.real
# 線分13と線分24の交点を求める
def get_intersection(p1,p2,p3,p4):
    a1 = p4 - p2
    b1 = p2 - p3
    b2 = p1 - p2
    s1 = cross(a1, b2) / 2
    s2 = cross(a1, b1) / 2
    print(s1,s2)
    return p1 + (p3 - p1) * s1 / (s1 + s2)

n = int(f.readline())
for i in range(n):
    p1, p2, p3 = [x + y * 1j for x, y in take2(map(float, f.readline().split()))]
    p12 = (p1 + p2) / 2
    p13 = (p1 + p3) / 2
    pxy = get_intersection(p12,p13,p12 + (p2 - p1) * 1j,p13 + (p1 - p3) * 1j)
    r = abs(pxy - p1)
    print('{:.3f} {:.3f} {:.3f}'.format(pxy.real,pxy.imag,r))

Python: def calc(x1, y1, x2, y2):
    return 2 * (x2 - x1), 2 * (y2 - y1), x2 ** 2 + y2 ** 2 - x1 ** 2 - y1 ** 2


n = int(input())
for _ in range(n):
    x1, y1, x2, y2, x3, y3 = map(float, input().split())
    cx1, cy1, z1 = calc(x1, y1, x2, y2)
    cx2, cy2, z2 = calc(x1, y1, x3, y3)
    dcy, dz = cx2 * cy1 - cx1 * cy2, cx2 * z1 - cx1 * z2
    y = dz / dcy
    x = (z1 - cy1 * y) / cx1 if cx1 else (z2 - cy2 * y) / cx2
    r = ((x - x1) ** 2 + (y - y1) ** 2) ** 0.5
    print('{:.3f} {:.3f} {:.3f}'.format(x, y, r))

Python: #!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys

n = int(sys.stdin.readline())
for i in range(n):
    x1,y1,x2,y2,x3,y3 = list(map(float, sys.stdin.readline().split()))
    a = ((x3-x2)**2 + (y3-y2)**2)**0.5
    b = ((x1-x3)**2 + (y1-y3)**2)**0.5
    c = ((x2-x1)**2 + (y2-y1)**2)**0.5
    r = a*b*c / ((a+b+c) * (-a+b+c) * (a-b+c) * (a+b-c))**0.5
    a2,b2,c2 = a**2,b**2,c**2
    x = (a2*(b2+c2-a2)*x1 + b2*(c2+a2-b2)*x2 + c2*(a2+b2-c2)*x3) / \
        (a2*(b2+c2-a2) + b2*(c2+a2-b2) + c2*(a2+b2-c2))
    y = (a2*(b2+c2-a2)*y1 + b2*(c2+a2-b2)*y2 + c2*(a2+b2-c2)*y3) / \
        (a2*(b2+c2-a2) + b2*(c2+a2-b2) + c2*(a2+b2-c2))
    print("{:.3f} {:.3f} {:.3f}".format(x,y,r))

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:.4} {y:.4} {(x*x+y*y)**.5:.4}")