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

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  

N = I()
xy = [LI() for i in range(N)]



ans = []

def distance(A,B):
    x1,y1 = A
    x2,y2 = B
    return ((x1-x2)**2+(y1-y2)**2)**.5

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 = distance((x,y),(x1,y1))
        for k in range(N):
            if k == i or k == j:
                continue
            else:
                if distance(xy[k],(x,y)) > r+10**-8:
                    break
        else:
            ans.append(r)


def gaishin(A,B,C):
    x1,y1 = A
    x2,y2 = B
    x3,y3 = C
    a = 2*((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))
    b = x2**2-x1**2+y2**2-y1**2
    c = x3**2-x1**2+y3**2-y1**2
    if a == 0:
        return (10000,10000)
    else:
        x = ((y3-y1)*b-(y2-y1)*c)/a
        y = (-(x3-x1)*b+(x2-x1)*c)/a
    return (x,y)

for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            x,y = gaishin(xy[i],xy[j],xy[k])
            if x == 10000 and y == 10000:
                continue
            else:
                r = distance((x,y),xy[i])
                for l in range(N):
                    if l == i or l == j or l == k:
                        continue
                    else:
                        if distance(xy[l],(x,y)) > r+10**-8:
                            break
                else:
                    ans.append(r)

print(min(ans))

Solution (Python):
from numpy.linalg import det
from numpy.linalg import solve
import numpy as np
import math


def find_cross_point(x1, y1, x2, y2, x3, y3):
    A = np.array([[x2-x1, y2-y1], [x3-x2, y3-y2]])
    B = np.array([(x2**2+y2**2-x1**2-y1**2)/2, (x3**2+y3**2-x2**2-y2**2)/2])
    if det(A) == 0:
        return (float("inf"), float("inf"))
    C = solve(A, B)
    return C


N = int(input())
ans = 10**10
plots = []


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



for i in range(N):
    for j in range(i+1, N):
        sub = 0
        m_x, m_y = (plots[i][0]+plots[j][0])/2, (plots[i][1]+plots[j][1])/2
        for k in range(N):
            sub = max(sub, math.hypot(m_x-plots[k][0], m_y-plots[k][1]))
        ans = min(ans, sub)



for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            sub = 0
            x1, y1 = plots[i]
            x2, y2 = plots[j]
            x3, y3 = plots[k]
            m_x, m_y = find_cross_point(x1, y1, x2, y2, x3, y3)
            for p in range(N):
                sub = max(sub, math.hypot(m_x-plots[p][0], m_y-plots[p][1]))
            ans = min(ans, sub)
print(ans)

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


from math import sqrt
eps = 10**-10

def crosscl(cx, cy, r, x1, y1, x2, y2):
    xd = x2 - x1; yd = y2 - y1
    X = x1 - cx; Y = y1 - cy
    a = xd**2 + yd**2
    b = xd * X + yd * Y
    c = X**2 + Y**2 - r**2
    
    D = (b**2 - a*c)
    if D<0:
        return None, None
    s1 = (-b + sqrt(D)) / a
    s2 = (-b - sqrt(D)) / a
    return (x1 + xd*s1, y1 + yd*s1), (x1 + xd*s2, y1 + yd*s2)

def crosscc(x1,y1,r1,x2,y2,r2):
    k = -2*(x1-x2)
    l = -2*(y1-y2)
    m = x1**2 - x2**2 + y1**2 - y2**2 - r1**2 + r2**2
    if k==0:
        p1 = (0, -m/l)
        p2 = (100, -m/l)
    elif l==0:
        p1 = (-m/k, 0)
        p2 = (-m/k, 100)
    else:
        p1 = (0, -m/l)
        p2 = (1, -(m+k)/l)
    return crosscl(x1,y1,r1,*p1,*p2)

N = int(input())
xy = [None]*N
for i in range(N):
    x,y = map(int, input().split())
    xy[i] = (x,y)
