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 dist(i,j):
    return hypot(xy[i][0]-xy[j][0],xy[i][1]-xy[j][1])
    
def center(i,j,k):
    a,b = xy[i]
    c,d = xy[j]
    e,f = xy[k]
    
    
    pp = (e-a)*(b-d)-(c-a)*(b-f)
    if pp == 0:
        if (c-a) == 0:
            ratio = (f-b)/(d-b) 
            if ratio > 1: 
                return (e+a)/2,(f+b)/2
            elif ratio > 0: 
                return (c+a)/2,(d+b)/2
            else: 
                return (c+e)/2,(d+f)/2
        else:
            ratio = (e-a)/(c-a) 
            if ratio > 1: 
                return (e+a)/2,(f+b)/2
            elif ratio > 0: 
                return (c+a)/2,(d+b)/2
            else: 
                return (c+e)/2,(d+f)/2

    bunbo = 2*(a*(d-f)+c*(f-b)+e*(b-d))
    px = (a*a+b*b)*(d-f)+(c*c+d*d)*(f-b)+(e*e+f*f)*(b-d)
    px /= bunbo
    py = (a*a+b*b)*(e-c)+(c*c+d*d)*(a-e)+(e*e+f*f)*(c-a)
    py /= bunbo
    return px,py
    



import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

n = int(input())



xy = [[int(i) for i in readline().split()] for _ in range(n)]
xy += [[0,0]]
from math import hypot
if n==2:
    print(dist(0,1)/2)
    exit()


from itertools import combinations
L = list(range(n))

ans = 1000000000
for i,j,k in combinations(L,3):
    xy[-1] = center(i,j,k)
    d = max(dist(l,-1) for l in range(n))
    if ans > d:
        ans = d


for i,j in combinations(L,2):
    xx = (xy[i][0]+xy[j][0])/2
    yy = (xy[i][1]+xy[j][1])/2
    xy[-1] = [xx,yy]
    d = max(dist(l,-1) for l in range(n))
    if ans > d:
        ans = d

print(ans)

Solution (Python):
import sys
from itertools import combinations

import numpy as np

n = int(input())
points = np.array([np.fromiter(map(int, line.split()), dtype=np.float64) for line in sys.stdin])

if n == 2:
    p1, p2 = points
    print(np.sqrt(((p1 - p2) ** 2).sum()) / 2)
    exit()

ans = 10 ** 18
for p1, p2, p3 in combinations(points, 3):
    A = ((p2 - p3) ** 2).sum()
    B = ((p3 - p1) ** 2).sum()
    C = ((p1 - p2) ** 2).sum()
    sa, sb, sc = sorted([A, B, C])
    if sa + sb <= sc + 1e-7:
        c = (p2 + p3 if A == sc else p1 + p3 if B == sc else p1 + p2) / 2
        R2 = sc / 4
    else:
        T = A * (B + C - A)
        U = B * (C + A - B)
        W = C * (A + B - C)
        c = (T * p1 + U * p2 + W * p3) / (T + U + W)
        R2 = ((c - p1) ** 2).sum()
    if ((points - c) ** 2).sum(axis=1).max() <= R2 + 1e-7:
        print(np.sqrt(R2))
        break
else:
    raise AssertionError

Solution (Python):
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
import math
def dist(x0, y0, x1, y1):
    return ((x0-x1)**2+(y0-y1)**2)**0.5
ans = 10**18
eps = 10**(-7)
for i in range(N):
    for j in range(i):
        for k in range(j):
            xi, yi = xy[i]
            xj, yj = xy[j]
            xk, yk = xy[k]
            a = xi
            b = yi
            c = xj
            d = yj
            e = xk
            f = yk

            aa = a * a
            bb = b * b
            cc = c * c
            dd = d * d
            ee = e * e
            ff = f * f
            try:
                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))
            except:
                continue

            r = math.hypot(px - a, py - b)
            flag = True
            for l in range(N):
                xl, yl = xy[l]
                if math.hypot(xl-px, yl-py)<=r+eps:
                    continue
                flag = False
            if flag:
                ans = min(ans, r)
