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 cmath
from itertools import combinations

inf = float('inf')

n, *xy = map(int, sys.stdin.read().split())
xy = zip(*[iter(xy)] * 2)
z = [x + y*1j for x, y in xy]

def circumcenter(z1, z2, z3):
    a = z2 - z1
    b = z3 - z1
    numerator = a * b * (b.conjugate() - a.conjugate())
    denominator = a * b.conjugate() - a.conjugate() * b
    o = numerator / denominator + z1
    return o

def center(z1, z2):
    return (z1 + z2) / 2

def main():
    cand = []
    for comb in combinations(z, 3):
        try: 
            cand.append(circumcenter(*comb))
        except:
            pass
    for comb in combinations(z, 2):
        cand.append(center(*comb))
    
    res = inf
    for o in cand:
        r = 0
        for i in z:
            r = max(r, abs(o - i))
        res = min(res, r)
    
    return res

if __name__ == '__main__':
    ans = main()
    print(ans)

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

cand = []
for i in range(N):
    xa,ya = xy[i]
    for j in range(i+1,N):
        xb,yb = xy[j]
        cand.append([(xa+xb)/2,(ya+yb)/2])
        for k in range(j+1,N):
            xc,yc = xy[k]
            if (xa-xb)*(ya-yc)-(xa-xc)*(ya-yb)!=0:
                x = (ya-yc)*(xa**2+ya**2-xb**2-yb**2)-(ya-yb)*(xa**2+ya**2-xc**2-yc**2)
                y = -(xa-xc)*(xa**2+ya**2-xb**2-yb**2)+(xa-xb)*(xa**2+ya**2-xc**2-yc**2)
                x /= 2*((xa-xb)*(ya-yc)-(xa-xc)*(ya-yb))
                y /= 2*((xa-xb)*(ya-yc)-(xa-xc)*(ya-yb))
                cand.append([x,y])

ans = float('inf')
for x,y in cand:
    d = 0
    for i in range(N):
        d = max(d,((xy[i][0]-x)**2+(xy[i][1]-y)**2)**0.5)
    ans = min(ans,d)
print(ans)

Solution (Python):

import math

class Point:
    def __init__(self, x, y):
        self.x = x
        self.y = y
    
    def __add__(self, q):
        if isinstance(q, Point):
            return Point(self.x + q.x, self.y + q.y)
        else:
            return Point(self.x + q, self.y + q)
    
    def __sub__(self, q):
        if isinstance(q, Point):
            return Point(self.x - q.x, self.y - q.y)
        else:
            return Point(self.x - q, self.y - q)
    
    def __mul__(self, q):
        if isinstance(q, Point):
            return Point(self.x * q.x - self.y * q.y,
                         self.x * q.y + self.y * q.x)
        else:
            return Point(self.x * q, self.y * q)
        
    def __truediv__(self, q):
        if isinstance(q, Point):
            return self * q.conj / q.norm
        else:
            return Point(self.x / q, self.y / q)
    
    @property
    def conj(self):
        return Point(self.x, -self.y)
    
    def rot(self, ang):
        return Point(math.cos(ang) * self.x - math.sin(ang) * self.y,
                     math.sin(ang) * self.x + math.cos(ang) * self.y)
    
    def rot90(self):
        return Point(-self.y, self.x)
    
    def cross(self, q):
        return self.x * q.y - self.y * q.x
    
    def dot(self, q):
        return self.x * q.x + self.y * q.y
    
    @property
    def norm(self):
        return self.dot(self)

    def __abs__(self):
        return self.dot(self) ** 0.5


class Line:
    def __init__(self, a, b):
        if not isinstance(a, Point) or not isinstance(b, Point):
            raise AttributeError("points should be instance of Point")
            
        self.a = a
        self.b = b
    
    def cross_point(self, l, eps=1e-12):
        deg = (l.b - l.a).cross(self.b - self.a)
        if abs(deg) < eps:
            return Point(0, 0)
        
        return self.a + (self.b - self.a) * (l.b - l.a).cross(l.b - self.a) / deg