def sub(r):
    kouho = xy[:]
    for i in range(N):
        for j in range(i+1, N):
            p1, p2 = crosscc(xy[i][0], xy[i][1], r, xy[j][0], xy[j][1], r)
            if p1 is not None:
                kouho.append(p1)
                kouho.append(p2)
    ans = False

    for k in kouho:
        for x,y in xy:
            if (k[0]-x)**2 + (k[1]-y)**2 <= (r**2) * (1+eps):
                pass
            else:
                break
        else:
            ans = True
    return ans
lb = 0
ub = 2000
while abs(lb-ub)>10**-8:
    mm = (lb+ub)/2
    if sub(mm):
        ub = mm
    else:
        lb = mm
print(ub)

Solution (Python):
from itertools import combinations

epsilon = 5 * 10 ** (-7)

N = int(input())

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



longest_radius = 0
for p, q in combinations(points, 2):
    radius = abs(p - q) / 2
    if longest_radius < radius:
        longest_radius = radius
        center = (p + q) / 2

out_of_circle = False
for s in points:
    if abs(s - center) > longest_radius + epsilon:
        out_of_circle = True
        break

if not out_of_circle:
    print(longest_radius)
    exit()



smallest_radius = 10 ** 9
for p, q, r in combinations(points, 3):
    denominator = (p-q)*r.conjugate() + (q-r)*p.conjugate() + (r-p)*q.conjugate()
    if denominator == 0 + 0j:
        continue
    numerator = (p-q)*(abs(r)**2) + (q-r)*(abs(p)**2) + (r-p)*(abs(q)**2)
    center = numerator/denominator
    radius = abs(p - center)

    for s in points:
        if abs(s - center) > radius + epsilon:
            break
    else:
        smallest_radius = min(smallest_radius, radius)

print(smallest_radius)

Solution (Python):
from math import hypot

N = int(input())
pts = [tuple(map(int, input().split())) for _ in range(N)]

EPS = 10**-10
def isLE(a, b):
    return not (a > b+EPS)

def getIntersectionLCs_L(a, b, c, xC, yC, r):
    e = a*xC + b*yC + c
    ab2 = a**2 + b**2
    v = r**2 * ab2 - e**2
    if v < 0:
        return []
    elif v == 0:
        xP = xC + -a*e / ab2
        yP = yC + -b*e / ab2
        return [(xP, yP)]
    else:
        v = v**0.5
        xP1 = xC + (-a*e + b*v) / ab2
        yP1 = yC + (-b*e - a*v) / ab2
        xP2 = xC + (-a*e - b*v) / ab2
        yP2 = yC + (-b*e + a*v) / ab2
        return [(xP1, yP1), (xP2, yP2)]
def getIntersectionCCs(x1, y1, r1, x2, y2, r2):
    xC, yC = x2-x1, y2-y1
    c = -(xC**2 + yC**2 + r1**2 - r2**2) / 2
    intCCs = getIntersectionLCs_L(xC, yC, c, 0, 0, r1)
    intCCs = [(x1 + x, y1 + y) for x, y in intCCs]
    return intCCs

def isOK(r):
    for i in range(N):
        x1, y1 = pts[i]
        for j in range(i+1, N):
            x2, y2 = pts[j]
            intCCs = getIntersectionCCs(x1, y1, r, x2, y2, r)
            for xC, yC in intCCs:
                dist = max([hypot(x-xC, y-yC) for x, y in pts])
                if isLE(dist, r):
                    return True
    return False

ng, ok = 0, 2000
while abs(ok-ng) > 10**-12:
    mid = (ng+ok) / 2
    if isOK(mid):
        ok = mid
    else:
        ng = mid

print(ok)

Solution (Python):
import math

epsilon = 5 * 10 ** (-7)

N = int(input())
xys = [tuple(map(int, input().split())) for _ in range(N)]
xs, ys = zip(*xys)

lsd = 0  
for i in range(0, N):
    for j in range(i+1, N):
        sd = (xs[i] - xs[j]) ** 2 + (ys[i] - ys[j]) ** 2 
        if lsd < sd:
            lsd = sd
            farthest_2_points = (i, j)


