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):
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))



def get_circle_center_and_radius(x1, y1, x2, y2, x3, y3):
    d = 2 * ((y1 - y3) * (x1 - x2) - (y1 - y2) * (x1 - x3))
    if abs(d)<10**(-16):
        return (0,0),float('inf')
    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

N = I()
x,y = Line(N,2)

if N==2:
    print((math.sqrt((x[0]-x[1])**2 + (y[0]-y[1])**2))/2)
    exit()

ans = float('inf')
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            c,r = get_circle_center_and_radius(x[i],y[i],x[j],y[j],x[k],y[k])
            if r<ans:
                check = False
                for h in range(N):
                    if h in [i,j,k]:
                        continue
                    if math.sqrt((x[h]-c[0])**2 + (y[h]-c[1])**2)>r:
                        check = True
                if not check:
                    ans = r

for i in range(N-1):
    for j in range(i+1,N):
        c = ((x[i]+x[j])/2, (y[i]+y[j])/2)
        r = (math.sqrt((x[i]-x[j])**2 + (y[i]-y[j])**2))/2
        flag = False
        for k in range(N):
            if k in [i,j]:
                continue
            else:
                if math.sqrt((x[k]-c[0])**2 + (y[k]-c[1])**2)>r:
                    flag = True
                    break
        if not flag:
            if r<ans:
                ans = r

print(ans)

Solution (Python):
import math

def get_circle_center_and_radius(x1, y1, x2, y2, x3, y3):
    """
    3点を通る円の中心と半径を取得
    """
    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
    r = math.sqrt((x - x1) ** 2 + (y - y1) ** 2)
    return x, y, r

n = int(input())
l = []
ans = float('inf')
for i in range(n):
    l.append([int(_) for _ in input().split()])

for i in range(0, n - 1):
    for j in range(i + 1, n):
        x = (l[i][0] + l[j][0]) / 2
        y = (l[i][1] + l[j][1]) / 2
        r = math.sqrt((l[i][0] - l[j][0])** 2 + (l[i][1] - l[j][1])**2) / 2
        flag = 1
        for k in range(n):
            if k != i and k != j:
                if (x - l[k][0]) ** 2 + (y - l[k][1]) ** 2 > r ** 2:
                    flag = 0
        if flag == 1:
            ans = min(r, ans)
        
for i in range(0, n - 2):
    for j in range(i + 1, n - 1):
        for k in range(i + 2, n):
            try:
                x, y, r = get_circle_center_and_radius(l[i][0],l[i][1],l[j][0],l[j][1],l[k][0],l[k][1])
                flag = 1
                for p in range(n):
                    if p != i and p != j and p != k:
                        if (x - l[p][0]) ** 2 + (y - l[p][1]) ** 2 > r ** 2:
                            flag = 0
                if flag == 1:
                    ans = min(r, ans)
                
            except:
                continue
print(ans)

Solution (Python):
import sys
input=sys.stdin.readline

def main():
    n=int(input())
    XY=[list(map(int,input().split())) for _ in range(n)]
    
    if n==2:
        return dist(XY[0][0],XY[0][1],XY[1][0],XY[1][1])/2
    
    ans=float('inf')
    for i in range(n-2):
        for j in range(i+1,n-1):
            for k in range(j+1,n):
                x1,y1=XY[i]
                x2,y2=XY[j]
                x3,y3=XY[k]
                r,x,y=circle(x1,y1,x2,y2,x3,y3)
                
                if r==-1:
                    continue
                for x4,y4 in XY:
                    if dist(x,y,x4,y4)>r:
                        break
                else:
                    ans=min(ans,r)
    for i in range(n-1):
        for j in range(i+1,n):
            x1,y1=XY[i]
            x2,y2=XY[j]
            x,y=(x1+x2)/2,(y1+y2)/2
            r=dist(x,y,x1,y1)
            for x3,y3 in XY:
                if dist(x,y,x3,y3)>r:
                    break
            else:
                ans=min(ans,r)
    return ans
                
def dist(x1,y1,x2,y2):
    return ((x2-x1)**2+(y2-y1)**2)**0.5