def simple_ccw(a, b, c, eps=1e-12):
    if (b - a).cross(c - a) > eps:
        return 1
    if (b - a).cross(c - a) < -eps:
        return -1
    return 0


def circum_center(a, b, c):
    ab = Line((a + b) / 2, (a + b) / 2 + (a - b).rot90())
    bc = Line((b + c) / 2, (b + c) / 2 + (b - c).rot90())
    return ab.cross_point(bc)






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

cand = []
for i in range(N):
    for j in range(i + 1, N):
        cand.append((vecs[i] + vecs[j]) / 2)
        
        for k in range(j + 1, N):
            if simple_ccw(vecs[i], vecs[j], vecs[k]) == 0:
                continue
                
            cand.append(circum_center(vecs[i], vecs[j], vecs[k]))
            
ans = float("inf")
for p in cand:
    tmp = 0
    for v in vecs:
        tmp = max(tmp, abs(p - v))
    ans = min(ans, tmp)
print("{:.14f}".format(ans))

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


def dist(cx, cy, nx, ny):
    return ((cx - nx) ** 2 + (cy - ny) ** 2) ** 0.5


def circumcenter(x1, x2, x3, y1, y2, 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:
        d1 = dist(x1, y1, x2, y2)
        d2 = dist(x1, y1, x3, y3)
        d3 = dist(x2, y2, x3, y3)
        if max(d1, d2, d3) == d1:
            return (x1 + x2) / 2, (y1 + y2) / 2
        elif max(d1, d2, d3) == d2:
            return (x1 + x3) / 2, (y1 + y3) / 2
        else:
            return (x2 + x3) / 2, (y2 + y3) / 2

    
    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)

    
    return x, y


ans = float('inf')
for i in range(N):
    for j in range(N):
        for k in range(N):
            x1, y1 = points[i]
            x2, y2 = points[j]
            x3, y3 = points[k]

            cx, cy = circumcenter(x1, x2, x3, y1, y2, y3)
            tmp_ans = 0
            for nx, ny in points:
                tmp_ans = max(tmp_ans, dist(cx, cy, nx, ny))
            ans = min(ans, tmp_ans)

print(ans)

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


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

now=(500.,500.)
move=1
for i in range(200000):
    max_dist=0
    max_dist_point=-1
    for j in range(len(data)):
        d=dist(now,data[j])
        if d>max_dist:
            max_dist=d
            max_dist_point=j
    target=data[max_dist_point]
    now=(now[0]+(target[0]-now[0])*move,now[1]+(target[1]-now[1])*move)
    move*=0.999
max_dist=0
for j in range(len(data)):
    d=dist(now,data[j])
    if d>max_dist:
        max_dist=d
print(max_dist)

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

N = int(input())
points = [list(map(float,input().split())) for _ in range(N)]

def dist(p0,p1):
    x0,y0 = p0
    x1,y1 = p1
    return ((x1-x0)**2+(y1-y0)**2)**0.5

def canMakeRectangle(p0,p1,p2):
    x0,y0 = p0
    x1,y1 = p1
    x2,y2 = p2
    if (y1-y0)*(x2-x0)-(y2-y0)*(x1-x0)<EPS:
        return False
    else:
        return True

def circumcircle(p0,p1,p2):
    x0,y0 = p0
    x1,y1 = p1
    x2,y2 = p2
    l0,l1,l2 = dist(p1,p2),dist(p2,p0),dist(p0,p1)
    r = l0*l1*l2/(((l0+l1+l2)*(-l0+l1+l2)*(l0-l1+l2)*(l0+l1-l2))**0.5)
    a = ((l0**2)*(l1**2+l2**2-l0**2)*x0+(l1**2)*(l2**2+l0**2-l1**2)*x1+(l2**2)*(l0**2+l1**2-l2**2)*x2)/((l0**2)*(l1**2+l2**2-l0**2)+(l1**2)*(l2**2+l0**2-l1**2)+(l2**2)*(l0**2+l1**2-l2**2))
    b = ((l0**2)*(l1**2+l2**2-l0**2)*y0+(l1**2)*(l2**2+l0**2-l1**2)*y1+(l2**2)*(l0**2+l1**2-l2**2)*y2)/((l0**2)*(l1**2+l2**2-l0**2)+(l1**2)*(l2**2+l0**2-l1**2)+(l2**2)*(l0**2+l1**2-l2**2))
    return r,a,b