p, q = farthest_2_points
center_x = (xs[p] + xs[q]) / 2
center_y = (ys[p] + ys[q]) / 2
all_in_circle = True
for i in range(N):
    if (xs[i] - center_x)**2 + (ys[i] - center_y)**2 > lsd / 4 + epsilon:
        all_in_circle = False

if all_in_circle:
    
    print(lsd ** 0.5 / 2)
    exit()


smallest_radius = 10 ** 9
for p in range(0, N):
    for q in range(p+1, N):
        for r in range(q+1, N):
            
            
            pq = ((xs[q] - xs[p])**2 + (ys[q] - ys[p])**2)**0.5
            v1x = xs[p] - xs[r]
            v1y = ys[p] - ys[r]
            v2x = xs[q] - xs[r]
            v2y = ys[q] - ys[r]
            vec1_len = (v1x**2 + v1y**2)**0.5
            vec2_len = (v2x**2 + v2y**2)**0.5
            vecs_dot = v1x*v2x + v1y*v2y
            theta = math.acos(min(1.0, max(-1.0, vecs_dot / (vec1_len * vec2_len))))
            if theta == 0:
                continue
            radius = pq / (2 * math.sin(theta))

            
            det = v1x * v2y - v1y * v2x
            if det == 0:
                continue
            center_x = xs[r] + (   v2y  * vec1_len**2 + (-v1y) * vec2_len**2) / (2 * (det))
            center_y = ys[r] + ( (-v2x) * vec1_len**2 +   v1x  * vec2_len**2) / (2 * (det))
            all_in_circle = True
            for s in range(N):
                if ((xs[s] - center_x)**2 + (ys[s] - center_y)**2)**0.5 > radius + epsilon:
                    all_in_circle = False
            if all_in_circle:
                smallest_radius = min(smallest_radius, radius)
print(smallest_radius)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd, sqrt
from operator import mul
from functools import reduce
from operator import mul
from pprint import pprint



sys.setrecursionlimit(2147483647)
INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
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)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


def f(i, j, k):
    x1, y1 = L[i]
    x2, y2 = L[j]
    x3, y3 = L[k]
    
    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 INF
    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 = sqrt((x1 - x) ** 2 + (y1 - y) ** 2)
    for d in range(n):
        if d in (i, j, k):
            continue
        ax, ay = L[d]
        if (ax - x) ** 2 + (ay - y) ** 2 > r ** 2:
            return INF
    return r



def diametercircle(ax, ay, bx, by):
    X = (ax + bx) / 2
    Y = (ay + by) / 2
    R = sqrt((X - ax) * (X - ax) + (Y - ay) * (Y - ay))
    return X, Y, R


def distance(ax, ay, bx, by):
    return sqrt((ax - bx) ** 2 + (ay - by) ** 2)

n = I()
L = []
for _ in range(n):
    x, y = LI()
    L += [(x, y)]

ans = INF
for i, j, k in combinations(range(n), 3):

    ans = min(ans, f(i, j, k))

for l, m in combinations(range(n), 2):
    lx, ly = L[l]
    mx, my = L[m]
    mid_x = (lx + mx) / 2
    mid_y = (ly + my) / 2
    r_s = (mid_x - lx) ** 2 + (mid_y - ly) ** 2
    for i in range(n):
        if i == l or i == m:
            continue
        zx, zy = L[i]
        if (zx - mid_x) ** 2 + (zy - mid_y) ** 2 > r_s:
            break
    else:
        ans = min(ans, sqrt(r_s))






print(ans)

Solution (Python):
from math import hypot

N = int(input())
pts = [tuple(map(int, input().split())) for _ in range(N)]

def getIntersectionLL(a1, b1, c1, a2, b2, c2):
    v = a1*b2 - a2*b1
    if v == 0:
        return (None, None)
    else:
        return ((b1*c2-b2*c1) / v, (-a1*c2+a2*c1) / v)