def circle(x1,y1,x2,y2,x3,y3):
    
    a2=(x2-x3)**2+(y2-y3)**2 
    b2=(x1-x3)**2+(y1-y3)**2
    c2=(x2-x1)**2+(y2-y1)**2
    area=((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))/2

    
    if area==0:
        return -1,0,0
    
    
    x=(a2*(b2+c2-a2)*x1+b2*(c2+a2-b2)*x2+c2*(a2+b2-c2)*x3)/(16*area*area)
    y=(a2*(b2+c2-a2)*y1+b2*(c2+a2-b2)*y2+c2*(a2+b2-c2)*y3)/(16*area*area) 
    r=((x1-x)**2+(y1-y)**2)**0.5
    
    
    return r,x,y
    
if __name__=='__main__':
    print(main())

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
input = lambda: sys.stdin.readline().rstrip()
inpl = lambda: list(map(int,input().split()))

N = int(input())
x = []
y = []
for i in range(N):
    xy = inpl()
    x.append(xy[0])
    y.append(xy[1])
ans2 = 10**12
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            a = 2*(x[j]-x[i])
            c = 2*(x[k]-x[j])
            b = 2*(y[j]-y[i])
            d = 2*(y[k]-y[j])
            P = x[j]**2 - x[i]**2 + y[j]**2 - y[i]**2
            Q = x[k]**2 - x[j]**2 + y[k]**2 - y[j]**2

            det = a*d - b*c
            if det == 0:
                continue
            Cx = (d*P - b*Q)/det
            Cy = (a*Q - c*P)/det
            r2 = (Cx-x[i])**2 + (Cy-y[i])**2
            for p in range(N):
                if p in (i,j,k):
                    continue
                if (Cx-x[p])**2 + (Cy-y[p])**2 > r2:
                    break
            else:
                if r2 < ans2:
                    ans2 = r2

for i in range(N-1):
    for j in range(i+1,N):
        Cx = (x[i] + x[j])/2
        Cy = (y[i] + y[j])/2
        r2 = ((x[i]-x[j])**2 + (y[i]-y[j])**2)/4
        for p in range(N):
            if p in (i,j):
                continue
            if (Cx-x[p])**2 + (Cy-y[p])**2 > r2:
                break
        else:
            if r2 < ans2:
                ans2 = r2

print(ans2**0.5)

Solution (Python):
import itertools

n = int(input())
xy = []
for i in range(n):
    xy.append(list(map(int, input().split())))