def circle(p0,p1):
    x0,y0 = p0
    x1,y1 = p1
    r = dist(p0,p1)/2
    a = (x1-x0)/2+x0
    b = (y1-y0)/2+y0
    return r,a,b

def check(c,P):
    r,a,b = c
    for p in P:
        if dist((a,b),p) > r+EPS:
            return False
    return True

ans = float('inf')

for i in range(N):
    for j in range(N):
        for k in range(N):
            if i==j or j==k or k==i:
                continue
            if canMakeRectangle(points[i],points[j],points[k]):
                r,a,b = circumcircle(points[i],points[j],points[k])
                if check((r,a,b),points):
                    ans = min(ans,r)

for i in range(N):
    for j in range(N):
        if i==j:
            continue
        r,a,b = circle(points[i],points[j])
        if check((r,a,b),points):
            ans = min(ans,r)

print(ans)

Solution (Python):
import math
N=int(input())
C=[tuple(map(int,input().split())) for _ in range(N)]
e=10**-10

def dist2(p1,p2):
    return ((p1[0]-p2[0])**2 + (p1[1]-p2[1])**2)

def max_dist_xy(x,y):
    max_dist=0
    p=(x,y)
    for c in C:
        max_dist=max(max_dist,dist2(p,c))
    return max_dist

def max_dist_x(x):
    l=0
    r=1000
    for _ in range(80):
        m1=(2*l+r)/3
        m2=(l+2*r)/3
        d1=max_dist_xy(x,m1)
        d2=max_dist_xy(x,m2)
        if d1>d2:
            l=m1
        else:
            r=m2
    return max_dist_xy(x,l)

def solve():
    l=0
    r=1000
    for _ in range(80):
        m1=(2*l+r)/3
        m2=(l+2*r)/3
        d1=max_dist_x(m1)
        d2=max_dist_x(m2)
        if d1>d2:
            l=m1
        else:
            r=m2
    return math.sqrt(max_dist_x(l))

print(solve())

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

def gaisin(a, b, c): 
  A = a[0] ** 2 + a[1] ** 2 - b[0] ** 2 - b[1] ** 2
  B = b[0] ** 2 + b[1] ** 2 - c[0] ** 2 - c[1] ** 2
  x = [2 * (b[0] - a[0]), 2 * (c[0] - b[0])]
  y = [2 * (b[1] - a[1]), 2 * (c[1] - b[1])]
  return renritu(x, y, [A, B])

def renritu(x, y, z): 
  k = x[1] * y[0] - x[0] * y[1]
  if k == 0: return False, 0, 0
  Cx = -(y[0] * z[1] - y[1] * z[0]) / k
  Cy = (x[0] * z[1] - x[1] * z[0]) / k
  return True, Cx, Cy

def nasu(a, b, c):
  f, Cx, Cy = gaisin(a, b, c)
  if f: return honyamorake(Cx, Cy)
  else: return 10 ** 10

def honya(x, y, Cx, Cy):
  return ((x - Cx) ** 2 + (y - Cy) ** 2) ** (1 / 2)

def honyaraka(a, b):
  Cx = (a[0] + b[0]) / 2
  Cy = (a[1] + b[1]) / 2
  return honyamorake(Cx, Cy)

def honyamorake(Cx, Cy):
  r = honya(xy[0][0], xy[0][1], Cx, Cy)
  for i in range(1, N):
    r = max(r, honya(xy[i][0], xy[i][1], Cx, Cy))
  return r