for i in range(N):
    for j in range(i):
        xi, yi = xy[i]
        xj, yj = xy[j]
        px, py = (xi+xj)/2, (yi+yj)/2
        r = dist(xi, yi, xj, yj)/2
        flag = True
        for l in range(N):
            xl, yl = xy[l]
            if math.hypot(xl-px, yl-py)<=r+eps:
                continue
            flag = False
        if flag:
            ans = min(ans, r)
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
	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 = [[int(x) for x in input().split()] for _ in range(n)]

print(make_circle(points)[-1])

Solution (Python):
N = int(input())

x = []

for i in range(N):
    x.append(list(map(int,input().split()))) 


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

D = [[dist2(x[i],x[j]) for i in range(N)] for j in range(N)]

def dist3(i,j,k):
    a,b,c = D[i][j],D[j][k],D[k][i]
    cosA = (b**2 + c**2 - a**2)/(2*b*c)
    sinA = (1 - cosA**2)**0.5

    if sinA>1e-7:
        ans =(a/sinA)/2
        return ans
    else:
        return 0

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

ans = 0

for i in range(N):
    for j in range(i+1,N):
        ans = max(D[i][j]/2,ans)
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            flag = True
            if dist2(x[k],mid(x[i],x[j])) <= D[i][j]/2 or dist2(x[j],mid(x[i],x[k])) <= D[i][k]/2 or dist2(x[i],mid(x[j],x[k])) <= D[j][k]/2:
                flag=False
            ans = max(D[i][j]/2,D[j][k]/2,D[k][i]/2,ans)
            if flag:
                ans = max(dist3(i,j,k),ans)

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
n = int(input())
X = [list(map(int,input().split())) for i in range(n)]
eps = 10**-8
import math
def gaisin(xa,ya,xb,yb,xc,yc):
    a=((xb-xc)**2 + (yb-yc)**2)**0.5
    b=((xa-xc)**2 + (ya-yc)**2)**0.5
    c=((xb-xa)**2 + (yb-ya)**2)**0.5
    
    ca=(b**2+c**2-a**2) / (2*b*c)
    cb=(a**2+c**2-b**2) / (a*2*c)
    cc=(a**2+b**2-c**2) / (a*b*2)
    sa2=2*ca*(max(0,1-ca**2)**0.5)
    sb2=2*cb*(max(0,1-cb**2)**0.5)
    sc2=2*cc*(max(0,1-cc**2)**0.5)
    if sa2+sb2+sc2 < eps:
        x = (max(xa,xb,xc) - min(xa,xb,xc)) / 2
        y = (max(ya,yb,yc) - min(ya,yb,yc)) / 2
    else:
        x=(sa2*xa + sb2*xb + sc2*xc) / (sa2+sb2+sc2)
        y=(sa2*ya + sb2*yb + sc2*yc) / (sa2+sb2+sc2)
    return [x,y]

def gaisin2(xa,ya,xb,yb):
    x = (xa+xb)/2
    y = (ya+yb)/2
    return [x,y]


ans = float("inf")
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            g = gaisin(X[i][0],X[i][1],X[j][0],X[j][1],X[k][0],X[k][1])
            x = g[0]
            y = g[1]
            r2 = ((x-X[i][0]) ** 2 + (y-X[i][1]) ** 2 +\
                 (x-X[j][0]) ** 2 + (y-X[j][1]) ** 2 +\
                     (x-X[k][0]) ** 2 + (y-X[k][1]) ** 2) / 3
            
            ok = 0
            for a in range(n):
                if (x-X[a][0]) ** 2 + (y-X[a][1]) ** 2 <= r2 + eps:
                    ok += 1
            if ok == n:
                ans = min(ans, r2)

for i in range(n):
    for j in range(i+1,n):
        g = gaisin2(X[i][0],X[i][1],X[j][0],X[j][1])
        x = g[0]
        y = g[1]
        r2 = ((x-X[i][0]) ** 2 + (y-X[i][1]) ** 2 +\
                 (x-X[j][0]) ** 2 + (y-X[j][1]) ** 2) / 2
        
        ok = 0
        for a in range(n):
            if (x-X[a][0]) ** 2 + (y-X[a][1]) ** 2 <= r2 + eps:
                ok += 1
        if ok == n:
            ans = min(ans, r2)