R = []
if n >= 3:
    for i, j, k in itertools.combinations(xy, 3):
        if (j[0] - i[0]) * (k[0] - i[0]) + (j[1] - i[1]) * (k[1] - i[1]) <= 0:
            r = ((j[0] - k[0]) ** 2 + (j[1] - k[1]) ** 2) ** 0.5 / 2
            R.append(r)
        elif (i[0] - j[0]) * (k[0] - j[0]) + (i[1] - j[1]) * (k[1] - j[1]) <= 0:
            r = ((i[0] - k[0]) ** 2 + (i[1] - k[1]) ** 2) ** 0.5 / 2
            R.append(r)
        elif (i[0] - k[0]) * (j[0] - k[0]) + (i[1] - k[1]) * (j[1] - k[1]) <= 0:
            r = ((i[0] - j[0]) ** 2 + (i[1] - j[1]) ** 2) ** 0.5 / 2
            R.append(r)
        else:
            x1 = j[0] - i[0]
            x2 = k[0] - i[0]
            y1 = j[1] - i[1]
            y2 = k[1] - i[1]
            cos = (x1 * x2 + y1 * y2) /(((x1 ** 2 + y1 ** 2) ** 0.5) * ((x2 ** 2 + y2 ** 2) ** 0.5))
            sin = (1 - cos ** 2) ** 0.5
            r = (((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5) / 2 / sin
            R.append(r)
else:
    r = ((xy[0][0] - xy[1][0]) ** 2 + (xy[0][1] - xy[1][1]) ** 2) ** 0.5 / 2
    R.append(r)
print(max(R))

Solution (Python):
import itertools
import math
N = int(input())
p = []
for i in range(N):
    x, y = map(int, input().split())
    p.append([x, y])
ans = 10000
if len(p) >= 3:
    S = list(itertools.combinations(p,3))
    for X in S:
        ok = True
        a = X[0][0]
        b = X[0][1]
        c = X[1][0]
        d = X[1][1]
        e = X[2][0]
        f = X[2][1]
        if (a-c)*(b-f) == (a-e)*(b-d):
            continue
        py = ((e-a)*(a**2+b**2-c**2-d**2)-(c-a)*(a**2+b**2-e**2-f**2))/(2*(e-a)*(b-d)-2*(c-a)*(b-f))
        if c == a:
            px = (2*(b-f)*py-(a**2+b**2-e**2-f**2))/(2*(e-a))
        else:
            px = (2*(b-d)*py-(a**2+b**2-c**2-d**2))/(2*(c-a))
        r = math.sqrt((px-a)**2+(py-b)**2)
        for Y in p:
            if not (r+0.000001)**2 >= (px-Y[0])**2 + (py-Y[1])**2:
                ok = False
        if ok:
            ans = min(ans, r)
T = list(itertools.combinations(p,2))
for X in T:
    a = X[0][0]
    b = X[0][1]
    c = X[1][0]
    d = X[1][1]
    ok = True
    px = (a+c)/2
    py = (b+d)/2
    r = math.sqrt((px-a)**2+(py-b)**2)
    for Y in p:
        if not (r+0.000001)**2 >= (px-Y[0])**2 + (py-Y[1])**2:
            ok = False
    if ok:
        ans = min(ans, r)
print(ans)

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

ans = 100000000

for i in range(N):
    ax, ay = XY[i]
    
    for j in range(i+1, N):
        bx, by = XY[j]

        dx = (ax+bx)/2
        dy = (ay+by)/2
        r2 = (ax-dx)**2 + (ay-dy)**2

        ok = True
        for x,y in XY:
            if (x-dx)**2 + (y-dy)**2 > r2 + 1e-5:
                ok = False
                break
        if ok:
            ans = min(ans, r2)

        
        for k in range(j+1, N):
            cx, cy = XY[k]

            a = (bx-cx)**2 + (by-cy)**2
            b = (cx-ax)**2 + (cy-ay)**2
            c = (ax-bx)**2 + (ay-by)**2

            aa = a*(b+c-a)
            bb = b*(c+a-b)
            cc = c*(a+b-c)
            delim = aa + bb + cc
            if delim<1e-10: continue
            dx = (ax*aa + bx*bb + cx*cc) / delim
            dy = (ay*aa + by*bb + cy*cc) / delim
            r2 = (ax-dx)**2 + (ay-dy)**2

            ok = True
            for x,y in XY:
                if (x-dx)**2 + (y-dy)**2 > r2 + 1e-5:
                    ok = False
                    break
            if ok:
                ans = min(ans, r2)

print(ans**0.5)

Solution (Python):
import math

def f(a,b,x,y):
    ans=math.sqrt( (a-x)*(a-x) + (b-y)*(b-y) )
    return ans

def circumcenter(ax,ay,bx,by,cx,cy):
    d = 2 * (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by))
    if d==0:
        return (-1,-1)
    ux = ((ax * ax + ay * ay) * (by - cy) + (bx * bx + by * by) * (cy - ay) + (cx * cx + cy * cy) * (ay - by)) / d
    uy = ((ax * ax + ay * ay) * (cx - bx) + (bx * bx + by * by) * (ax - cx) + (cx * cx + cy * cy) * (bx - ax)) / d
    return (ux, uy)

n=int(input())
x=[]
y=[]
for i in range(n):
    u,v=map(int,input().split())
    x.append(u)
    y.append(v)
if n==2:
    ans=f(x[0],y[0],x[1],y[1])/2
    print("%0.12f"%ans)
else:
    radius=20000
    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):

                a,b=circumcenter(x[i],y[i],x[j],y[j],x[k],y[k])
                if a==-1 and b==-1:
                    continue
                r=f(a,b,x[i],y[i])

                ff=1
                for l in range(n):
                    if f(a,b,x[l],y[l])>r:
                        ff=0
                        break
                if ff:
                    radius=min(radius,r)
    for i in range(n):
        for j in range(i+1,n):
            a=(x[i]+x[j])/2
            b=(y[i]+y[j])/2
            r=f(x[i],y[i],x[j],y[j])/2
            ff=1
            for k in range(n):
                if f(a,b,x[k],y[k])>r:
                    ff=0
                    break
            if ff:
                radius=min(r,radius)
    print("%0.12f"%radius)

