Problem:
 Score : 600 points    Problem Statement Given are N points (x_i, y_i) in a two-dimensional plane.  Find the minimum radius of a circle such that all the points are inside or on it.      Constraints  2 \leq N \leq 50  0 \leq x_i \leq 1000  0 \leq y_i \leq 1000  The given N points are all different.  The values in input are all integers.         Input Input is given from Standard Input in the following format:  N  x_1  y_1  :  x_N  y_N       Output Print the minimum radius of a circle such that all the N points are inside or on it.  Your output will be considered correct if the absolute or relative error from our answer is at most 10^{-6} .        Sample Input 1 2
0 0
1 0      Sample Output 1 0.500000000000000000  Both points are contained in the circle centered at (0.5,0) with a radius of 0.5 .       Sample Input 2 3
0 0
0 1
1 0      Sample Output 2 0.707106781186497524       Sample Input 3 10
10 9
5 9
2 0
0 0
2 7
3 3
2 5
10 0
3 7
1 9      Sample Output 3 6.726812023536805158  If the absolute or relative error from our answer is at most 10^{-6} , the output will be considered correct.

Solution (Python):
def ternary_search(*, l, r, func, loop_count=100, find_local_minimum: bool = True):
    """
    三分探索とは「たかだか一つしか極値のない関数fにおける極値を探索するアルゴリズム」
    https://qiita.com/ganariya/items/1553ff2bf8d6d7789127
    loop_count: 70-80で十分.厳密には2/3の冪乗で収束するか計算.epsで条件判定は無限ループが怖い.
    """

    if find_local_minimum:  
        for i in range(loop_count):
            c1 = (l * 2 + r) / 3  
            c2 = (l + r * 2) / 3  
            if func(c1) > func(c2):
                l = c1  
            else:
                r = c2
        return func(l)

    else:  
        for i in range(loop_count):
            c1 = (l * 2 + r) / 3  
            c2 = (l + r * 2) / 3  
            if func(c1) < func(c2):
                l = c1  
            else:
                r = c2
        return func(l)


def main():
    from collections import namedtuple
    from math import hypot
    import sys
    input = sys.stdin.readline

    MX = 1000

    Pt = namedtuple('Pt', 'x y')

    N = int(input())
    ps = [Pt(*map(int, input().split())) for _ in range(N)]

    def max_dist(x, y):
        return max(hypot(x - p.x, y - p.y) for p in ps)

    def f(x):
        return ternary_search(
            l=0,
            r=MX + 1,
            func=lambda y: max_dist(x, y)
        )  

    res = ternary_search(
        l=0,
        r=MX + 1,
        func=f
    )  

    print(res)


if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

N = int(input())
X, Y = [], []
for _ in range(N):
    tx, ty = map(int, input().split())
    X.append(tx)
    Y.append(ty)
X = np.array(X)
Y = np.array(Y)

def dist(cx, cy):
    tmp = ((X - cx) ** 2 + (Y - cy) ** 2) ** .5
    return max(tmp)

def g(cx):
    ll, rr = 0, 1000

    for _ in range(80):
        cll = (ll * 2 + rr) / 3
        crr = (ll + rr * 2) / 3
        if dist(cx, cll) >= dist(cx, crr):
            ll = cll
        else:
            rr = crr
    return dist(cx, ll)

l, r = 0, 1000

for _ in range(80):
    cl = (l * 2 + r) / 3
    cr = (l + r * 2) / 3
    if g(cl) >= g(cr):
        l = cl
    else:
        r = cr

ans = g(l)

print(ans)

Solution (Python):
EPS=10**(-9)

def outercenter(z1,z2,z3):
    w=(z1-z2)*z3.conjugate()+(z2-z3)*z1.conjugate()+(z3-z1)*z2.conjugate()
    if w==0:
        return (False,0,0)
    else:
        W=(z1-z2)*abs(z3)**2+(z2-z3)*abs(z1)**2+(z3-z1)*abs(z2)**2
        return (True,W/w,abs(z1-W/w))

def is_in_circle(c,r,z):
    return r+EPS>abs(z-c)

N=int(input())
z=[0 for i in range(0,N)]
for i in range(0,N):
    x,y=map(int,input().split())
    z[i]=complex(x,y)

ans=float('inf')
for i in range(0,N-1):
    for j in range(i+1,N):
        mid=(z[i]+z[j])/2
        r=abs(z[i]-mid)
        for k in range(0,N):
            if not is_in_circle(mid,r,z[k]):
                break
        else:
            ans=min(ans,r)

for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            info=outercenter(z[i],z[j],z[k])
            if info[0]:
                c=info[1]
                r=info[2]
                for l in range(0,N):
                    if not is_in_circle(c,r,z[l]):
                        break
                else:
                    ans=min(ans,r)