print(ans**0.5)

Solution (Python):
import numpy as np
import math
n = int(input())

def min_c(a, b, c):
    a1 = sum((b - c)** 2)
    b1 = sum((a - c)** 2)
    c1 = sum((a - b)** 2)
    a1, b1, c1 = sorted([a1, b1, c1],reverse=True)
    if a1 >= b1 + c1:
        return math.sqrt(a1) / 2
    a1 = math.sqrt(a1)
    b1 = math.sqrt(b1)
    c1 = math.sqrt(c1)
    cosa = (b1 ** 2 + c1 ** 2 - a1 ** 2) / (2 * b1 * c1)
    sina=math.sqrt(1-cosa**2)
    return a1/2/sina
    

xy = []
for _ in range(n):
    xy.append(np.array([int(i) for i in input().split()]))

if n == 2:
    ans=math.sqrt(sum((xy[0]-xy[1])**2))/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, min_c(xy[i], xy[j], xy[k]))
print(ans)

Solution (Python):
import cmath, sys
EPS = 1e-8






def Projection(point, begin, end):
	tmp = (point-begin) / (end-begin)
	return tmp.real * (end-begin) + begin


def Reflection(point, begin, end):
	tmp = (point-begin) / (end-begin)
	return tmp.conjugate() * (end-begin) + begin


def PointLineDistance(point, begin, end):
	point, begin, end = point-begin, 0, end-begin
	point = (point / end) * abs(end)
	return abs(point.imag)


def PointSegmentDistance(point, begin, end):
	point, begin, end = point-begin, 0, end-begin
	point = (point / end) * abs(end)
	end = abs(end)
	if -EPS <= point.real <= abs(end):
		return abs(point.imag)
	else:
		return min(abs(point), abs(point - end))


def OuterProduct(one, two):
	tmp = one.conjugate() * two
	return tmp.imag


def InnerProduct(one, two):
	tmp = one.conjugate() * two
	return tmp.real


def IsOnLine(point, begin, end):
	return abs(OuterProduct(begin-point, end-point)) <= EPS


def IsOnSegment(point, begin, end):
	if abs(OuterProduct(begin-point, end-point)) <= EPS and InnerProduct(begin-point, end-point) <= EPS:
		return True
	else:
		return False


def Crosspoint(a, b, c, d):
	if abs(OuterProduct(b-a, d-c)) <= EPS:
		return None
	else:
		u = OuterProduct(c-a, d-a) / OuterProduct(b-a, d-c)
		return (1-u)*a + u*b



def CCW(p, q, r):
	one, two = q-p, r-q
	if OuterProduct(one, two) > -EPS:
		return True
	else:
		return False


def Intersect_SS(b1, e1, b2, e2):
	if IsOnSegment(b1, b2, e2) or IsOnSegment(e1, b2, e2) or IsOnSegment(b2, b1, e1) or IsOnSegment(e2, b1, e1):
		return True
	elif (CCW(b1, e1, b2) != CCW(b1, e1, e2)) and (CCW(b2, e2, b1) != CCW(b2, e2, e1)):
		return True
	else:
		return False


def SegmentSegmentDistance(a, b, c, d):
	if Intersect_SS(a, b, c, d):
		return 0
	else:
		return min(PointSegmentDistance(a, c, d), PointSegmentDistance(b, c, d), PointSegmentDistance(c, a, b), PointSegmentDistance(d, a, b))


def ConvexHull(dots):
	dots.sort(key=lambda x: (x.real, x.imag))
	res1 = [dots[0]]
	for d in dots[1:]:
		if len(res1) == 1:
			res1.append(d)
		else:
			while len(res1) > 1 and not CCW(res1[-2], res1[-1], d):
				res1.pop()
			res1.append(d)
	dots.reverse()
	res2 = [dots[0]]
	for d in dots[1:]:
		if len(res2) == 1:
			res2.append(d)
		else:
			while len(res2) > 1 and not CCW(res2[-2], res2[-1], d):
				res2.pop()
			res2.append(d)
	return res1[:-1] + res2[:-1]