Solution (Python):
n = int(input())
l = [tuple(map(int, input().split())) for _ in range(n)]
ans = 10**5
dist = lambda p,q: ((p[0]-q[0])**2 + (p[1]-q[1])**2)**.5
check = lambda c,d: all(dist(c,p)<=d for p in l)

def S(p1,p2,p3):
  a,b = p1; c,d = p2; e,f = p3
  return abs((d-b)*(e-a) - (f-b)*(c-a))

def disk(p1,p2,p3):
  x1,y1 = p1; x2,y2 = p2; x3,y3 = p3
  a2 = (x2 - x3) **2 + (y2 -y3) ** 2 
  b2 = (x1 - x3) **2 + (y1 -y3) ** 2
  c2 = (x2 - x1) **2 + (y2 -y1) ** 2
  area = ((x2 - x1) * (y3 -y1) - (x3 -x1) * (y2- y1)) / 2
  if area == 0:
    return (0,0),10**5
  x = (a2*(b2+c2-a2)*x1 + b2*(c2+a2-b2)*x2 +c2*(a2+b2-c2)*x3) / (16*area*area)
  y = (a2*(b2+c2-a2)*y1 + b2*(c2+a2-b2)*y2 +c2*(a2+b2-c2)*y3) / (16*area*area) 
  r = ((x1 - x ) ** 2 + (y1 - y) ** 2)**.5
  return (x,y), r

for i in range(n-1):
  for j in range(i+1,n):
    c = ((l[i][0]+l[j][0])/2, (l[i][1]+l[j][1])/2)
    d = dist(l[i],l[j])/2
    if check(c,d) and d < ans:
      ans = d
    
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      c,d = disk(l[i],l[j],l[k])
      if check(c,d) and d < ans:
        ans = d
        
print(ans)

Solution (Python):
import math, random

def make_circle(points):
	
	shuffled = [(float(x), float(y)) for (x, y) 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[ : 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[ : i + 1], p, q)
	return c



def _make_circle_two_points(points, p, q):
	circ = make_diameter(p, q)
	left  = None
	right = None
	px, py = p
	qx, qy = q
	
	
	for r in points:
		if is_in_circle(circ, r):
			continue
		
		
		cross = _cross_product(px, py, qx, qy, 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(px, py, qx, qy, c[0], c[1]) > _cross_product(px, py, qx, qy, left[0], left[1])):
			left = c
		elif cross < 0.0 and (right is None or _cross_product(px, py, qx, qy, c[0], c[1]) < _cross_product(px, py, qx, qy, right[0], right[1])):
			right = c
	
	
	if left is None and right is None:
		return circ
	elif left is None:
		return right
	elif right is None:
		return left
	else:
		return left if (left[2] <= right[2]) else right


def make_diameter(a, b):
	cx = (a[0] + b[0]) / 2.0
	cy = (a[1] + b[1]) / 2.0
	r = math.hypot(cx - a[0], cy - a[1])
	return (cx, cy, r)


def make_circumcircle(a, b, c):
	
	ox = (min(a[0], b[0], c[0]) + max(a[0], b[0], c[0])) / 2.0
	oy = (min(a[1], b[1], c[1]) + max(a[1], b[1], c[1])) / 2.0
	ax = a[0] - ox;  ay = a[1] - oy
	bx = b[0] - ox;  by = b[1] - oy
	cx = c[0] - ox;  cy = c[1] - oy
	d = (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by)) * 2.0
	if d == 0.0:
		return None
	x = ox + ((ax*ax + ay*ay) * (by - cy) + (bx*bx + by*by) * (cy - ay) + (cx*cx + cy*cy) * (ay - by)) / d
	y = oy + ((ax*ax + ay*ay) * (cx - bx) + (bx*bx + by*by) * (ax - cx) + (cx*cx + cy*cy) * (bx - ax)) / d
	ra = math.hypot(x - a[0], y - a[1])
	rb = math.hypot(x - b[0], y - b[1])
	rc = math.hypot(x - c[0], y - c[1])
	return (x, y, max(ra, rb, rc))


_MULTIPLICATIVE_EPSILON = 1 + 1e-14

def is_in_circle(c, p):
	return c is not None and math.hypot(p[0] - c[0], p[1] - c[1]) <= c[2] * _MULTIPLICATIVE_EPSILON