print(ans)

Solution (Python):
from math import sqrt

n = int(input())
points = []
for i in range(n):
    x, y = map(float, input().split())
    points.append((x, y))

lower = 0
upper = 10000


def get_cross_point(p1, p2, r):
    x, y = p2
    x -= p1[0]
    y -= p1[1]
    a = (x ** 2 + y ** 2) / 2
    if (x ** 2 + y ** 2) * r ** 2 - a ** 2 < 0:
        return None
    x1 = (a * x + y * sqrt((x ** 2 + y ** 2) * r ** 2 - a ** 2)) / (x ** 2 + y ** 2)
    y1 = (a * y - x * sqrt((x ** 2 + y ** 2) * r ** 2 - a ** 2)) / (x ** 2 + y ** 2)
    x2 = (a * x - y * sqrt((x ** 2 + y ** 2) * r ** 2 - a ** 2)) / (x ** 2 + y ** 2)
    y2 = (a * y + x * sqrt((x ** 2 + y ** 2) * r ** 2 - a ** 2)) / (x ** 2 + y ** 2)
    x1 += p1[0]
    x2 += p1[0]
    y1 += p1[1]
    y2 += p1[1]
    return (x1, y1), (x2, y2)


def square_dist(p0, p1):
    return ((p0[0] - p1[0]) ** 2) + ((p0[1] - p1[1]) ** 2)


def check_all_in_r(p, r):
    for q in points:
        if square_dist(p, q) > (r ** 2) + 0.0000001:
            return False
    return True


def check(r):
    for i in range(n):
        for j in range(i + 1, n):
            cross_points = get_cross_point(points[i], points[j], r)
            if cross_points is None:
                return False
            for p in cross_points:
                if check_all_in_r(p, r):
                    return True

    return False


for _ in range(100):
    middle = (upper + lower) / 2
    if check(middle):
        upper = middle
    else:
        lower = middle
print(middle)

Solution (Python):
N = int(input())
XY = tuple(tuple(map(int, input().split())) for _ in range(N))

lx = 0
rx = 1000
ans = 10 ** 18
for _ in range(100):
    ly = 0
    ry = 1000
    mlx = (2 * lx + rx) / 3
    for _ in range(100):
        mry = (ly + 2 * ry) / 3
        mly = (2 * ly + ry) / 3

        Rr = max((x - mlx) ** 2 + (y - mry) ** 2 for x, y in XY)
        Rl = max((x - mlx) ** 2 + (y - mly) ** 2 for x, y in XY)
        if Rl < Rr:
            ry = mry
        else:
            ly = mly
    R_left = Rl

    ly = 0
    ry = 1000
    mrx = (lx + 2 * rx) / 3
    for _ in range(100):
        mry = (ly + 2 * ry) / 3
        mly = (2 * ly + ry) / 3

        Rr = max((x - mrx) ** 2 + (y - mry) ** 2 for x, y in XY)
        Rl = max((x - mrx) ** 2 + (y - mly) ** 2 for x, y in XY)
        if Rl < Rr:
            ry = mry
        else:
            ly = mly
    R_right = Rl

    if R_left < R_right:
        rx = mrx
    else:
        lx = mlx

print(R_right ** 0.5)

Solution (Python):
N = int(input())
XY = [complex(*map(int, input().split())) for _ in range(N)]
ans = 10**18

def calc(center):
    return max(abs(center - x) for x in XY)

for A in XY:
    for B in XY:
        center = (A + B) / 2
        ans = min(ans, calc(center))

        for C in XY:
            a, b, c = abs(B - C), abs(C - A), abs(A - B)

            S = 0
            T = complex(0, 0)
            for (x, y, z), u in zip([(a, b, c), (b, c, a), (c, b, a)], (A, B, C)):
                O = x**2 * (y**2 + z**2 - x**2)
                S += O
                T += O * u

            if S == 0:
                continue
            ans = min(ans, calc(T / S))

print(ans)

Solution (Python):

from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def check(X,Y,r2,err=1e-6):
        for x,y in p:
            if (x-X)**2 + (y-Y)**2 > r2+err:
                return 0
        return 1

    n = I()
    p = LIR(n)
    ans = float("inf")
    for i in range(n):
        xi,yi = p[i]
        for j in range(i+1):
            xj,yj = p[j]
            X = (xi+xj) / 2
            Y = (yi+yj) / 2
            r2 = (xi-X)**2+(yi-Y)**2
            if ans > r2 and check(X,Y,r2):
                ans = r2
            x,y = xj-xi,yj-yi
            for k in range(j):
                xk,yk = p[k]
                a,b = xk-xi,yk-yi
                deno = 2*(a*y-b*x)
                if deno == 0:
                    continue
                X = (y*(a**2+b**2)-b*(x**2+y**2))/deno+xi
                Y = (a*(x**2+y**2)-x*(a**2+b**2))/deno+yi
                r2 = (xi-X)**2+(yi-Y)**2
                if ans > r2 and check(X,Y,r2):
                    ans = r2
    print(ans**0.5)
    return