ans = 10 ** 10
for i in range(N - 2):
  for j in range(i + 1, N - 1):
    for k in range(j + 1, N):
      ans = min(ans, nasu(xy[i], xy[j], xy[k]))
for i in range(N - 1):
  for j in range(i + 1, N):
    ans = min(ans, honyaraka(xy[i], xy[j]))

print(ans)

Solution (Python):
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
def nasu(a, b, c):
  A = a[0] ** 2 - b[0] ** 2 + a[1] ** 2 - b[1] ** 2
  B = b[0] ** 2 - c[0] ** 2 + b[1] ** 2 - c[1] ** 2
  x = [2 * (b[0] - a[0]), 2 * (c[0] - b[0])]
  y = [2 * (b[1] - a[1]), 2 * (c[1] - b[1])]
  k = x[1] * y[0] - x[0] * y[1]
  if k == 0:
    return 10 ** 10
  Cx = -(y[0] * B - y[1] * A) / k
  Cy = (x[0] * B - x[1] * A) / k
  return honyamorake(Cx, Cy)

def honya(x, y, Cx, Cy):
  return ((x - Cx) ** 2 + (y - Cy) ** 2) ** (1 / 2)

def honyaraka(a, b):
  Cx = (a[0] + b[0]) / 2
  Cy = (a[1] + b[1]) / 2
  return honyamorake(Cx, Cy)

def honyamorake(Cx, Cy):
  r = honya(xy[0][0], xy[0][1], Cx, Cy)
  for i in range(1, N):
    r = max(r, honya(xy[i][0], xy[i][1], Cx, Cy))
  return r

ans = 10 ** 10
for i in range(N - 2):
  for j in range(i + 1, N - 1):
    for k in range(j + 1, N):
      ans = min(ans, nasu(xy[i], xy[j], xy[k]))
for i in range(N - 1):
  for j in range(i + 1, N):
    ans = min(ans, honyaraka(xy[i], xy[j]))

print(ans)

Solution (Python):
from math import hypot

def half_point(p1,p2):
    x = (p1[0] + p2[0]) / 2
    y = (p1[1] + p2[1]) / 2
    r = hypot(p1[0] - p2[0], p1[1] - p2[1]) / 2
    return (x, y, r)

def three_points_on_a_line(p1,p2,p3):
    dx1 = p1[0] - p2[0]
    dy1 = p1[1] - p2[1]
    dx2 = p1[0] - p3[0]
    dy2 = p1[1] - p3[1]

    return dx1 * dy2 == dx2 * dy1

def same_point(p1,p2,p3):
    return p1 == p2 or p1 == p3 or p2 == p3

def gaisin(p1,p2,p3):
    a = p1[0]
    b = p1[1]
    c = p2[0]
    d = p2[1]
    e = p3[0]
    f = p3[1]

    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 (px,py,r)

def in_c(x,y,r,px,py):

    if hypot(x-px,y-py) > r+10**(-6):
        return False
 
    return True

def main():
    
    N = int(input())
    X = []
    for _ in range(N):
        x, y = map(int, input().split())
        X.append((x,y))
    
    cand = []
    for i in range(N):
        for j in range(i+1,N):
            
            cand.append(half_point(X[i],X[j]))

            
            for k in range(j+1,N):
                if same_point(X[i],X[j],X[k]) or three_points_on_a_line(X[i],X[j],X[k]):
                    continue
                cand.append(gaisin(X[i],X[j],X[k]))

    ans = float('inf')
    for px, py, r in cand:
        flag = True
        for x, y in X:
            if not in_c(x,y,r,px,py):
                flag = False
                break 
        if flag:
            ans = min(ans, r)

    print(ans)



if __name__ == "__main__":
    main()

Solution (Python):


import sys
from math import hypot, sin, atan2, degrees, radians

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def add(a, b):
    x1, y1 = a
    x2, y2 = b
    return (x1+x2, y1+y2)

def sub(a, b):
    x1, y1 = a
    x2, y2 = b
    return (x1-x2, y1-y2)