def _cross_product(x0, y0, x1, y1, x2, y2):
	return (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0)

p = []
for i in range(int(input())):
	x = list(map(int, input().split()))
	p.append((x[0], x[1]))
x = make_circle(p)
x = list(x)
print(x[2])

Solution (Python):





















import math, random










def make_circle(points):
	
	shuffled = [(float(x), float(y)) for (x, y) 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[ : 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[ : i + 1], p, q)
	return c



def _make_circle_two_points(points, p, q):
	circ = make_diameter(p, q)
	left  = None
	right = None
	px, py = p
	qx, qy = q
	
	
	for r in points:
		if is_in_circle(circ, r):
			continue
		
		
		cross = _cross_product(px, py, qx, qy, 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(px, py, qx, qy, c[0], c[1]) > _cross_product(px, py, qx, qy, left[0], left[1])):
			left = c
		elif cross < 0.0 and (right is None or _cross_product(px, py, qx, qy, c[0], c[1]) < _cross_product(px, py, qx, qy, right[0], right[1])):
			right = c
	
	
	if left is None and right is None:
		return circ
	elif left is None:
		return right
	elif right is None:
		return left
	else:
		return left if (left[2] <= right[2]) else right


def make_diameter(a, b):
	cx = (a[0] + b[0]) / 2.0
	cy = (a[1] + b[1]) / 2.0
	r0 = math.hypot(cx - a[0], cy - a[1])
	r1 = math.hypot(cx - b[0], cy - b[1])
	return (cx, cy, max(r0, r1))


def make_circumcircle(a, b, c):
	
	ox = (min(a[0], b[0], c[0]) + max(a[0], b[0], c[0])) / 2.0
	oy = (min(a[1], b[1], c[1]) + max(a[1], b[1], c[1])) / 2.0
	ax = a[0] - ox;  ay = a[1] - oy
	bx = b[0] - ox;  by = b[1] - oy
	cx = c[0] - ox;  cy = c[1] - oy
	d = (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by)) * 2.0
	if d == 0.0:
		return None
	x = ox + ((ax*ax + ay*ay) * (by - cy) + (bx*bx + by*by) * (cy - ay) + (cx*cx + cy*cy) * (ay - by)) / d
	y = oy + ((ax*ax + ay*ay) * (cx - bx) + (bx*bx + by*by) * (ax - cx) + (cx*cx + cy*cy) * (bx - ax)) / d
	ra = math.hypot(x - a[0], y - a[1])
	rb = math.hypot(x - b[0], y - b[1])
	rc = math.hypot(x - c[0], y - c[1])
	return (x, y, max(ra, rb, rc))


_MULTIPLICATIVE_EPSILON = 1 + 1e-14

def is_in_circle(c, p):
	return c is not None and math.hypot(p[0] - c[0], p[1] - c[1]) <= c[2] * _MULTIPLICATIVE_EPSILON



def _cross_product(x0, y0, x1, y1, x2, y2):
	return (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0)

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

print(make_circle(points)[2])

Solution (Python):
from math import hypot
N = int(input())
XY = [tuple(map(int,input().split())) for i in range(N)]

if N == 2:
    d = hypot(XY[0][0]-XY[1][0], XY[0][1]-XY[1][1])
    print(d/2)
    exit()

def center(a,b,c,d,e,f):
    aa = a * a
    bb = b * b
    cc = c * c
    dd = d * d
    ee = e * e
    ff = f * f
    py = ((e - a) * (aa + bb - cc - dd) - (c - a) * (aa + bb - ee- ff)) / (2 * (e - a)*(b - d) - 2 * (c - a) * (b - f))
    px = (2 * (b - f) * py - aa - bb + ee + ff) / (2 * (e - a)) \
        if (c == a) else (2 * (b - d) * py - aa - bb + cc + dd) / (2 * (c - a))
    r = hypot(px - a, py - b)
    return (r,px,py)

eps = 10**-10
ans = float('inf')
for i in range(N-2):
    x1,y1 = XY[i]
    for j in range(i+1,N-1):
        x2,y2 = XY[j]
        for k in range(j+1,N):
            x3,y3 = XY[k]
            try:
                r,px,py = center(x1,y1,x2,y2,x3,y3)
            except ZeroDivisionError:
                continue
            for x,y in XY:
                d = hypot(px-x, py-y)
                if d <= r+eps:
                    continue
                break
            else:
                ans = min(ans,r)