if __name__ == "__main__":
    solve()

Solution (Python):
N=int(input())
XY=[list(map(int,input().split())) for i in range(N)]
from itertools import combinations
a=9999
def f(X,Y,R2,a):
    if all([(X-x)**2+(Y-y)**2<R2 for x,y in XY]):
        a=min(a,R2**.5)
    return a
for (x1,y1),(x2,y2),(x3,y3) in combinations(XY,3):
    e1=(x2-x3)**2+(y2-y3)**2
    e2=(x3-x1)**2+(y3-y1)**2
    e3=(x1-x2)**2+(y1-y2)**2
    p=e1*(e2+e3-e1)
    q=e2*(e3+e1-e2)
    r=e3*(e1+e2-e3)
    if p+q+r==0:continue
    X=(p*x1+q*x2+r*x3)/(p+q+r)
    Y=(p*y1+q*y2+r*y3)/(p+q+r)
    R2=(X-x1)**2+(Y-y1)**2+10e-9
    a=f(X,Y,R2,a)
for (x1,y1),(x2,y2) in combinations(XY,2):
    X=(x1+x2)/2
    Y=(y1+y2)/2
    R2=(X-x1)**2+(Y-y1)**2+10e-9
    a=f(X,Y,R2,a)
print(a)

Solution (Python):


import math

N = int(input())

xy = []
for i in range(N):
	xy.append([int(p) for p in input().split()])

def dist(a, b):
	return math.sqrt((a[0]-b[0])**2 + (a[1]-b[1])**2)

def max_dist(a):
	max_d = 0
	for b in xy:
		max_d = max(max_d, dist(a, b))
	return max_d

def g(a):
	ly = 0
	ry = 1000
	for j in range(100):
		
		c1 = (ly*2+ry)/3
		c2 = (ly+ry*2)/3
		if max_dist([a,c1]) > max_dist([a,c2]):
			ly = c1
		else:
			ry = c2
	return max_dist([a,ly])

lx = 0
rx = 1000
for i in range(100):
	
	c1 = (lx*2+rx)/3
	c2 = (lx+rx*2)/3
	if g(c1) > g(c2):
		lx = c1
	else:
		rx = c2

print(g(lx))

Solution (Python):
def dist2(a, b):
    
    ax, ay = a
    bx, by = b
    return (ax-bx)**2+(ay-by)**2

def circum(a, b, c):
    
    ax, ay = a
    bx, by = b
    cx, cy = c
    s = dist2(b, c)*(dist2(c, a)+dist2(a, b)-dist2(b, c))
    t = dist2(c, a)*(dist2(a, b)+dist2(b, c)-dist2(c, a))
    u = dist2(a, b)*(dist2(b, c)+dist2(c, a)-dist2(a, b))
    ox = (s*ax+t*bx+u*cx)/(s+t+u)
    oy = (s*ay+t*by+u*cy)/(s+t+u)
    return ox, oy

n = int(input())
P = [tuple(map(int, input().split())) for i in range(n)]
eps = 10**(-7)
if n == 2:
    r = dist2(P[0], P[1])**0.5 / 2
    print(r)
    exit()
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            a, b, c = P[i], P[j], P[k]
            ax, ay = a
            bx, by = b
            cx, cy = c
            if dist2(a, b) + dist2(b, c) <= dist2(c, a):
                p = (cx+ax)/2, (cy+ay)/2
                r2 = dist2(a, p)
            elif dist2(b, c) + dist2(c, a) <= dist2(a, b):
                p = (ax+bx)/2, (ay+by)/2
                r2 = dist2(b, p)
            elif dist2(c, a) + dist2(a, b) <= dist2(b, c):
                p = (bx+cx)/2, (by+cy)/2
                r2 = dist2(c, p)
            else:
                p = circum(a, b, c)
                r2 = dist2(a, p)
            if all([dist2(p, q) <= r2 + eps for q in P]):
                print(r2**0.5)
                exit()