def getPerpendicularBisector(x1, y1, x2, y2):
    dx, dy = x2-x1, y2-y1
    xM, yM = (x1+x2)/2, (y1+y2)/2
    return (-dx, -dy, dx*xM+dy*yM)
def getCircumcenter(x1, y1, x2, y2, x3, y3):
    a12, b12, c12 = getPerpendicularBisector(x1, y1, x2, y2)
    a13, b13, c13 = getPerpendicularBisector(x1, y1, x3, y3)
    intLL = getIntersectionLL(a12, b12, c12, a13, b13, c13)
    return intLL

ans = float('inf')
for i in range(N):
    x1, y1 = pts[i]
    for j in range(i+1, N):
        x2, y2 = pts[j]
        xC, yC = (x1+x2)/2, (y1+y2)/2
        dist = max([hypot(x-xC, y-yC) for x, y in pts])
        ans = min(ans, dist)

for i in range(N):
    x1, y1 = pts[i]
    for j in range(i+1, N):
        x2, y2 = pts[j]
        for k in range(j+1, N):
            x3, y3 = pts[k]
            xC, yC = getCircumcenter(x1, y1, x2, y2, x3, y3)
            if xC is None: continue
            dist = max([hypot(x-xC, y-yC) for x, y in pts])
            ans = min(ans, dist)

print(ans)

Solution (Python):
import sys
import math
from itertools import combinations

stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def ns(): return stdin.readline().rstrip()  


def circumcircle(ax, ay, bx, by, cx, cy):
    if (bx - ax) * (cy - ay) - (by - ay) * (cx - ax) == 0:
        return None
    D = 2 * (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by))
    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
    R = math.sqrt((X - ax) * (X - ax) + (Y - ay) * (Y - ay))
    return X, Y, R


def diametercircle(ax, ay, bx, by):
    X = (ax + bx) / 2
    Y = (ay + by) / 2
    R = math.sqrt((X - ax) * (X - ax) + (Y - ay) * (Y - ay))
    return X, Y, R


def distance(ax, ay, bx, by):
    return math.sqrt((ax - bx) ** 2 + (ay - by) ** 2)


N = ni()
XY_array = [na() for _ in range(N)]
ans = 10 ** 10
for p in combinations(range(N), 2):
    ax, ay = XY_array[p[0]]
    bx, by = XY_array[p[1]]
    x, y, r = diametercircle(ax, ay, bx, by)
    for xy in XY_array:
        cx, cy = xy
        rr = distance(x, y, cx, cy)
        if rr > r:
            break
    else:
        ans = min(ans, r)

for p in combinations(range(N), 3):
    ax, ay = XY_array[p[0]]
    bx, by = XY_array[p[1]]
    cx, cy = XY_array[p[2]]
    if circumcircle(ax, ay, bx, by, cx, cy):
        x, y, r = circumcircle(ax, ay, bx, by, cx, cy)
        for xy in XY_array:
            dx, dy = xy
            rr = distance(x, y, dx, dy)
            if rr > r:
                break
        else:
            ans = min(ans, r)


print(ans)

Solution (Python):
from math import sqrt

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

def calc(r): 
    lst = [] 
    for i in range(N - 1):
        x1 = XY[i][0]
        y1 = XY[i][1]
        for j in range(i + 1, N):
            x2 = XY[j][0]
            y2 = XY[j][1]
            diff = sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

            if diff > 2 * r:
                return False
            
            h = sqrt(r ** 2 - (diff / 2) ** 2)
            
            if x1 == x2:
                ny = (y1 + y2) / 2
                lst.append([x1 - h, ny])
                lst.append([x1 + h, ny]) 
            elif y1 == y2:
                nx = (x1 + x2) / 2
                lst.append([nx, y1 - h])
                lst.append([nx, y1 + h])
            else:
                a = (y2 - y1) / (x2 - x1) 

                b = -1 / a

                size = sqrt(1 + b ** 2)

                nx = h / size
                ny = nx * b

                
                xc = (x1 + x2) / 2
                yc = (y1 + y2) / 2

                lst.append([xc + nx, yc + ny])
                lst.append([xc - nx, yc - ny])
    
    
    nr = r + eps
    for x, y in lst: 
        flag = True
        for X, Y in XY:
            tmp = (x - X) ** 2 + (y - Y) ** 2
            if tmp > nr ** 2:
                flag = False
                break
        if flag:
            return True
          
    