def mul(a, b):
    x1, y1 = a
    if isinstance(b, tuple):
        x2, y2 = b
    else:
        x2, y2 = b, b
    return (x1*x2, y1*y2)

def div(a, b):
    x1, y1 = a
    if isinstance(b, tuple):
        x2, y2 = b
    else:
        x2, y2 = b, b
    return (x1/x2, y1/y2)

def get_dig(a, b, c):
    
    v1 = sub(b, a)
    x1, y1 = v1
    v2 = sub(c, a)
    x2, y2 = v2
    
    res = degrees(atan2(y2, x2) - atan2(y1, x1))
    
    res = abs(res)
    if res >= 180:
        res = 360 - res 
    return res

def get_dist(a, b):
    x1, y1 = a
    x2, y2 = b
    return hypot(x1-x2, y1-y2)


def calc(a, b, c):
    dig1 = get_dig(a, b, c)
    dig2 = get_dig(b, c, a)
    dig3 = get_dig(c, a, b)
    try:
        xy = div(add(add(mul(a, sin(radians(dig1)*2)), mul(b, sin(radians(dig2)*2))), mul(c, sin(radians(dig3)*2))),
            sin(radians(dig1)*2) + sin(radians(dig2)*2) + sin(radians(dig3)*2))
        return xy
    except:
        
        return ()

N = INT()
XY = []
for i in range(N):
    x, y = MAP()
    XY.append((x, y))

centers = []
for i in range(N):
    for j in range(i+1, N):
        
        xy = div(add(XY[i], XY[j]), 2)
        centers.append(xy)

for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            
            xy = calc(XY[i], XY[j], XY[k])
            if xy:
                centers.append(xy)

ans = INF
for center in centers:
    mx = 0
    for xy in XY:
        mx = max(mx, get_dist(center, xy))
    ans = min(ans, mx)
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):
import math
import itertools
N=int(input())
C=[tuple(map(int,input().split())) for _ in range(N)]
e=10**-10

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

def dist2(p1,p2):
    return ((p1[0]-p2[0])**2 + (p1[1]-p2[1])**2)

def mid(p1,p2):
    return ((p1[0]+p2[0])/2, (p1[1]+p2[1])/2)

def angle(p1,p2):
    return math.atan2(p2[1]-p1[1], p2[0]-p1[0])

def angle2(c1,c2,r):
    d = dist(c1,c2)
    return math.acos((d/2/r))

def cross(c1,c2,r):
    if dist2(c1,c2) > (2*r)**2:
        return set()
    a = angle(c1,c2)
    t = angle2(c1,c2,r)
    return set([
        (
            c1[0]+r*math.cos(a+t),
            c1[1]+r*math.sin(a+t)
        ),
        (
            c1[0]+r*math.cos(a-t),
            c1[1]+r*math.sin(a-t)
        )
    ])

def judge(r):
    P=set()
    for c1,c2 in itertools.product(C,C):
        if c1==c2:
            continue
        P |= cross(c1,c2,r)
    for p in P:
        for c in C:
            if dist2(p,c)>(r**2+e):
                break
        else:
            return True
    return False

def solve():
    under=0
    ok=800
    while ok-under>10**-6:
        m=(ok+under)/2
        if judge(m):
            ok=m
        else:
            under=m
    return ok

print(solve())

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    def dist_x(cx):
        b=0
        t=1000
        for _ in range(roop):
            cb=(t+2*b)/3
            ct=(2*t+b)/3
            if dist_xy(cx,cb)>dist_xy(cx,ct):
                b=cb
            else:
                t=ct
        return dist_xy(cx,b)

    def dist_xy(cx,cy):
        mx=0
        for x,y in xy:
            d=(x-cx)**2+(y-cy)**2
            if d>mx:mx=d
        return mx

    n = II()
    xy = [LI() for _ in range(n)]
    l=0
    r=1000
    roop=100
    for _ in range(roop):
        cl=(2*l+r)/3
        cr=(l+2*r)/3
        if dist_x(cl)>dist_x(cr):
            l=cl
        else:
            r=cr
    print(dist_x(l)**0.5)