Solution (Python):
def circum(A, B, C):
    
    Ax, Ay = A
    Bx, By = B
    Cx, Cy = C
    a = (Bx-Cx)**2+(By-Cy)**2
    b = (Cx-Ax)**2+(Cy-Ay)**2
    c = (Ax-Bx)**2+(Ay-By)**2
    s = a*(b+c-a)
    t = b*(c+a-b)
    u = c*(a+b-c)
    Ux = (s*Ax+t*Bx+u*Cx)/(s+t+u)
    Uy = (s*Ay+t*By+u*Cy)/(s+t+u)
    return Ux, Uy


def dist2(a, b):
    
    ax, ay = a
    bx, by = b
    return (ax-bx)**2+(ay-by)**2


n = int(input())
P = [tuple(map(int, input().split())) for i in range(n)]
eps = 10**(-7)
if n == 2:
    r = dist2(P[0], P[1])**0.5 / 2
    print(r)
    exit()
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            a, b, c = P[i], P[j], P[k]
            ax, ay = a
            bx, by = b
            cx, cy = c
            if dist2(a, b) + dist2(b, c) <= dist2(c, a):
                p = (cx+ax)/2, (cy+ay)/2
                r2 = dist2(a, p)
            elif dist2(b, c) + dist2(c, a) <= dist2(a, b):
                p = (ax+bx)/2, (ay+by)/2
                r2 = dist2(b, p)
            elif dist2(c, a) + dist2(a, b) <= dist2(b, c):
                p = (bx+cx)/2, (by+cy)/2
                r2 = dist2(c, p)
            else:
                p = circum(a, b, c)
                r2 = dist2(a, p)
            if all([dist2(p, q) <= r2 + eps for q in P]):
                print(r2**0.5)
                exit()

Solution (Python):
n = int(input())
xy=[list(map(int,input().split())) for i in range(n)]
import math
def calc(x1, y1, x2, y2, x3, y3):
    try:
        d = 2 * ((y1 - y3) * (x1 - x2) - (y1 - y2) * (x1 - x3))
        x = ((y1 - y3) * (y1 ** 2 - y2 ** 2 + x1 ** 2 - x2 ** 2) - (y1 - y2) * (y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2)) / d
        y = ((x1 - x3) * (x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2) - (x1 - x2) * (x1 ** 2 - x3 ** 2 + y1 ** 2 - y3 ** 2)) / -d
        r2 = (x - x1) ** 2 + (y - y1) ** 2
    except:
        return 0,0,-1
    else:
        return x,y,r2
def check(cx,cy,r2):
    for tmp in xy:
        x,y=tmp
        if (x-cx)**2 + (y-cy)**2 > r2:
            return False
    return True

ans=float("inf")
eps=10**(-5)
for i in range(n):
    for j in range(i+1,n):
        x1,y1=xy[i]
        x2,y2=xy[j]
        cx=(x1+x2)/2
        cy=(y1+y2)/2

        r2=(cx-x1)**2+(cy-y1)**2
        if check(cx,cy,r2+eps):
            ans=min(ans,math.sqrt(r2))

for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            x1,y1=xy[i]
            x2,y2=xy[j]
            x3,y3=xy[k]
            cx,cy,r2=calc(x1, y1, x2, y2, x3, y3)
            if 0 < r2 and check(cx,cy,r2+eps):
                ans=min(ans,math.sqrt(r2))
print(ans)

Solution (Python):




import math

N = int(input())
X, Y = [], []
for _ in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)


def calc_r(x0, y0):
    
    res = 0
    for i in range(N):
        res = max(res, ((X[i] - x0)**2 + (Y[i] - y0)**2))

    return res



lb_x, ub_x = 0.0, 1000.0


def g(x):
    
    lb_y, ub_y = 0.0, 1000.0

    
    for _ in range(100):
        y1 = lb_y + (ub_y - lb_y) / 3
        y2 = ub_y - (ub_y - lb_y) / 3

        if calc_r(x, y1) > calc_r(x, y2):
            lb_y = y1
        else:
            ub_y = y2
    return calc_r(x, lb_y)


for _ in range(100):
    
    x1 = lb_x + (ub_x - lb_x) / 3
    x2 = ub_x - (ub_x - lb_x) / 3

    if g(x1) > g(x2):
        lb_x = x1
    else:
        ub_x = x2

print(math.sqrt(g(lb_x)))