def ConvexDiameter(qs):
	n = len(qs)
	if n == 2:
 		return abs(qs[0]-qs[1])
	i, j = 0, 0
	for k in range(n):
		if qs[k].real < qs[i].real:
			i = k
		if qs[j].real < qs[k].real:
			j = k
	res = 0
	si, sj = i, j
	while i != sj or j != si:
		res = max(res, abs(qs[i]-qs[j]))
		if OuterProduct(qs[i-n+1] - qs[i], qs[j-n+1] - qs[j]) < -EPS:
			i = (i+1) % n
		else:
			j = (j+1) % n
	return res


def InsidePolygon(point, dots):
	res = 0
	for i in range(len(dots)-1):
		res += cmath.phase((dots[i+1]-point) / (dots[i]-point))
	res += cmath.phase((dots[0]-point) / (dots[-1]-point))
	if abs(res) <= EPS:
		return False
	else:
		return True


def Area(dots):
	res = 0
	for i in range(len(dots)-1):
		res += OuterProduct(dots[i], dots[i+1])
	res += OuterProduct(dots[-1], dots[0])
	return res/2


n = int(input())

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

if n == 2:
	print(abs(dots[0]-dots[1])/2)
	sys.exit()

ch = ConvexHull(dots)


ans = 10**6
m = len(ch)
for i in range(m):
	for j in range(i+1, m):
		for k in range(j+1, m):
			x, y, z = ch[i], ch[j], ch[k]
			if Crosspoint(x, y, z, y) is None:
				center, diam = (x+y)/2, abs(x-y)/2
				if abs(y-z)/2 > diam:
					center, diam = (y+z)/2, abs(y-z)/2
				if abs(z-x)/2 > diam:
					center, diam = (z+x)/2, abs(z-x)/2

			else:
				cos_x = InnerProduct(y-x, z-x) / (abs(y-x) * abs(z-x))
				cos_y = InnerProduct(x-y, z-y) / (abs(x-y) * abs(z-y))
				cos_z = InnerProduct(y-z, x-z) / (abs(y-z) * abs(x-z))
				if cos_x < -EPS:
					center = (y+z)/2
					diam = abs(y-z)/2
				elif cos_y < -EPS:
					center = (x+z)/2
					diam = abs(x-z)/2
				elif cos_z < -EPS:
					center = (x+y)/2
					diam = abs(x-y)/2
				else:
					mid1, mid2 = (x+y)/2, (x+z)/2
					p1, p2 = mid1 + 1j * (x-y), mid2 + 1j * (x-z)
					center = Crosspoint(mid1, p1, mid2, p2)
					diam = abs(x-center)

			
			ok = True
			for d in ch:
				if d == x or d == y or d == z:
					continue
				if abs(d-center) > diam - EPS:
					ok = False
			if ok:
				ans = min(ans, diam)

print(ans)

Solution (Python):
import itertools
N = int(input())
XY = [tuple([int(_) for _ in input().split()][::-1]) for _ in range(N)]
XY.sort()


def calc(a, b, c, d, e, f):
    if (c - a) * (e - a) + (d - b) * (f - b) < 0:
        return ((e-c)**2+(f-d)**2)/4
    if (e - c) * (a - c) + (f - d) * (b - d) < 0:
        return ((a-e)**2+(b-f)**2)/4
    if (a - e) * (c - e) + (b - f) * (d - f) < 0:
        return ((a-c)**2+(b-d)**2)/4

    if (e - a) * (b - d) == (c - a) * (b - f):
        vx = max([a, c, e]) - min([a, c, e])
        vy = max([b, d, f]) - min([b, d, f])
        return (vx**2 + vy**2) / 4
    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 - d) * Py - a**2 - b**2 + c**2 + d**2) / (2 * (c - a))
    else:
        Px = (2 * (b - f) * Py - a**2 - b**2 + e**2 + f**2) / (2 * (e - a))
    R2 = ((Px - a)**2 + (Py - b)**2)
    return R2