main()

Solution (Python):


def main():
    from collections import namedtuple
    from math import hypot

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

    def f(x: float, y: float) -> float:
        """(x,y)から最遠点までの距離"""

        def dist(a: pt, b: pt) -> float:
            """二点a,b間の距離"""
            return hypot(a.x - b.x, a.y - b.y)

        return max(dist(pt(x=x, y=y), p_) for p_ in ps)

    def g(x: float) -> float:
        """xを固定し、yを自由に選んだときのfの最小値"""

        
        l, r = 0, 1000
        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)  
        

    n = int(input())
    *ps, = (pt(*map(int, input().split())) for _ in range(n))

    
    l, r = 0, 1000
    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
    ret = g(l)  
    

    print(ret)


if __name__ == '__main__':
    main()

Solution (Python):
from scipy.optimize import*;from numpy import*;n=int(input());x=array([list(map(int,input().split()))for _ in range(n)])
def r(a):return((x-a)**2).sum(1).max()**.5;
print(minimize(r,[0,0],method="Nelder-Mead",tol=1e-8).fun)

Solution (Python):
from scipy.optimize import*;from numpy import*;n=int(input());x=array([list(map(int,input().split()))for _ in range(n)])
def r(a):return sqrt(square(x-a).sum(1).max())
print(minimize(r,[0,0],method="Nelder-Mead",tol=1e-8).fun)

Solution (Python):
from sys import stdin
import sys
import numpy as np
import collections
from functools import cmp_to_key
import heapq
import math


def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def rip(sep = ''):
    if sep == '' :
        return map(int, input().split()) 
    else: return map(int, input().split(sep))
def ria(sep = ''): 
    return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()


def det(a,b,c,d):
    return a * d - b * c
def solve_linear(a, b, c, d, v, w):
    
    
    de = det(a, b, c, d)
    x = d * v - b * w
    y = -c * v + a * w
    x /= de
    y /= de
    return (x, y)
def dist2(x1, y1, x2, y2):
    return (x1 - x2) ** 2 + (y1 - y2) ** 2
eps = 1e-9

def main():
    N = ri()
    X = [0] * N
    Y = [0] * N
    for i in range(N):
        X[i], Y[i] = rip()
    
    mi = 1e12
    for i in range(N):
        for j in range(i+1,N):
            x1 = X[i]
            y1 = Y[i]
            x2 = X[j]
            y2 = Y[j]
            cx = (x1 + x2) / 2.0
            cy = (y1 + y2) / 2.0
            r2 = dist2(x1, y1, cx, cy)
            chk = True
            for k in range(N):
                chk &= (dist2(X[k], Y[k], cx, cy) < r2 + eps)
            
            if chk:
                mi = min(mi, r2)
    
    for i in range(N):
        for j in range(i+1,N):
            for k in range(j+1,N):
                x1 = X[i]
                y1 = Y[i]
                x2 = X[j]
                y2 = Y[j]
                x3 = X[k]
                y3 = Y[k]
                if det(x3-x1, y3-y1, x2-x1, y2-y1) == 0: continue
                
                
                
                
                
                cx, cy = solve_linear(2*(x1-x3), 2*(y1-y3), 2*(x1-x2), 2*(y1-y2), 
                    x1**2 - x3**2 + y1**2 - y3**2,
                    x1**2 - x2**2 + y1**2 - y2**2)
                r2 = dist2(x1, y1, cx, cy)
                chk = True
                for k in range(N):
                    chk &= (dist2(X[k], Y[k], cx, cy) < r2 + eps)
                if chk:
                    mi = min(mi, r2)
    
    print(math.sqrt(mi))


if __name__ == "__main__":
    main()

Solution (Python):

def want(x,y):

    ret = 0

    for i in xy:
        ret = max(ret, ((i[0]-x)**2+(i[1]-y)**2)**0.5)

    return ret