Solution (Python):
from math import sqrt 
n= int(input())
xy=[[int(i) for i in input().split()] for _ in range(n)]
def d(x, y):
    return sqrt((x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2)
def nai(x, y, z):
    c,b,a = sorted([d(x, y), d(y, z), d(z, x)])
    co = (b**2 + c**2 - a**2)/(2*b*c)
    if co<0: return a/2
    si = sqrt(1-co**2)
    return a/si/2

if n==2:
    print(d(xy[0],xy[1])/2)
else:
    ans=0
    for i in range(n):
        for j in range(i+1, n):
            for k in range(j+1, n):
                ans = max(ans,nai(xy[i],xy[j],xy[k]))
    print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

n = n_in()
xy = [l_in() for _ in range(n)]

left = 0
right = 2000

from itertools import combinations
import math
def check(r):
    allprox = True
    for (x1,y1),(x2,y2) in combinations(xy, 2):
        dx = x1-x2
        dy = y1-y2

        d2 = dx*dx+dy*dy

        if d2 < 10**-16:
            continue

        allprox = False
        
        if d2/4 > r*r:
            continue

        h = math.sqrt(r*r-d2/4)
        d = math.sqrt(d2)

    
        px,py= (x1+x2)/2, (y1+y2)/2

        qx,qy = px-dy/d*h, py+dx/d*h
        if all((qx-x3)*(qx-x3) + (qy-y3)*(qy-y3) <= r*r for x3,y3 in xy if (x1 != x3 or y1 != y3) and (x2 != x3 or y2 != y3)):
            return True
        
        qx,qy = px+dy/d*h, py-dx/d*h
        if all((qx-x3)*(qx-x3) + (qy-y3)*(qy-y3) <= r*r for x3,y3 in xy if (x1 != x3 or y1 != y3) and (x2 != x3 or y2 != y3)):
            return True
    else:
        return allprox

while right-left > 10**-10:
    mid = (left+right)/2
    if check(mid):
        right = mid
    else:
        left = mid

print((left+right)/2)

Solution (Python):























import math, random










def make_circle(points):
    
    shuffled = [(float(p[0]), float(p[1])) for p in points]
    random.shuffle(shuffled)

    
    c = None
    for (i, p) in enumerate(shuffled):
        if c is None or not _is_in_circle(c, p):
            c = _make_circle_one_point(shuffled[0 : i + 1], p)
    return c



def _make_circle_one_point(points, p):
    c = (p[0], p[1], 0.0)
    for (i, q) in enumerate(points):
        if not _is_in_circle(c, q):
            if c[2] == 0.0:
                c = _make_diameter(p, q)
            else:
                c = _make_circle_two_points(points[0 : i + 1], p, q)
    return c



def _make_circle_two_points(points, p, q):
    diameter = _make_diameter(p, q)
    if all(_is_in_circle(diameter, r) for r in points):
        return diameter

    left = None
    right = None
    for r in points:
        cross = _cross_product(p[0], p[1], q[0], q[1], r[0], r[1])
        c = _make_circumcircle(p, q, r)
        if c is None:
            continue
        elif cross > 0.0 and (left is None or _cross_product(p[0], p[1], q[0], q[1], c[0], c[1]) > _cross_product(p[0], p[1], q[0], q[1], left[0], left[1])):
            left = c
        elif cross < 0.0 and (right is None or _cross_product(p[0], p[1], q[0], q[1], c[0], c[1]) < _cross_product(p[0], p[1], q[0], q[1], right[0], right[1])):
            right = c
    return left if (right is None or (left is not None and left[2] <= right[2])) else right


def _make_circumcircle(p0, p1, p2):
    
    ax = p0[0]; ay = p0[1]
    bx = p1[0]; by = p1[1]
    cx = p2[0]; cy = p2[1]
    d = (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by)) * 2.0
    if d == 0.0:
        return None
    x = ((ax * ax + ay * ay) * (by - cy) + (bx * bx + by * by) * (cy - ay) + (cx * cx + cy * cy) * (ay - by)) / d
    y = ((ax * ax + ay * ay) * (cx - bx) + (bx * bx + by * by) * (ax - cx) + (cx * cx + cy * cy) * (bx - ax)) / d
    return (x, y, math.hypot(x - ax, y - ay))


def _make_diameter(p0, p1):
    return ((p0[0] + p1[0]) / 2.0, (p0[1] + p1[1]) / 2.0, math.hypot(p0[0] - p1[0], p0[1] - p1[1]) / 2.0)


_EPSILON = 1e-12

def _is_in_circle(c, p):
    return c is not None and math.hypot(p[0] - c[0], p[1] - c[1]) < c[2] + _EPSILON



def _cross_product(x0, y0, x1, y1, x2, y2):
    return (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0)
  