l = 0
r = 1000

eps = 10 ** (-9)

for i in range(100):
    mid = (l + r) / 2
    if calc(mid):
        r = mid
    else:
        l = mid

print (r)

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

def calc(r):
  lst=[]
  for i in range(N-1):
    x1=XY[i][0]
    y1=XY[i][1]
    for j in range(i+1,N):
      x2=XY[j][0]
      y2=XY[j][1]
      diff=sqrt((x1-x2)**2+(y1-y2)**2)
      if diff>2*r:
        return False
      
      h=sqrt(r**2-diff**2/4)
      if x1==x2:
        ny=(y1+y2)/2
        lst.append([x1-h,ny])
        lst.append([x1+h,ny])
      elif y1==y2:
        nx=(x1+x2)/2
        lst.append([nx,y1-h])
        lst.append([nx,y1+h])
      else:
        a=(y2-y1)/(x2-x1)
        b=-1/a
        size=sqrt(1+b**2)
        dx=h/size
        dy=dx*b
        nx=(x1+x2)/2
        ny=(y1+y2)/2
        lst.append([nx+dx,ny+dy])
        lst.append([nx-dx,ny-dy])
  nr=r+10**(-9)
  for x,y in lst:
    flag=True
    for X,Y in XY:
      tmp=(x-X)**2+(y-Y)**2
      if tmp>nr**2:
        flag=False
        break
    if flag:
      return True
  return False
l=0
r=1000
for i in range(100):
  mid=(l+r)/2
  if calc(mid):
    r=mid
  else:
    l=mid
print(r)

Solution (Python):
import math

import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit


ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n = int(ipt())
    pts = []

    def cp(i,j,r):
        xi,yi = i
        xj,yj = j
        cx = (xi+xj)/2
        cy = (yi+yj)/2
        vecx = yj-yi
        vecy = xi-xj
        d = math.sqrt(vecx**2+vecy**2)/2
        kt = math.sqrt(vecx**2+vecy**2)
        vecx /= kt
        vecy /= kt
        if d > r:
            return []
        else:
            d2 = math.sqrt(r**2-d**2)
            return [(cx+vecx*d2,cy+vecy*d2),(cx-vecx*d2,cy-vecy*d2)]

    def dist(i,j,r):
        xi,yi = i
        xj,yj = j
        return math.sqrt((xj-xi)**2+(yj-yi)**2) <= r

    for _ in range(n):
        pts.append(tuple(map(int,ipt().split())))

    l = 0
    r = 1000
    while r-l > 10**(-7):
        mid = l+(r-l)/2
        f = False
        for i in pts:
            for j in pts:
                if i == j:
                    continue
                for li in cp(i,j,mid):
                    f = True
                    for k in pts:
                        if k == i or k == j:
                            continue
                        if not dist(li,k,mid):
                             f = False
                    if f:
                        break
                if f:
                    break
            if f:
                break
        if f:
            r = mid
        else:
            l = mid
    print(l)

    return

if __name__ == '__main__':
    main()

Solution (Python):

import sys
INF = float("inf")

import sys
import cmath
import math
INF = float("inf")

EPS = 1e-9


def ctc(p1, r1, p2, r2):
    
    
    
    
    if r2 < r1:
        p1, p2 = p2, p1
        r1, r2 = r2, r1

    d = abs(p1-p2)

    if p1 == p2 and d < EPS:    
        return INF
    elif (d - (r2+r1)) > EPS:   
        return 4
    elif (d - (r2+r1)) > -EPS:  
        return 3
    elif (d-(r2-r1)) > EPS:     
        return 2
    elif (d-(r2-r1)) > -EPS:    
        return 1
    else:                       
        return 0