def want2(x):

    ly = miny
    ry = maxy

    while ry-ly > 10**(-7) and ry-ly > (ry / (10**6)):

        m1 = (ly*2+ry)/3
        m2 = (ly+ry*2)/3

        rm1 = want(x,m1)
        rm2 = want(x,m2)

        if rm1 > rm2:
            ly = m1
        else:
            ry = m2

    ansy = (ly+ry)/2
    return want(x,ansy)
    
    

N = int(input())

xy = []
minx = float("inf")
maxx = float("-inf")
miny = float("inf")
maxy = float("-inf")

for i in range(N):

    x,y = map(int,input().split())
    xy.append([x,y])

    minx = min(minx,x)
    miny = min(miny,y)
    maxx = max(maxx,x)
    maxy = max(maxy,y)


lx = minx
rx = maxx

while rx-lx > 10**(-7) and rx-lx > (rx / (10**6)):

    m1 = (lx*2+rx)/3
    m2 = (lx+rx*2)/3

    rm1 = want2(m1)
    rm2 = want2(m2)

    if rm1 > rm2:
        lx = m1
    else:
        rx = m2

print ((rm1+rm2)/2)

Solution (Python):
import math
EPS = 1e-10


class P2():
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.norm2 = (self.x**2 + self.y**2)**0.5

    def __add__(self, other):
        return P2(self.x + other.x, self.y + other.y)

    def __sub__(self, other):
        return P2(self.x - other.x, self.y - other.y)

    def smul(self, a):
        return P2(self.x * a, self.y * a)

    def dot(self, other):
        return self.x * other.x + self.y * other.y

    def det(self, other):
        return self.x * other.y - self.y * other.x

    def rot90(self):
        return P2(-self.y, self.x)


def sgn(a: float):
    if a < -EPS:
        return -1
    elif a > EPS:
        return 1
    else:
        return 0


def simple_ccw(a, b, c):
    
    return sgn((b - a).det(c - a))


class Line():
    def __init__(self, dir: P2, b: P2):
        self.dir = dir
        self.b = b

    def crosspoint(self, other):
        b = other.b - self.b
        c = self.dir.det(other.dir)
        if sgn(c) == 0:
            
            return False, None
        a = -other.dir.rot90().dot(b) / c
        return True, self.dir.smul(a) + self.b


def gaisin(p1, p2, p3):
    l1 = Line((p2 - p1).rot90(), (p2 + p1).smul(0.5))
    l2 = Line((p3 - p1).rot90(), (p3 + p1).smul(0.5))
    return l1.crosspoint(l2)  









n = int(input())
p = [P2(*map(int, input().split())) for _ in range(n)]

cand = []
for i in range(n):
    for j in range(i + 1, n):
        
        cand.append((p[i] + p[j]).smul(0.5))
        for k in range(j + 1, n):
            
            is_exist, cp = gaisin(p[i], p[j], p[k])
            if is_exist:
                cand.append(cp)

ans = 1000
for cp in cand:
    r_cand = max((pi - cp).norm2 for pi in p)
    ans = min(r_cand, ans)

print(ans)

Solution (Python):
from scipy.optimize import*
from numpy import*
n=int(input())
x=array([list(map(int,input().split()))for _ in range(n)])
def r(a):return sqrt(square(x-a).sum(1).max())
print(minimize(r,[0,0],method="Nelder-Mead",tol=1e-8).fun)

Solution (Python):
from scipy.optimize import*
from numpy import*
n=int(input())
x=array([list(map(int,input().split()))for _ in range(n)])
def r(a):return sqrt(square(x-a).sum(1).max())
print(minimize(r,[0,0],method="Nelder-Mead",tol=1e-8).fun)

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):
from scipy.optimize import minimize
import numpy as np
n=int(input())
xy=np.array([tuple(map(int,input().split())) for _ in range(n)])


def r(ab):
  return np.sqrt((np.square(xy-ab).sum(1).max()))

x0=[0,0]

res=minimize(fun=r,x0=x0,method="Nelder-Mead",tol=1e-6)
print(res.fun)