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: #!/usr/bin/python
import sys,math
if sys.version_info[0]>=3: raw_input=input
N=int(raw_input())
for i in range(N):
	x1,y1,x2,y2,x3,y3=[float(e) for e in raw_input().split()]
	a1=2*x2-2*x1
	b1=2*y2-2*y1
	c1=x1*x1-x2*x2+y1*y1-y2*y2
	a2=2*x3-2*x1
	b2=2*y3-2*y1
	c2=x1*x1-x3*x3+y1*y1-y3*y3
	x=(b1*c2-b2*c1)/(a1*b2-a2*b1)
	y=(c1*a2-c2*a1)/(a1*b2-a2*b1)
	print('%.3f %.3f %.3f'%(x,y,math.hypot(x1-x,y1-y)))

Python: import math
n = int(input())
i = 0
while i < n:
   x1, y1, x2, y2, x3, y3 = map(float,input().split())
   a = x2 - x1
   b = y2 - y1
   c = x3 - x1
   d = y3 - y1
   e = a * (x1 + x2) + b * (y1 + y3)
   f = c * (x1 + x2) + d * (y1 + y3)
   g = 2.0 * (a * (y3 - y2) - b * (x3 - x2))
   if g == 0:
       exit()
   px = (d * e - b * f) / g
   py = (a * f - c * e) / g
   radius = ( (py - y1)*(py - y1) + (px - x1)*(px - x1) )
   print("%.3f %.3f %.3f"%(px,py,math.sqrt(radius)))

Python: # AOJ 0010 Circumscribed Circle of a Triangle
# Python3 2018.6.22 bal4u

import math
EPS = 1e-8

def cross(a, b):
	return a.real*b.imag - a.imag*b.real
def dist(a, b):
	return math.hypot(a.real-b.real, a.imag-b.imag)
	
# 両直線の交点
def crossPointLL(ln1, ln2):
	u = ln1[1]-ln1[0]
	v = ln2[1]-ln2[0]
	return ln1[0] + u*(cross(v, ln2[0]-ln1[0])/cross(v, u))

# 入力:３点座標、リターン:外接円の円心座標、半径を表すリスト
def circumscribed_circle(p1, p2, p3):
	p12 = (p1+p2)/2
	p23 = (p2+p3)/2
	ln1 = [p12, p12+(p1-p2)*complex(0, 1)]
	ln2 = [p23, p23+(p2-p3)*complex(0, 1)]
	c = crossPointLL(ln1, ln2)
	return [c, dist(c, p1)]

for i in range(int(input())):
	p = list(map(float, input().split()))
	p1 = complex(p[0], p[1])
	p2 = complex(p[2], p[3])
	p3 = complex(p[4], p[5])
	ans = circumscribed_circle(p1, p2, p3)
	print(format(ans[0].real+EPS, ".3f"), format(ans[0].imag+EPS, ".3f"), format(ans[1]+EPS, ".3f"))

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 xp-t*yp,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: 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("{:.3f} {:.3f} {:.3f}".format(x, y, 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: import math

def solve(a,b,c,d,e,f):
	x = - (d*(f**2+e**2-b**2-a**2) + b*(-f**2-e**2) + b**2*f + a**2*f + d**2*(b-f) + c**2*(b-f)) / (c*(2*f-2*b) - 2*a*f + 2*b*e + d*(2*a-2*e))
	y = (c*(f**2+e**2-b**2-a**2) + a*(-f**2-e**2) + b**2*e + a**2*e + d**2*(a-e) + c**2*(a-e)) / (c*(2*f-2*b) - 2*a*f + 2*b*e + d*(2*a - 2*e))
	r = math.hypot(x-a, y-b) 
	return x,y,r

n = int(input())
for _ in range(n):
	a,b,c,d,e,f = map(float, input().split())
	x,y,r = solve(a,b,c,d,e,f)
	print("{:.3f} {:.3f} {:.3f}".format(x, y, 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 func(x):
	x1, y1, x2, y2, x3, y3 = x
	
	a = x1 - x2
	b = y1 - y2
	c = (x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2) / 2
	d = x1 - x3
	e = y1 - y3
	f = (x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3) / 2
	x = (e * c - b * f) / (a * e - b * d)
	y = (a * f - d * c) / (a * e - b * d)
	r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y))
	x = "{0:.3f}".format(g(x))
	y = "{0:.3f}".format(g(y))
	r = "{0:.3f}".format(g(r))
	print(x + " " + y + " " + r)
n = int(input())
a = []
for _ in range(n):
	a.append(list((map(float, input().split()))))
for i in a:
	func(i)

Python: import sys
import math

def to_f(e):
  return float(e)

n = int(raw_input().rstrip())
for i in range(n):
  line = raw_input().rstrip() 
  x1, y1, x2, y2, x3, y3 = map(to_f, line.split(" "))
  a1 = 2*(x2-x1)
  a2 = 2*(x3-x1)
  b1 = 2*(y2-y1)
  b2 = 2*(y3-y1)
  c1 = x1**2-x2**2+y1**2-y2**2
  c2 = x1**2-x3**2+y1**2-y3**2
  xp = (b1*c2-b2*c1)/(a1*b2-a2*b1)
  yp = (c1*a2-c2*a1)/(a1*b2-a2*b1)
  r  = math.sqrt((xp-1)**2+(yp-y1)**2)
  print("{0:.3f} {0:.3f} {0:.3f}".format(xp, yp, r))

Python: n = int(input())
for i in range(n):
    x1, y1, x2, y2, x3, y3 = list(map(float, input().split()))
    a = 2*(x1-x2)
    b = 2*(y1-y2)
    c = x1**2 - x2**2 + y1**2 - y2**2
    d = 2*(x1-x3)
    e = 2*(y1-y3)
    f = x1**2 - x3**2 + y1**2 - y3**2

    y = (c*d - a*f) / (b*d - a*e)
    if a==0:
        x = (f - e*y) / d
    else:
        x = (c - b*y) / a
    
    r = ((x1 - x)**2 + (y1 - y)**2)**0.5
    print('{:.3f}'.format(round(x, 3)), end=" ")
    print('{:.3f}'.format(round(y, 3)), end=" ")
    print('{:.3f}'.format(round(r, 3)))

Python: # -*- coding: utf-8 -*-

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)

n = int(input())
for i in range(n):
    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()))