def inner(p1, c1, p2, c2):
    coeff1 = c1/(c1+c2)
    coeff2 = c2/(c1+c2)
    return p1*coeff1+p2*coeff2


def intersection(p1, r1, p2, r2):
    status = ctc(p1, r1, p2, r2)
    d = abs(p1-p2)
    if not (1 <= status <= 3):
        return []
    elif status == 3:           
        return [inner(p1, r1, p2, r2)]
    elif status == 1:           
        return [p1 + r1*(p1-p2)/d]
    else:                       
        if r1 > r2:
            p1, p2 = p2, p1
            r1, r2 = r2, r1
        d = abs(p1-p2)
        cos = (r1**2+d**2-r2**2)/(2*r1*d)
        angle = math.acos(cos)
        phi = cmath.phase(p2-p1)
        return [
            p1 + cmath.rect(r1, phi+angle),
            p1 + cmath.rect(r1, phi-angle)
        ]


def circle_in(p, o, r1, allow_on_edge=True):
    if allow_on_edge:
        return abs(o-p)-r1 < EPS
    else:
        return abs(o-p)-r1 < -EPS


def solve(N: int, x: "List[int]", y: "List[int]"):
    circles = [xx + 1j*yy for xx, yy in zip(x, y)]
    left = -1
    right = 1500
    while right - left > 1e-7:
        mid = (left + right)/2.0
        
        flag = False
        intsecs = []
        for i in range(N):
            for j in range(i+1, N):
                a = intersection(circles[i], mid, circles[j], mid)
                if len(a) == 0:
                    flag = True
                    break
                intsecs += a
            if flag:
                break
        if flag:
            left = mid
            continue

        
        for p in intsecs:       
            all_in_one = True
            for i in range(N):
                if not circle_in(p, circles[i], mid):
                    all_in_one = False
                    break
            if all_in_one:
                flag = True
                break
        if flag:
            right = mid
        else:
            left = mid
    print(right)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    x = [int()] * (N)  
    y = [int()] * (N)  
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
    solve(N, x, y)


if __name__ == '__main__':
    main()

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

def bai(x):
    return int(x)*2.0

xy=[list(map(bai, input().split())) for _ in range(n)]




if n==2:
    print((((xy[0][0]-xy[1][0])**2 +(xy[0][1]-xy[1][1])**2) **0.5)*0.5*0.5)
    exit()

ans=10**9

def gaishin(a,b,c,d,e,f):
    if (a-c)*(d-f)==(c-e)*(b-d):
        y=(max([b,d,f])-min([b,d,f]))/2.0+min([b,d,f])
        x=(max([a,c,e])-min([a,c,e]))/2.0+min([a,c,e])

        

    else:
        y=1.0*((e-a)*(a**2+b**2-c**2-d**2)-(c-a)*(a**2+b**2-e**2-f**2))/(2.0*(e-a)*(b-d)-2.0*(c-a)*(b-f))
        if e-a!=0:
            x=(2.0*(b-f)*y-a**2-b**2+e**2+f**2)/(2.0*(e-a))
        elif c-a!=0:
            x=(2.0*(b-d)*y-a**2-b**2+c**2+d**2)/(2.0*(c-a))
        else:
            print(a,b,c,d,e,f)
            exit()

    return x,y

xy.sort()

for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(i+2,n):
            

            gx,gy=gaishin(xy[i][0],xy[i][1],xy[j][0],xy[j][1],xy[k][0],xy[k][1])
            d=((1.0*(gx-xy[i][0]))**2+(1.0*(gy-xy[i][1]))**2)
            flag=0
            
            for (x,y) in xy:
                if (x,y) != xy[i] and (x,y) != xy[j] and (x,y) != xy[k]:
                    if ((1.0*(gx-x))**2+(1.0*(gy-y))**2) >d+1:
                        flag=1
                        
                        break
            if flag==0:
                ans=min(ans,d**0.5)
                