def cross(a, b, c):
    return (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0])


def convex_hull(ps):
    qs = []
    n = len(ps)
    for p in ps:
        while len(qs) > 1 and cross(qs[-1], qs[-2], p) > 0:
            qs.pop()
        qs.append(p)
    t = len(qs)
    for i in range(n - 2, -1, -1):
        p = ps[i]
        while len(qs) > t and cross(qs[-1], qs[-2], p) > 0:
            qs.pop()
        qs.append(p)
    return qs


XY = convex_hull(XY)[::-1]
N = len(XY)

ans = -1
if N == 2:
    a, b = XY[0]
    c, d = XY[1]
    print(((a - c)**2 + (b - d)**2)**0.5 / 2)
    exit()
for i, j, k in itertools.combinations(range(N), 3):
    a, b = XY[i]
    c, d = XY[j]
    e, f = XY[k]
    r2 = calc(a, b, c, d, e, f)
    if r2 > ans:
        ans=r2
print(ans**0.5)

Solution (Python):
import sys
input = sys.stdin.readline
from math import sqrt
from itertools import combinations

N = int(input())
xy = [[int(i) for i in input().split()] for _ in range(N)]
E = 1e-9

def vnrm(v) :
  d = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2])
  for i in range(3) :
    v[i] /= d

  return d

def vrot90(v) :
  v0 = v[0]
  v[0] = -v[1]
  v[1] =  v0

def calc(x1, y1, x2, y2, x3, y3) :
  c = [0] * 3
  v123 = (x2-x1)*(x3-x2) + (y2-y1)*(y3-y2)
  v231 = (x3-x2)*(x1-x3) + (y3-y2)*(y1-y3)
  v312 = (x1-x3)*(x2-x1) + (y1-y3)*(y2-y1)

  if v123 < 0 and v231 < 0 and v312 < 0 :
    x12 = (x1+x2)/2
    y12 = (y1+y2)/2
    v12 = [x2-x1, y2-y1, 0.]
    vnrm(v12)
    vrot90(v12)
    x13 = (x1+x3)/2
    y13 = (y1+y3)/2
    v13 = [x3-x1, y3-y1, 0.]
    vnrm(v13)
    vrot90(v13)
    d = -(v12[0]*v13[1] - v12[1]*v13[0])
    ds = -(x13-x12)*v13[1] + (y13-y12)*v13[0]
    s = ds/d
    c[0] = x12 + s*v12[0]
    c[1] = y12 + s*v12[1]
    c[2] = sqrt((x1-c[0])*(x1-c[0]) + (y1-c[1])*(y1-c[1]))
  
  else :
    if v123 >= 0 :
      c[0] = (x1+x3)/2
      c[1] = (y1+y3)/2
      c[2] = sqrt((x1-x3)*(x1-x3) + (y1-y3)*(y1-y3))/2
    elif v231 >= 0 :
      c[0] = (x1+x2)/2
      c[1] = (y1+y2)/2
      c[2] = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2))/2
    else :
      c[0] = (x2+x3)/2
      c[1] = (y2+y3)/2
      c[2] = sqrt((x2-x3)*(x2-x3) + (y2-y3)*(y2-y3))/2

  return c

ret = float('inf')
for (i, j, k) in combinations(range(N), 3) :
  cx, cy, cr = calc(xy[i][0], xy[i][1], xy[j][0], xy[j][1], xy[k][0], xy[k][1])
  for x, y in xy :
    if sqrt((cx - x) ** 2 + (cy - y) ** 2) > cr + E :
      break
  else :
    ret = min(ret, cr)
    
if N == 2 :
  r = sqrt((xy[0][0] - xy[1][0]) ** 2 + (xy[0][1] - xy[1][1]) ** 2)
  print(r / 2)

else :
  print(ret)

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

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)

print(make_circle(P)[2])

Solution (Python):

import sys
import math
import random
sys.setrecursionlimit(10**5)
input = sys.stdin.readline





























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)

if __name__ == "__main__":
    n = int(input())
    points = []
    for i in range(n):
        x, y = [int(item) for item in input().split()]
        points.append((x, y))
    ret = make_circle(points)
    print(ret[2])