for i in range(N-1):
    for j in range(i+1,N):
        x1,y1 = XY[i]
        x2,y2 = XY[j]
        x = (x1+x2)/2
        y = (y1+y2)/2
        r = hypot(x1-x, y1-y)
        for x3,y3 in XY:
            d = hypot(x-x3,y-y3)
            if d <= r+eps:
                continue
            break
        else:
            ans = min(ans,r)

print(ans)

Solution (Python):
import math
import random
import sys

input = sys.stdin.readline

ri = lambda: int(input())
rs = lambda: input().rstrip()
ril = lambda: list(map(int, input().split()))
rsl = lambda: input().rstrip().split()
ris = lambda n: [ri() for _ in range(n)]
rss = lambda n: [rs() for _ in range(n)]
rils = lambda n: [ril() for _ in range(n)]
rsls = lambda n: [rsl() for _ in range(n)]

n = ri()
ls = rils(n)

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)


print(make_circle(ls)[2])

Solution (Python):
N=int(input())
X=[[0]*2 for i in range(N)]
for i in range(N):
  X[i]=list(map(int,input().split()))

r2max=0
for i in range(N):
  for j in range(i+1):
    for k in range(j+1):
      if i>j and j>k:
        x=(X[i])
        y=(X[j])
        z=(X[k])
        M=[x[0]-y[0],y[0]-z[0],x[1]-y[1],y[1]-z[1],z[0]-x[0],z[1]-x[1]]
        a=M[0]*M[3]-M[1]*M[2]
        b=-M[0]*M[1]-M[2]*M[3]
        c=-M[0]*M[4]-M[2]*M[5]
        d=-M[4]*M[1]-M[5]*M[3]
        if a!=0 and b>0 and c>0 and d>0:
          xyl=x[0]**2+x[1]**2-(y[0]**2+y[1]**2)
          yzl=y[0]**2+y[1]**2-(z[0]**2+z[1]**2)
          A=(M[3]*xyl-M[2]*yzl)/(2*a)
          B=(-M[1]*xyl+M[0]*yzl)/(2*a)
          r2=(x[0]-A)**2+(x[1]-B)**2
          if r2>r2max:
            r2max=r2
for i in range(N):
  for j in range(i+1):
    r2=(X[i][0]-X[j][0])**2+(X[i][1]-X[j][1])**2
    r2=r2/4
    if r2>r2max:
      r2max=r2
import math
print(math.sqrt(r2max))

Solution (Python):
import math
eps = 10 ** -7
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
ans = float('inf')
if n == 2:
    x1, y1 = l[0]
    x2, y2 = l[1]
    d = ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** .5
    print(d / 2)
    exit(0)
for i in range(n):
    x1, y1 = l[i]
    for j in range(i + 1, n):
        x2, y2 = l[j]
        for k in range(j + 1, n):
            x3, y3 = l[k]
            d1, d2, d3 = [(x1 - x2) ** 2 + (y1 - y2) ** 2, (x1 - x3)
                          ** 2 + (y1 - y3) ** 2, (x2 - x3) ** 2 + (y2 - y3) ** 2]
            sd1, sd2, sd3 = sorted([d1, d2, d3])
            if sd1 + sd2 > sd3:
                points = [x1, y1, x2, y2, x3, y3]
                a = points[0]
                b = points[1]
                c = points[2]
                d = points[3]
                e = points[4]
                f = points[5]

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

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

                r = math.hypot(x - a, y - b)
            else:
                idx = [d1, d2, d3].index(max(d1, d2, d3))
                if idx == 0:
                    x = x1 + (x2 - x1) / 2
                    y = y1 + (y2 - y1) / 2
                    r = d1 ** .5 / 2
                elif idx == 1:
                    x = x1 + (x3 - x1) / 2
                    y = y1 + (y3 - y1) / 2
                    r = d2 ** .5 / 2
                else:
                    x = x3 + (x2 - x3) / 2
                    y = y3 + (y2 - y3) / 2
                    r = d3 ** .5 / 2
            for s in range(n):
                px, py = l[s]
                if ((px - x) ** 2 + (py - y) ** 2) ** .5 - r > eps:
                    break
            else:
                ans = min(ans, r)
print(ans)