print(ans/2)

Solution (Python):
from math import sqrt
def dist(x1, y1, x2, y2):
    return sqrt((x1-x2)**2 + (y1-y2)**2) + 10**(-7)

def max_dist(p, x, y):
    res = 0
    for i in range(len(p)):
        dis = dist(p[i][0], p[i][1], x, y)
        if res < dis:
            res = dis
    return res

def calc(p, x):
    yL, yR = 0, 1000
    while yL + 10**-7 < yR:
        yl, yr = (2*yL + yR)/3, (yL + 2*yR)/3
        ql, qr = max_dist(p, x, yl), max_dist(p, x, yr)
        if ql < qr:
            yR = yr
        else:
            yL = yl
    return qr, yR

def main():
    n = int(input())
    p = [list(map(int, input().split())) for _ in range(n)]
    xL, xR = 0, 1000
    while xL + 10**-7 < xR:
        xl, xr = (2*xL + xR)/3, (xL + 2*xR)/3
        ql, yl = calc(p, xl)
        qr, yr = calc(p, xr)
        if ql < qr:
            xR = xr
        else:
            xL = xl
    print(max_dist(p, xR, yr))

if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
def cross_plots(x1, x2, y1, y2, r):
    dx, dy = x2 - x1, y2 - y1
    d = dx ** 2 + dy ** 2
    t = ((4 * (r ** 2) - d) / (4 * d)) ** 0.5
    nx, ny = -t * dy, t * dx

    return ((x1 + x2) / 2 + nx, (y1 + y2) / 2 + ny),\
           ((x1 + x2) / 2 - nx, (y1 + y2) / 2 - ny)

plots = [tuple(map(int, input().split())) for _ in range(n)]
l, r = 0, 2000
while r - l > 10 ** -7:
    R = (r + l) / 2
    cross = []
    flg = False
    for i in range(n):
        for j in range(i+1, n):
            x1, y1 = plots[i]
            x2, y2 = plots[j]
            dx, dy = x2 - x1, y2 - y1
            if dx ** 2 + dy ** 2 > 4 * (R ** 2):
                flg = True
                break

            p1, p2 = cross_plots(x1, x2, y1, y2, R)
            cross.append(p1)
            cross.append(p2)

    if flg:
        l = R
        continue

    for xc, yc in cross:
        if all((xc - x) ** 2 + (yc - y) ** 2 < R ** 2 + 10e-9 for x, y in plots):
            flg = True
            break

    if flg:
        r = R
    else:
        l = R



print(r)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def distance(x1, y1, x2, y2):
    return math.sqrt((x1-x2)**2 + (y1-y2)**2)

def distance_p(a, b):
    return distance(a[0], a[1], b[0], b[1])

def distance3(p1, p2, p3):
    x1,y1 = p1
    x2,y2 = p2
    x3,y3 = p3

    ax = x2 - x1
    ay = y2 - y1
    bx = x3 - x1
    by = y3 - y1

    r = (ax*bx + ay*by) / (ax*ax + ay*ay)
    pt = (x1 + r*ax, y1 + r*ay, 0)
    return distance_p(pt, p3)

def gaisin(xy):
    a = xy[0][0]
    b = xy[0][1]
    c = xy[1][0]
    d = xy[1][1]
    e = xy[2][0]
    f = xy[2][1]

    t1 = (e-a) * (a**2 + b**2 - c**2 - d**2)
    t2 = (c-a) * (a**2 + b**2 - e**2 - f**2)
    t3 = 2 * (e-a) * (b-d) - 2 * (c-a) * (b-f)
    py = (t1 - t2) / t3
    if c - a != 0:
        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))
    return (px, py)