points= [(421640.3639270504, 4596366.353552659), (421635.79361391126, 4596369.054192241), (421632.6774913164, 4596371.131607305), (421629.14588570886, 4596374.870954419), (421625.6142801013, 4596377.779335507), (421624.99105558236, 4596382.14190714), (421630.1845932406, 4596388.062540068), (421633.3007158355, 4596388.270281575), (421637.87102897465, 4596391.8018871825), (421642.4413421138, 4596394.918009778), (421646.5961722403, 4596399.903805929), (421649.71229483513, 4596403.850894549), (421653.8940752105, 4596409.600842565), (421654.69809098693, 4596410.706364258), (421657.60647207545, 4596411.329588776), (421660.514853164, 4596409.875398233), (421661.3458191893, 4596406.136051118), (421661.5535606956, 4596403.22767003), (421658.85292111343, 4596400.94251346), (421656.5677645438, 4596399.696064423), (421655.52905701223, 4596396.164458815), (421652.82841743, 4596394.502526765), (421648.46584579715, 4596391.8018871825), (421646.38843073393, 4596388.270281575), (421645.55746470863, 4596386.400608018), (421647.21939675923, 4596384.115451449), (421649.5045533288, 4596382.661260904), (421650.7510023668, 4596378.714172284), (421647.8426212782, 4596375.8057911955), (421644.9342401897, 4596372.897410107), (421643.6877911517, 4596370.404512031), (421640.3639270504, 4596366.353552659)]
pointss=[]
n=int(input()
     )
for i in range(n):
  x,y=map(int,input().split())
  
  pointss.append((x,y))

ans=make_circle(pointss)
print(ans[2])

Solution (Python):
N = int(input())
XY = []
for i in range(N):
    x,y=map(int,input().split())
    XY.append([x,y])

def f(x,y):
  mx = 0
  for x1,y1 in XY:
    if ((x1-x)**2+(y1-y)**2)**0.5 > mx:
      mx = ((x1-x)**2+(y1-y)**2)**0.5
  return mx

def g(x):
  l = 0.0
  r = 1000.0
  for i in range(80):
    c1 = (l*2+r)/3
    c2 = (l+r*2)/3
    if f(x,c1) > f(x,c2):
      l = c1
    else:
      r = c2
  return f(x,l)

l = 0.0
r = 1000.0
for i in range(80):
  c1 = (l*2+r)/3
  c2 = (l+r*2)/3
  if g(c1) > g(c2):
    l = c1
  else:
    r = c2

print(g(l))

Solution (Python):
import math
import itertools
import sys
sys.setrecursionlimit(20000)


def gcd(a, b):
    a, b = abs(a), abs(b)
    a, b = max(a, b), min(a, b)
    while b > 0:
        tmp = b
        b = a % b
        a = tmp
        a, b = max(a, b), min(a, b)
    return a


def dist(p, q):
    return math.sqrt((p[0] - q[0]) ** 2 +
                     (p[1] - q[1]) ** 2)