Solution (Python):
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
import math
def dist(x0, y0, x1, y1):
    return ((x0-x1)**2+(y0-y1)**2)**0.5
ans = 10**18
eps = 10**(-7)
for i in range(N):
    for j in range(i):
        for k in range(j):
            xi, yi = xy[i]
            xj, yj = xy[j]
            xk, yk = xy[k]
            a = xi
            b = yi
            c = xj
            d = yj
            e = xk
            f = yk

            aa = a * a
            bb = b * b
            cc = c * c
            dd = d * d
            ee = e * e
            ff = f * f
            
            if (2 * (e - a)*(b - d) - 2 * (c - a) * (b - f)) == 0 or (2 * (e - a)) == 0:
                continue
            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 = math.hypot(px - a, py - b)
            flag = True
            for l in range(N):
                xl, yl = xy[l]
                if math.hypot(xl-px, yl-py)<=r+eps:
                    continue
                flag = False
            if flag:
                ans = min(ans, r)
for i in range(N):
    for j in range(i):
        xi, yi = xy[i]
        xj, yj = xy[j]
        px, py = (xi+xj)/2, (yi+yj)/2
        r = dist(xi, yi, xj, yj)/2
        flag = True
        for l in range(N):
            xl, yl = xy[l]
            if math.hypot(xl-px, yl-py)<=r+eps:
                continue
            flag = False
        if flag:
            ans = min(ans, r)
print(ans)

Solution (Python):
def main():
    n = int(input())
    xy = [list(map(int, input().split())) for _ in [0]*n]
    from scipy.optimize import fmin

    def calc(k):
        i, j = k
        ans = 0
        for x, y in xy:
            ans = max(ans, (x-i)**2+(y-j)**2)
        return ans

    x, y = fmin(calc, [500, 500], disp=0)
    print(calc((x, y))**0.5)


main()

Solution (Python):
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()
xys = [inpl() for _ in range(N)]

if N == 2:
    x0,y0 = xys[0]
    x1,y1 = xys[1]
    print(math.sqrt((x1-x0)**2 + (y1-y0)**2)/2)
    sys.exit()


ans = INF
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            a,b = xys[i]
            c,d = xys[j]
            e,f = xys[k]

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

            try:
                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 = math.hypot(px - a, py - b)
            except:
                if a == c == e:
                    px = a
                    py = (max(b,d,f) + min(b,d,f))/2
                    r = max(b,d,f) - min(b,d,f)
                elif b == d == f:
                    px = (max(a,c,e) + min(a,c,e))/2
                    py = b
                    r = max(a,c,e) - min(a,c,e)

            for x,y in xys:
                if (px-x)**2 +(py-y)**2 <= r**2 + eps:
                    continue
                else:
                    break
            else:
                ans = min(ans,r)


for i in range(N):
    for j in range(i+1,N):
        x0,y0 = xys[i]
        x1,y1 = xys[j]
        px = (x0+x1)/2
        py = (y0+y1)/2
        r = math.hypot(px - x0, py - y0)

        for x,y in xys:
            if (px-x)**2 +(py-y)**2 <= r**2 + eps:
                continue
            else:
                break
        else:
            ans = min(ans,r)

print(ans)

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines



import itertools
import numpy as np

N = int(readline())
m = map(int,read().split())
Z = [x + y * 1j for x,y in zip(m,m)]

def find_O(z0,z1,z2):
    z1 -= z0; z2 -= z0
    if abs((z1 * z2.conjugate()).imag) < 0.5:
        
        return None
    num = z1 * z2 * (z1-z2).conjugate()
    den = z1.conjugate() * z2
    den -= den.conjugate()
    return (num / den) + z0

A = []
for comb in itertools.combinations(Z,3):
    O = find_O(*comb)
    if O is None:
        continue
    A.append(O)
    
for z1,z2 in itertools.combinations(Z,2):
    O = (z1 + z2) / 2
    A.append(O)

Z = np.array(Z); A = np.array(A)

answer = np.abs((Z[:,None] - A[None,:])).max(axis = 0).min()
print(answer)