def main():
    n = I()
    xy = [LI() for _ in range(n)]

    if n == 2:
        return distance_p(xy[0], xy[1]) / 2

    r = inf
    for i in range(n):
        t1 = xy[i]
        for j in range(i+1, n):
            t2 = xy[j]
            p = ((t1[0]+t2[0]) / 2, (t1[1]+t2[1]) / 2)
            tr = max(distance_p(p, xy[l]) for l in range(n))
            if r > tr:
                r = tr
            xf = t1[0] == t2[0]
            yf = t1[1] == t2[1]
            for k in range(j+1, n):
                t3 = xy[k]
                if distance3(t1, t2, t3) < eps:
                    continue
                p = gaisin([t1, t2, t3])
                tr = max(distance_p(p, xy[l]) for l in range(n))
                if r > tr:
                    r = tr

    return r

print(main())

Solution (Python):

from math import hypot

EPS = 10 ** -8


def f(r):
    global n, xy
    cs = []
    for i in range(n):
        for j in range(i + 1, n):
            x0, y0 = xy[i]
            x1, y1 = xy[j]
            d = hypot(x1 - x0, y1 - y0)
            if r - d / 2 < EPS:
                continue
            h = (r ** 2 - (d / 2) ** 2) ** 0.5
            c = [(x0 + x1) / 2, (y0 + y1) / 2]
            cs.append([c[0] + h * (y0 - y1) / d, c[1] + h * (x1 - x0) / d])
            cs.append([c[0] - h * (y0 - y1) / d, c[1] - h * (x1 - x0) / d])
    for cx, cy in cs:
        if all(hypot(x - cx, y - cy) - r < EPS for x, y in xy):
            return True
    return False


n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
ok = 10 ** 9
ng = 0
while abs(ok - ng) > EPS:
    m = (ok + ng) / 2
    if f(m):
        ok = m
    else:
        ng = m
print(ok)

Solution (Python):
import math
from itertools import combinations
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]
def enc(i,j,k):
  a,b = i
  c,d = j
  e,f = k
  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:
    ymax = max(b,d,f)
    ymin = min(b,d,f)
    xmax = max(a,c,e)
    xmin = min(a,c,e)
    (px,py) = ((xmax-xmin)/2,(ymax-ymin)/2)
    r = math.hypot(xmax-xmin,ymax-ymin)/2
  else:
    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)
  return (r,px,py)
def judge(r,px,py):
  ls = [math.hypot(px-x,py-y) for x,y in xy]
  if max(ls) <= r+10**-7:
    return True
  else:
    return False
ans = 10**18
for i,j in combinations(xy,2):
  x1,y1 = i
  x2,y2 = j
  px = (x1+x2)/2
  py = (y1+y2)/2
  r = math.hypot(x1-x2,y1-y2)/2
  if judge(r,px,py):
    ans = min(ans,r)
for i,j,k in combinations(xy,3):
  r,px,py = enc(i,j,k)
  if judge(r,px,py):
    ans = min(ans,r)
print(ans)

Solution (Python):
import math
from itertools import combinations
n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]
def enc(i,j,k):
  a,b = i
  c,d = j
  e,f = k
  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:
    ymax = max(b,d,f)
    ymin = min(b,d,f)
    xmax = max(a,c,e)
    xmin = min(a,c,e)
    (px,py) = ((xmax-xmin)/2,(ymax-ymin)/2)
    r = math.hypot(xmax-xmin,ymax-ymin)/2
  else:
    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)
  return (r,px,py)
def judge(r,px,py):
  ls = [math.hypot(px-x,py-y) for x,y in xy]
  if max(ls) <= r+10**-7:
    return True
  else:
    return False
ans = 10**18
for i,j in combinations(xy,2):
  x1,y1 = i
  x2,y2 = j
  px = (x1+x2)/2
  py = (y1+y2)/2
  r = math.hypot(x1-x2,y1-y2)/2
  if judge(r,px,py):
    ans = min(ans,r)
for i,j,k in combinations(xy,3):
  r,px,py = enc(i,j,k)
  if judge(r,px,py):
    ans = min(ans,r)
print(ans)