def is_liner(a, b, c):
    x = (b[0] - a[0], b[1] - a[1])
    y = (c[0] - a[0], c[1] - a[1])
    gcdx = gcd(x[0], x[1])
    x = (x[0] // gcdx, x[1] // gcdx)
    gcdy = gcd(y[0], y[1])
    y = (y[0] // gcdy, y[1] // gcdy)
    return x == y


def angle(a, b, c):
    p = (b[0] - a[0], b[1] - a[1])
    q = (c[0] - a[0], c[1] - a[1])
    ang = abs(math.atan2(p[1], p[0]) - math.atan2(q[1], q[0]))
    return min(ang, math.pi * 2 - ang)


def outer_soul(a, b, c):
    A = angle(a, b, c)
    B = angle(b, c, a)
    C = angle(c, a, b)
    s2A = math.sin(2*A)
    s2B = math.sin(2*B)
    s2C = math.sin(2*C)
    o = [0] * 2
    for i in range(2):
        o[i] = (s2A * a[i] + s2B * b[i] + s2C * c[i]) / (s2A + s2B + s2C)
    return o


def check(o, r, P):
    for p in P:
        if dist(o, p) > r + 1e-6:
            return False
    return True


def main():
    N = int(input())
    P = [None] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y)
    ans = float("inf")
    for a, b, c in itertools.combinations(P, r=3):
        if is_liner(a, b, c):
            continue
        o = outer_soul(a, b, c)
        r = dist(a, o)
        if check(o, r, P):
            ans = min(ans, r)
    for a, b in itertools.combinations(P, r=2):
        o = ((a[0] + b[0]) / 2, (a[1] + b[1]) / 2)
        r = dist(a, b) / 2
        if check(o, r, P):
            ans = min(ans, r)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import math
import itertools
import sys
sys.setrecursionlimit(20000)


def gcd(a, b):
    a, b = abs(a), abs(b)
    a, b = max(a, b), min(a, b)
    while b > 0:
        tmp = b
        b = a % b
        a = tmp
        a, b = max(a, b), min(a, b)
    return a


def dist(p, q):
    return math.sqrt((p[0] - q[0]) ** 2 +
                     (p[1] - q[1]) ** 2)


def is_liner(a, b, c):
    x = (b[0] - a[0], b[1] - a[1])
    y = (c[0] - a[0], c[1] - a[1])
    gcdx = gcd(x[0], x[1])
    x = (x[0] // gcdx, x[1] // gcdx)
    gcdy = gcd(y[0], y[1])
    y = (y[0] // gcdy, y[1] // gcdy)
    return x == y


def angle(a, b, c):
    p = (b[0] - a[0], b[1] - a[1])
    q = (c[0] - a[0], c[1] - a[1])
    ang = abs(math.atan2(p[1], p[0]) - math.atan2(q[1], q[0]))
    return min(ang, math.pi * 2 - ang)


def outer_soul(a, b, c):
    A = angle(a, b, c)
    B = angle(b, c, a)
    C = angle(c, a, b)
    s2A = math.sin(2*A)
    s2B = math.sin(2*B)
    s2C = math.sin(2*C)
    o = [0] * 2
    for i in range(2):
        o[i] = (s2A * a[i] + s2B * b[i] + s2C * c[i]) / (s2A + s2B + s2C)
    return o


def check(o, r, P):
    for p in P:
        if dist(o, p) > r + 1e-6:
            return False
    return True


def main():
    N = int(input())
    P = [None] * N
    for i in range(N):
        x, y = map(int, input().split())
        P[i] = (x, y)
    if N == 2:
        ans = dist(P[0], P[1]) / 2
        print(ans)
        return
    ans = float("inf")
    for a, b, c in itertools.combinations(P, r=3):
        if is_liner(a, b, c):
            continue
        o = outer_soul(a, b, c)
        r = dist(a, o)
        if check(o, r, P):
            ans = min(ans, r)
    for a, b in itertools.combinations(P, r=2):
        o = ((a[0] + b[0]) / 2, (a[1] + b[1]) / 2)
        r = dist(a, b) / 2
        if check(o, r, P):
            ans = min(ans, r)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
import math
from itertools import combinations

eps = 10 ** -7

def midpoint(a, b):
    return (a[0] + b[0]) / 2, (a[1] + b[1]) / 2

def distance(a, b):
    return ((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2) ** 0.5

def within(c, r, a):
    return (a[0] - c[0]) ** 2 + (a[1] - c[1]) ** 2 <= r ** 2 + eps

def tcircle(t1, t2, t3):
    x1, y1 = t1
    x2, y2 = t2
    x3, y3 = t3
    d = 2 * ((y1 - y3) * (x1 - x2) - (y1 - y2) * (x1 - x3))
    if d == 0:
        return (0.0, 0.0), -1.0
    x = ((y1 - y3) * (y1 ** 2 - y2 ** 2 + x1 ** 2 - x2 ** 2) - (y1 - y2) * (y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2)) / d
    y = ((x1 - x3) * (x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2) - (x1 - x2) * (x1 ** 2 - x3 ** 2 + y1 ** 2 - y3 ** 2)) / -d
    r = math.sqrt((x - x1) ** 2 + (y - y1) ** 2)
    return (x, y), r

def main():
    N = int(input())
    L = [tuple(map(int, input().split())) for _ in range(N)]
    br = float('inf')
    for p, q in combinations(L, 2):
        c, r = midpoint(p, q), distance(p, q) / 2
        if all(within(c, r, i) for i in L):
            return r
        ac, ar = (0.0, 0.0), 0.0
        for i in L:
            if within(c, r, i):
                continue
            pc, pr = tcircle(p, q, i)
            if pr == -1:
                break
            if ar < pr:
                ac, ar = pc, pr
        else:
            if ar < br and all(within(ac, ar, i) for i in L):
                br = ar
    return br

print(main())

Solution (Python):
class Triangle():
    def __init__(self, A, B, C):
        
        self.A = A
        self.B = B
        self.C = C
        Ax, Ay = A
        Bx, By = B
        Cx, Cy = C
        a = ((Bx-Cx)**2+(By-Cy)**2)**0.5
        b = ((Cx-Ax)**2+(Cy-Ay)**2)**0.5
        c = ((Ax-Bx)**2+(Ay-By)**2)**0.5
        
        self.a = a
        self.b = b
        self.c = c
        
        s = a**2*(b**2+c**2-a**2)
        t = b**2*(c**2+a**2-b**2)
        u = c**2*(a**2+b**2-c**2)
        Ux = (s*Ax+t*Bx+u*Cx)/(s+t+u)
        Uy = (s*Ay+t*By+u*Cy)/(s+t+u)
        self.U = (Ux, Uy)
        
        self.G = ((Ax+Bx+Cx)/3, (Ay+By+Cy)/3)


class Circle():
    
    def __init__(self, p, r):
        self.p = p
        self.r = r

    def contain(self, q):
        
        px, py = self.p
        qx, qy = q
        return (px-qx)**2+(py-qy)**2 <= self.r**2 + 10**(-7)


def distance(a, b):
    ax, ay = a
    bx, by = b
    return ((ax-bx)**2+(ay-by)**2)**0.5


def enclose(P):
    n = len(P)
    if n == 2:
        ax, ay = P[0]
        bx, by = P[1]
        p = ((ax+bx)/2, (ay+by)/2)
        r = distance(P[0], p)
        return Circle(p, r)
    if n == 3:
        circle = enclose([P[0], P[1]])
        if circle.contain(P[2]):
            return circle
        circle = enclose([P[1], P[2]])
        if circle.contain(P[0]):
            return circle
        circle = enclose([P[2], P[0]])
        if circle.contain(P[1]):
            return circle
        triangle = Triangle(P[0], P[1], P[2])
        u = triangle.U
        r = distance(u, P[0])
        return Circle(u, r)
    for i in range(n-2):
        for j in range(i+1, n-1):
            for k in range(j+1, n):
                circle = enclose([P[i], P[j], P[k]])
                if all([circle.contain(q) for q in P]):
                    return circle


n = int(input())
P = []
for i in range(n):
    x, y = map(int, input().split())
    P.append((x, y))
circle = enclose(P)
print(circle.r)

Solution (Python):
N = int(input())
XY = [tuple(map(int, input().split())) for _ in range(N)]

def dist(x, y, u, v):
    return ((x - u)**2 + (y - v)**2)**0.5

def mxR(x, y):
    return max([dist(x, y, u, v) for u, v in XY])

ans = 10**18
for i, A in enumerate(XY):
    ans = min(ans, mxR(A[0], A[1]))
    for j, B in enumerate(XY[i + 1:]):
        ans = min(ans, mxR((A[0] + B[0]) / 2, (A[1] + B[1]) / 2))

        for C in XY[j + 1:]:
            Z = [0, 0]

            a, b, c = dist(*(B + C)), dist(*(C + A)), dist(*(A + B))

            S = a**2 * (b**2 + c**2 - a**2) + b**2 * (c**2 + a**2 - b**2) + c**2 * (a**2 + b**2 - c**2)
            if S == 0:
                continue

            x = (a**2 * (b**2 + c**2 - a**2) * A[0] + b**2 * (c**2 + a**2 - b**2) * B[0] + c**2 * (a**2 + b**2 - c**2) * C[0]) / S
            y = (a**2 * (b**2 + c**2 - a**2) * A[1] + b**2 * (c**2 + a**2 - b**2) * B[1] + c**2 * (a**2 + b**2 - c**2) * C[1]) / S

            ans = min(ans, mxR(x, y))

print(ans)

Solution (Python):

from math import sin, sqrt

N = int(input())
XY = [[int(i) for i in input().split()] for _ in range(N)]

INF = 10 ** 6

def circumcenter(i,j,k):
    """ 3点を通る円の中心(外心) """
    a,b = XY[i]
    c,d = XY[j]
    e,f = XY[k]

    aa, bb, cc, dd, ee, ff = a**2, b**2, c**2, d**2, e**2, f**2

    try:
        y = ((e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee- ff)) / (2 * (e - a)*(b - d) - 2 * (c - a) * (b - f))
        x = (2 * (b - f) * y - aa - bb + ee + ff) / (2 * (e - a)) if (c == a) else (2 * (b - d) * y - aa - bb + cc + dd) / (2 * (c - a))
    except ZeroDivisionError as e:
        return (-INF, -INF)

    return (x,y)

def radius(x,y):
    """ 半径を求める """
    dist = 0
    for X,Y in XY:
        tmp = pow(X-x, 2) + pow(Y-y, 2)
        dist = max(dist, tmp)
    return sqrt(dist)

def midpoint(a,b):
    """ 2点の中点 """
    xa, ya = XY[a]
    xb, yb = XY[b]
    
    x = (xa + xb) / 2
    y = (ya + yb) / 2

    return (x, y)

def main():
    ans = float("inf")

    
    for a in range(N):
        for b in range(a+1,N):
            x,y = midpoint(a,b)
            r = radius(x,y)
            ans = min(ans, r)

    
    for a in range(N):
        for b in range(a+1,N):
            for c in range(b+1,N):
                x,y = circumcenter(a,b,c)
                r = radius(x,y)
                ans = min(ans, r)

    print("{0:.7f}".format(ans))

if __name__ == "__main__":
    main()