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 math

def get_circle_center_and_radius1(x1, y1, x2, y2, x3, y3):
    """
    3点を通る円の中心と半径を取得
    """
    d = 2 * ((y1 - y3) * (x1 - x2) - (y1 - y2) * (x1 - x3))
    if d == 0:
        return (0, 0), 0
    x = ((y1 - y3) * (y1 ** 2 - y2 ** 2 + x1 ** 2 - x2 ** 2) - (y1 - y2) * (y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2)) / d
    y = ((x1 - x3) * (x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2) - (x1 - x2) * (x1 ** 2 - x3 ** 2 + y1 ** 2 - y3 ** 2)) / -d
    r = math.sqrt((x - x1) ** 2 + (y - y1) ** 2)
    return (x, y), r


def get_circle_center_and_radius2(x1, y1, x2, y2):
    x = (x2 + x1) / 2
    y = (y2 + y1) / 2
    r = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** 0.5 / 2
    return (x, y), r


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


ans = 10 ** 9
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            x1 = xs[i]
            y1 = ys[i]
            x2 = xs[j]
            y2 = ys[j]
            x3 = xs[k]
            y3 = ys[k]
            (x, y), r = get_circle_center_and_radius1(x1, y1, x2, y2, x3, y3)
            if r == 0:
                continue
            ok = True
            for l in range(n):
                if l in [i, j, k]:
                    continue
                if (x - xs[l]) ** 2 + (y - ys[l]) ** 2 > r ** 2:
                    ok = False
                    break
            if ok:
                ans = min(ans, r)

for i in range(n - 1):
    for j in range(i + 1, n):
        x1 = xs[i]
        y1 = ys[i]
        x2 = xs[j]
        y2 = ys[j]
        (x, y), r = get_circle_center_and_radius2(x1, y1, x2, y2)
        ok = True
        for l in range(n):
            if l in [i, j]:
                continue
            if (x - xs[l]) ** 2 + (y - ys[l]) ** 2 > r ** 2:
                ok = False
                break
        if ok:
            ans = min(ans, r)

print(ans)

Solution (Python):
from math import sqrt

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


def circleThrough2Points(x1, y1, x2, y2):
    if x1 == x2 and y1 == y2:
        return None, None, None
    px = (x1 + x2) / 2
    py = (y1 + y2) / 2
    r = (px - x1)**2 + (py - y1)**2
    return px, py, r



def circleThrough3Points(x1, y1, x2, y2, x3, y3):
    a, b, c, d, e, f = x1, y1, x2, y2, x3, y3
    a2, b2, c2, d2, e2, f2 = a*a, b*b, c*c, d*d, e*e, f*f

    py_1 = 2*(e-a)*(b-d) - 2*(c-a)*(b-f)
    if py_1 == 0:
        return None, None, None
    py_2 = (e-a)*(a2+b2-c2-d2) - (c-a)*(a2+b2-e2-f2)
    py = py_2 / py_1

    if a != c:
        px = (2*(b-d)*py-a2-b2+c2+d2) / (2*(c-a))
    else:
        px = (2*(b-f)*py-a2-b2+e2+f2) / (2*(e-a))

    r = (px - a)**2 + (py - b)**2
    return px, py, r

ans = float('inf')
for i in range(N):
    x1, y1 = ps[i]
    for j in range(i+1, N):
        x2, y2 = ps[j]
        px, py, r = circleThrough2Points(x1, y1, x2, y2)
        if r is not None:
            if all([(px-x)**2 + (py-y)**2 <= r + THRE for x,y in ps]):
                ans = ans if ans < r else r

        for k in range(j+1, N):
            x3, y3 = ps[k]
            px, py, r = circleThrough3Points(x1, y1, x2, y2, x3, y3)
            if r is not None:
                if all([(px-x)**2 + (py-y)**2 <= r + THRE for x,y in ps]):
                    ans = ans if ans < r else r
print(sqrt(ans))

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

def c(P1, P2, P3):
    x1, y1 = P1; x2, y2 = P2; x3, y3 = P3
    a = 2*(x1 - x2); b = 2*(y1 - y2); p = x1**2 - x2**2 + y1**2 - y2**2
    c = 2*(x1 - x3); d = 2*(y1 - y3); q = x1**2 - x3**2 + y1**2 - y3**2
    det = a*d - b*c
    x = d*p - b*q; y = a*q - c*p
    if det < 0:
        x = -x; y = -y; det = -det
    if det!=0:
      x /= det; y /= det
    r = ((x - x1)**2 + (y - y1)**2)**.5
    return x,y,r
ans=20000
for i in range(N-1):
  for j in range(i+1,N):
    f=0
    x1,y1=A[i][0],A[i][1]
    x2,y2=A[j][0],A[j][1]
    x,y=(x1+x2)/2,(y1+y2)/2
    r=((x1-x)**2+(y1-y)**2)**0.5
    for a,b in A:
      d=((a-x)**2+(b-y)**2)**0.5
      if d>r:
        f=1
        break
    if f==0:
      ans=min(ans,r)


if N>2:
  for i in range(N-2):
    for j in range(i,N-1):
      for k in range(j,N):
        f=0
        x,y,r=c(A[i],A[j],A[k])
        for a,b in A:
          d=((a-x)**2+(b-y)**2)**0.5
          if d>r:
            f=1
            break
        if f==0:
          ans=min(ans,r)
print(ans)

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

def c(P1, P2, P3):
    x1, y1 = P1; x2, y2 = P2; x3, y3 = P3
    a = 2*(x1 - x2); b = 2*(y1 - y2); p = x1**2 - x2**2 + y1**2 - y2**2
    c = 2*(x1 - x3); d = 2*(y1 - y3); q = x1**2 - x3**2 + y1**2 - y3**2
    det = a*d - b*c
    x = d*p - b*q; y = a*q - c*p
    if det < 0:
        x = -x; y = -y; det = -det
    if det!=0:
      x /= det; y /= det
    r = ((x - x1)**2 + (y - y1)**2)**0.5
    return x,y,r
  
ans=(200000)**2
for i in range(N-1):
  for j in range(i+1,N):
    f=0
    x1,y1=A[i][0],A[i][1]
    x2,y2=A[j][0],A[j][1]
    x,y=(x1+x2)/2,(y1+y2)/2
    r=((x1-x)**2+(y1-y)**2)**0.5
    for a,b in A:
      d=((a-x)**2+(b-y)**2)**0.5
      if d>r:
        f=1
        break
    if f==0:
      ans=min(ans,r)
f=0

if N>2:
  for i in range(N-2):
    for j in range(i+1,N-1):
      for k in range(j+1,N):
        f=0
        x,y,r=c(A[i],A[j],A[k])
        for a,b in A:
          d=((a-x)**2+(b-y)**2)**0.5
          if d>r:
            f=1
            break
        if f==0:
          ans=min(ans,r)
print(ans)

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

def c(P1, P2, P3):
    x1, y1 = P1; x2, y2 = P2; x3, y3 = P3
    a = 2*(x1 - x2); b = 2*(y1 - y2); p = x1**2 - x2**2 + y1**2 - y2**2
    c = 2*(x1 - x3); d = 2*(y1 - y3); q = x1**2 - x3**2 + y1**2 - y3**2
    det = a*d - b*c
    x = d*p - b*q; y = a*q - c*p
    if det < 0:
        x = -x; y = -y; det = -det
    if det!=0:
      x /= det; y /= det
    r = ((x - x1)**2 + (y - y1)**2)**0.5
    return x,y,r
  
ans=(200000)**2
for i in range(N-1):
  for j in range(i+1,N):
    f=0
    x1,y1=A[i][0],A[i][1]
    x2,y2=A[j][0],A[j][1]
    x,y=(x1+x2)/2,(y1+y2)/2
    r=((x1-x)**2+(y1-y)**2)**0.5
    for a,b in A:
      d=((a-x)**2+(b-y)**2)**0.5
      if d>r:
        f=1
        break
    if f==0:
      ans=min(ans,r)
f=0

if N>2:
  for i in range(N-2):
    for j in range(i+1,N-1):
      for k in range(j+1,N):
        f=0
        x,y,r=c(A[i],A[j],A[k])
        if r>0:
          for a,b in A:
            d=((a-x)**2+(b-y)**2)**0.5
            if d>r:
              f=1
              break
          if f==0:
            ans=min(ans,r)
print(ans)

Solution (Python):
from itertools import combinations

def dist(ax, ay, bx, by):
    return ((ax - bx)**2 + (ay - by)**2)**0.5

n = int(input())
XY = [tuple(int(x) for x in input().split()) for _ in range(n)]
if n == 2:
    (ax, ay), (bx, by) = XY[0], XY[1]
    print(dist(ax, ay, bx, by) / 2)
    exit()

ans = 0
for (ax, ay), (bx, by), (cx, cy) in combinations(XY, 3):
    a, b, c = sorted([dist(ax, ay, bx, by), dist(bx, by, cx, cy), dist(cx, cy, ax, ay)])
    cosC = (a**2 + b**2 - c**2) / (2 * a * b)
    if cosC < 0:
        ans = max(ans, c / 2)
    else:
        sinC = (1 - cosC**2)**0.5
        ans = max(ans, c / (2 * sinC))
print(ans)

Solution (Python):
import sys,queue,math,copy,itertools,bisect,collections,heapq

def check(x0,y0,p,r):
    for x,y in p:
        if (x-x0)**2 + (y-y0)**2 > r*r + 10 ** (-9):
            return False
    return True


def main():
    eps = 10 ** (-10)
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    dist = lambda x1,y1,x2,y2: math.sqrt((x1-x2)**2 + (y1-y2)**2)
    N = NI()
    p = [LI() for _ in range(N)]

    high = 1000
    low = 0

    while high > low + 10 ** (-8):
        mid = (high + low) / 2

        for (x1,y1),(x2,y2) in itertools.combinations(p,2):
            r = dist(x1,y1,x2,y2) / 2
            if r > mid :
                low = mid
                break

            x0 = (x1+x2) / 2
            y0 = (y1+y2) / 2
            h = math.sqrt(mid**2 - r**2)
            if y1 == y2:
                dx = 0
                dy = h
            else:
                d = -(x1-x2) / (y1-y2)
                v = math.sqrt(1+d*d)
                dx = h / v
                dy = h / v * d
            if check(x0+dx,y0+dy,p,mid) or check(x0-dx,y0-dy,p,mid):
                high = mid
                break
        else:
            low = mid

    print(low)


if __name__ == '__main__':
    main()

Solution (Python):
import math

def get_circle_center_and_radius(x1, y1, x2, y2, x3, y3):
    d = 2 * ((y1 - y3) * (x1 - x2) - (y1 - y2) * (x1 - x3))
    if d == 0:
        x = (x1+x3)/2
        y = (y1+y3)/2
        r2 = (x3-x)**2 + (y3-y)**2
        
        return (x,y), r2

    a = (x3-x2)**2 + (y3-y2)**2
    b = (x1-x2)**2 + (y1-y2)**2
    c = (x3-x1)**2 + (y3-y1)**2
    if a+b<c:
        x = (x3+x1)/2
        y = (y3+y1)/2
        r2 = c/4
    elif b+c<a:
        x = (x3+x2)/2
        y = (y3+y2)/2
        r2 = a/4
    elif c+a<b:
        x = (x1+x2)/2
        y = (y1+y2)/2
        r2 = b/4
    else:
        x = ((y1 - y3) * (y1 ** 2 - y2 ** 2 + x1 ** 2 - x2 ** 2) - (y1 - y2) * (y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2)) / d
        y = ((x1 - x3) * (x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2) - (x1 - x2) * (x1 ** 2 - x3 ** 2 + y1 ** 2 - y3 ** 2)) / -d
        
        r2 = (x - x1) ** 2 + (y - y1) ** 2
    return (x, y), r2

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

    xyl.sort()
    if n == 2:
        x1,y1 = xyl[0]
        x2,y2 = xyl[1]
        r2 = (x1-x2)**2 + (y1-y2)**2
        r = math.sqrt(r2)
        print(r/2)
        exit()

    ans = 10**18
    for i in range(n):
        for j in range(i+1,n):
            for k in range(j+1,n):
                x1,y1 = xyl[i]
                x2,y2 = xyl[j]
                x3,y3 = xyl[k]
                (cx,cy),r2 = get_circle_center_and_radius(x1, y1, x2, y2, x3, y3)
                for x,y in xyl:
                    d2 = (x-cx)**2 + (y-cy)**2
                    if d2 <= r2+10**(-6):
                        pass
                    else:
                        break
                else:
                    ans = min(ans,r2)
                    
    print(math.sqrt(ans))

if __name__ == "__main__":
    main()

Solution (Python):
import sys
read = sys.stdin.buffer.read
readlines = sys.stdin.buffer.readlines
input = sys.stdin.buffer.readline
N = int(input())
X = [tuple(map(int, line.split())) for line in sys.stdin.buffer.readlines()]


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


def check(x, y):
    r = 0
    nx = ny = 0
    for u, v in X:
        z = d(x, y, u, v)
        if z > r:
            r = z
            nx, ny = u, v
    return nx, ny


eps = 10**-8
alpha = 1
x = 500
y = 500
while True:
    nx, ny = check(x, y)
    if d(nx, ny, x, y)**0.5 < eps:
        break
    x, y = x+(nx-x)*alpha, y+(ny-y)*alpha
    alpha *= 0.999
    if alpha < eps:
        break

print(d(*check(x, y), x, y)**0.5)

Solution (Python):
import math
from statistics import mean

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
xs = [x for x, y in xy]
ys = [y for x, y in xy]


def get_circle_center_and_radius(x1, y1, x2, y2, x3, y3):
    """
    3点を通る円の中心と半径を取得
    """
    d = 2 * ((y1 - y3) * (x1 - x2) - (y1 - y2) * (x1 - x3))
    if d == 0:
        x, y, r2 = -1, -1, -1
    else:
        x = ((y1 - y3) * (y1 ** 2 - y2 ** 2 + x1 ** 2 - x2 ** 2) -
             (y1 - y2) * (y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2)) / d
        y = ((x1 - x3) * (x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2) -
             (x1 - x2) * (x1 ** 2 - x3 ** 2 + y1 ** 2 - y3 ** 2)) / -d
        r2 = (x - x1) * (x - x1) + (y - y1) * (y - y1)
    return (x, y), r2


def get_circle_center_and_radius_2p(x1, y1, x2, y2):
    x = (x1 + x2) / 2
    y = (y1 + y2) / 2
    r2 = (x - x1) * (x - x1) + (y - y1) * (y - y1)
    return (x, y), r2


def solve_naive(N, xy):
    if N < 2:
        return 0
    ret = math.inf
    for i in range(N):
        for j in range(N):
            (cx, cy), r2 = get_circle_center_and_radius_2p(
                xy[i][0], xy[i][1], xy[j][0], xy[j][1])
            for x, y in xy:
                if (x - cx) * (x - cx) + (y - cy) * (y - cy) > r2:
                    r2 = math.inf
                    break
            ret = min(ret, r2)
            for k in range(N):
                if i == j or j == k or k == i:
                    continue
                (cx, cy), r2 = get_circle_center_and_radius(
                    xy[i][0], xy[i][1], xy[j][0], xy[j][1], xy[k][0], xy[k][1])
                for x, y in xy:
                    if (x - cx) * (x - cx) + (y - cy) * (y - cy) > r2:
                        r2 = math.inf
                        break
                ret = min(ret, r2)
    return math.sqrt(ret)


ans = solve_naive(N, xy)
print(ans)

Solution (Python):
def dis(x1,y1,x2,y2):
    return ((x1-x2)**2+(y1-y2)**2)**0.5
N = int(input())
xy = []
rmax = 2000
r = 1000
rmin = 0
eps = 10e-10
for i in range(N):
    x,y = map(int,input().split())
    xy.append((x,y))
for i in range(50):
    intersections = []
    for i in range(N):
        xi,yi = xy[i]
        for j in range(N):
           if i < j:
               xj,yj = xy[j]
               xc = (xi+xj)/2
               yc = (yi+yj)/2
               dc = dis(xc,yc,xi,yi)
               if r > dc:
                   d = (r**2-dc**2)**0.5
                   intersections.append((xc+(yc-yi)*d/dc,yc-(xc-xi)*d/dc))
                   intersections.append((xc-(yc-yi)*d/dc,yc+(xc-xi)*d/dc))
    ans = False
    for x,y in intersections:
        for i in range(N):
            xi,yi = xy[i]
            if dis(x,y,xi,yi) > r+eps:
                break
        else:
            ans = True
    if ans:
        rmax = r
    else:
        rmin = r
    r = (rmax+rmin)/2
print(r)

Solution (Python):
import math
from statistics import mean

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
xs = [x for x, y in xy]
ys = [y for x, y in xy]


def get_circle_center_and_radius(x1, y1, x2, y2, x3, y3):
    """
    3点を通る円の中心と半径を取得
    """
    d = 2 * ((y1 - y3) * (x1 - x2) - (y1 - y2) * (x1 - x3))
    if d == 0:
        x, y, r2 = -1, -1, -1
    else:
        x = ((y1 - y3) * (y1 ** 2 - y2 ** 2 + x1 ** 2 - x2 ** 2) -
             (y1 - y2) * (y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2)) / d
        y = ((x1 - x3) * (x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2) -
             (x1 - x2) * (x1 ** 2 - x3 ** 2 + y1 ** 2 - y3 ** 2)) / -d
        r2 = (x - x1) * (x - x1) + (y - y1) * (y - y1)
    return (x, y), r2


def get_circle_center_and_radius_2p(x1, y1, x2, y2):
    x = (x1 + x2) / 2
    y = (y1 + y2) / 2
    r2 = (x - x1) * (x - x1) + (y - y1) * (y - y1)
    return (x, y), r2


def solve_naive(N, xy):
    if N < 2:
        return 0
    ret = math.inf
    for i in range(N):
        for j in range(N):
            (cx, cy), r2 = get_circle_center_and_radius_2p(
                xy[i][0], xy[i][1], xy[j][0], xy[j][1])
            for x, y in xy:
                if (x - cx) * (x - cx) + (y - cy) * (y - cy) > r2:
                    r2 = math.inf
                    break
            ret = min(ret, r2)
            for k in range(N):
                if i == j or j == k or k == i:
                    continue
                (cx, cy), r2 = get_circle_center_and_radius(
                    xy[i][0], xy[i][1], xy[j][0], xy[j][1], xy[k][0], xy[k][1])
                for x, y in xy:
                    if (x - cx) * (x - cx) + (y - cy) * (y - cy) > r2:
                        r2 = math.inf
                        break
                ret = min(ret, r2)
    return math.sqrt(ret)


ans = solve_naive(N, xy)
print(ans)

Solution (Python):
n=int(input())
xy=[list(map(int,input().split())) for _ in range(n)]
sgm=pow(10,-7)
def func(c):
    allp=[]
    for i in range(n-1):
        for j in range(i+1,n):
            xi,yi=xy[i]
            xj,yj=xy[j]
            dx=xi-xj
            dy=yi-yj
            d=((xi-xj)**2+(yi-yj)**2)**0.5
            if c**2-(d/2)**2<0:return False
            h=(c**2-(d/2)**2)**0.5
            mx,my=(xi+xj)/2,(yi+yj)/2
            if dx==0:
                allp.append([mx-h,my])
                allp.append([mx+h,my])
            elif dy==0:
                allp.append([mx,my-h])
                allp.append([mx,my+h])
            else:
                dx,dy=dy,-dx
                dh=(dy**2+dx**2)**0.5
                dx*=h/dh
                dy*=h/dh
                allp.append([mx+dx,my+dy])
                allp.append([mx-dx,my-dy])
    for px,py in allp:
        flg=True
        for x,y in xy:
            if ((px-x)**2+(py-y)**2)**0.5>c+sgm:
                flg=False
                break
        if flg:
            return True
    return False

r=2*max([abs(x) for x,y in xy])+max([abs(y) for x,y in xy])
l,r=0,r
for i in range(400):
    c=(l+r)/2
    if func(c):
        l,r=l,c
    else:
        l,r=c,r
print(c)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def calc_circumcircle(xa, ya, xb, yb, xc, yc):
    """
    3点の外接円の中心と半径を求める（行列式より）
    """

    A2 = xa ** 2 + ya ** 2
    B2 = xb ** 2 + yb ** 2
    C2 = xc ** 2 + yc ** 2

    sx = ((A2 * yb + ya * C2 + B2 * yc) - (yb * C2 + ya * B2 + A2 * yc)) / 2
    sy = ((xa * B2 + A2 * xc + xb * C2) - (B2 * xc + A2 * xb + xa * C2)) / 2
    a = (xa * yb + ya * xc + xb * yc) - (yb * xc + ya * xb + xa * yc)
    b = (xa * yb * C2 + ya * B2 * xc + A2 * xb * yc) - (A2 * yb * xc + ya * xb * C2 + xa * B2 * yc)

    
    if a == 0 or b == 0:
        return None, None, None

    cx, cy = sx / a, sy / a
    r = (b / a + (sx ** 2 + sy ** 2) / a ** 2) ** 0.5
    return cx, cy, r


def main():
    def dist(xf, yf, xs, ys):
        return ((xf - xs) ** 2 + (yf - ys) ** 2) ** 0.5

    N = int(readline())
    EPS = 10 ** (-10)
    ans = INF
    points = []

    for _ in range(N):
        x, y = map(int, readline().split())
        points.append((x, y))

    for i in range(N):
        x1, y1 = points[i]
        for j in range(i + 1, N):
            x2, y2 = points[j]
            xc, yc = (x1 + x2) / 2, (y1 + y2) / 2
            r = dist(x1, y1, x2, y2) / 2
            for k in range(N):
                x3, y3 = points[k]
                d = dist(x3, y3, xc, yc)
                if d > r + EPS:
                    break
            else:
                ans = min(ans, r)

    import math

    for i in range(N):
        x1, y1 = points[i]
        for j in range(i + 1, N):
            x2, y2 = points[j]
            for k in range(j + 1, N):
                x3, y3 = points[k]
                cx, cy, r = calc_circumcircle(x1, y1, x2, y2, x3, y3)
                if cx is None:
                    continue
                for l in range(N):
                    x4, y4 = points[l]
                    d = dist(x4, y4, cx, cy)
                    if d > r + EPS:
                        break
                else:
                    ans = min(ans, r)

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from scipy.optimize import fmin
I=input
n=int(I())
L=[list(map(int,I().split()))for i in range(n)]
def C(t):i,j=t;return max((x-i)**2+(y-j)**2for x,y in L)
x,y=fmin(C,(500,500),disp=0)
print(C((x,y))**.5)

Solution (Python):
import sys
sys.setrecursionlimit(10**7) 
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right

from collections import deque, defaultdict


from collections import Counter

from itertools import accumulate,combinations,permutations,product

from heapq import heapify,heappop,heappush

from functools import reduce,lru_cache

from decimal import Decimal
import cmath
def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def binr(x): return bin(x)[2:]
def bitcount(x): 
    x= x - ((x >> 1) & 0x5555555555555555)
    x= (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)
    x= (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f 
    x+= (x >> 8); x+= (x >> 16); x+= (x >> 32) 
    return x & 0x7f

EPS = 0.000000001


def cIntersectionPnt(z1,r1,z2,r2):
    d = abs(z1-z2)
 
    if d < EPS:
        if abs(r1-r2) < EPS:
            return float("inf"),-1,-1
        else:
            return 0,-1,-1
    
    
    if abs(d - (r1+r2)) < EPS:
        diff = (z2-z1)/d
        return 1,z1+diff*r1,-1
    
    if abs(d - (r1-r2)) < EPS:
        diff = (z2-z1)/d
        return 1,z1+diff*r1,-1
    
    if abs(d - (r2-r1)) < EPS:
        diff = (z1-z2)/d
        return 1,z2+diff*r2,-1
 
    if d > r1+r2:
        return 0,-1,-1
    if d < abs(r1-r2):
        return 0,-1,-1
 
 
    rc = (r1*r1+d*d-r2*r2)/(2*d)
    rs = cmath.sqrt(r1*r1-rc*rc)
    diff = (z2-z1)/d
    return 2,z1+diff*rc+diff*1j*rs,z1+diff*rc+diff*(-1j)*rs

def main():
    mod = 1000000007
    

    N = int(input())
    
    
    
    S = tuple(tuple(map(int, input().split())) for i in range(N)) 
    
    def hantei(R):
        ps=[]
        for (x1,y1),(x2,y2) in combinations(S,2):
            n,p1,p2=cIntersectionPnt(x1+y1*1j,R,x2+y2*1j,R)
            if n<2:
                return False
            ps.append(p1)
            ps.append(p2)
        
        for p in ps:
            x=p.real
            y=p.imag
            tot=0
            for xi,yi in S:
                if (x-xi)**2+(y-yi)**2<=R**2+EPS:
                    tot+=1
            if tot==N:
                return True
        return False


    def bisect_upper(l,r):
        
        
        while r-l>0.0000005:
            mid=(r*0.5+l*0.5)
            if hantei(mid):
                r=mid
            else:
                l=mid
        return r


                    
    print(bisect_upper(0,2000))

if __name__ == "__main__":
    main()

Solution (Python):
def min_disc(points):
    from random import sample
    N = len(points)
    if N == 1:
        return points[0], 0
    points = sample(points, N)
    def cross(a, b):
        return a.real * b.imag - a.imag * b.real
    def norm2(a):
        return a.real * a.real + a.imag * a.imag
    def make_circle_3(a, b, c):
        A, B, C = norm2(b-c), norm2(c-a), norm2(a-b)
        S = cross(b-a, c-a)
        p = (A*(B+C-A)*a + B*(C+A-B)*b + C*(A+B-C)*c) / (4*S*S)
        radius = abs(p-a)
        return p, radius
    def make_circle_2(a, b):
        c = (a+b) / 2
        radius = abs(a-c)
        return c, radius
    def in_circle(point, circle):
        return abs(point-circle[0]) <= circle[1]+1e-7
    p0 = points[0]
    circle = make_circle_2(p0, points[1])
    for i, p_i in enumerate(points[2:], 2):
        if not in_circle(p_i, circle):
            circle = make_circle_2(p0, p_i)
            for j, p_j in enumerate(points[1:i], 1):
                if not in_circle(p_j, circle):
                    circle = make_circle_2(p_i, p_j)
                    for p_k in points[:j]:
                        if not in_circle(p_k, circle):
                            circle = make_circle_3(p_i, p_j, p_k)
    return circle

N = int(input())
XY = []
for _ in range(N):
    x, y = map(int, input().split())
    XY.append(x + y*1j)
center, rad = min_disc(XY)
print(rad)

Solution (Python):
import numpy as np

N = int(input())
x_lis = []
y_lis = []

for i in range(N):
  num_x, num_y = map(int, input().split())
  x_lis.append(num_x)
  y_lis.append(num_y)

def a(X,Y,Z):
  A = np.dot(Y-Z,Y-Z)
  B = np.dot(Z-X,Z-X)
  C = np.dot(X-Y,X-Y)

  T = A*(B+C-A)
  U = B*(C+A-B)
  W = C*(A+B-C)

  if not T+U+W:
    return [10**9,10**9]
  else:
    return (T*X+U*Y+W*Z)/(T+U+W)

r = 10**9
for i in range(len(x_lis)-1):
  for j in range(i+1,len(x_lis)):
    x1 = x_lis[i]
    y1 = y_lis[i]
    x2 = x_lis[j]
    y2 = y_lis[j]
    center_x = (x1+x2)/2
    center_y = (y1+y2)/2
    dist = ((x1-x2)**2+(y1-y2)**2)**0.5/2
    if max([((center_x-i)**2+(center_y-j)**2)**0.5 for i,j in zip(x_lis, y_lis)]) == dist:
      r = min(dist, r)
    
for i in range(len(x_lis)-2):
  for j in range(i+1,len(x_lis)-1):
    for k in range(j+1,len(x_lis)):
      x1 = x_lis[i]
      y1 = y_lis[i]
      x2 = x_lis[j]
      y2 = y_lis[j]
      x3 = x_lis[k]
      y3 = y_lis[k]
      center = a(np.array([x1,y1]), np.array([x2,y2]), np.array([x3,y3]))
      dist = ((center[0]-x1)**2+(center[1]-y1)**2)**0.5
      if max([((center[0]-i)**2+(center[1]-j)**2)**0.5 for i,j in zip(x_lis,y_lis)]) == dist:
        r = min(dist, r)
      
print(r)

Solution (Python):
import math

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

ret = 100000000
def update(px, py):
    global ret
    r = 0
    for p in range(n):
        r = max(r, math.hypot(px - xy[p][0], py - xy[p][1]))
    ret = min(ret, r)

for i in range(n):
    x1 = xy[i][0]
    y1 = xy[i][1]
    for j in range(i + 1, n):
        x2 = xy[j][0]
        y2 = xy[j][1]
        update((x1 + x2) / 2, (y1 + y2) / 2)
        for k in range(j + 1, n):
            x3 = xy[k][0]
            y3 = xy[k][1]

            d = 2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3)
            if d != 0:
                px = ((y1 - y3) * (y1 ** 2 - y2 ** 2 + x1 ** 2 - x2 ** 2) - (y1 - y2) * (y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2)) / d
                py = ((x1 - x3) * (x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2) - (x1 - x2) * (x1 ** 2 - x3 ** 2 + y1 ** 2 - y3 ** 2)) / -d
                update(px, py)

print(ret)

Solution (Python):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter
from operator import mul
import copy


import heapq
sys.setrecursionlimit(10**6)
INF =  float("inf")
import bisect

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

def intersection(x1, y1, x2, y2, R):
    L2 = (x2 - x1)**2 + (y2 - y1)**2

    if 4*R**2 < L2: return [INF, INF, INF, INF]

    p1x = (x1 + x2) / 2.0 - math.sqrt(4.0 * R ** 2 / L2 - 1) * (y2 - y1) / 2.0
    p1y = (y1 + y2) / 2.0 + math.sqrt(4.0 * R ** 2 / L2 - 1) * (x2 - x1) / 2.0
    p2x = (x1 + x2) / 2.0 + math.sqrt(4.0 * R ** 2 / L2 - 1) * (y2 - y1) / 2.0
    p2y = (y1 + y2) / 2.0 - math.sqrt(4.0 * R ** 2 / L2 - 1) * (x2 - x1) / 2.0

    return [p1x, p1y, p2x, p2y]

M = 750
m = 0
R = 375

for l in range(100):
    for i in range(N):
        for j in range(i+1, N):
            pp = intersection(p[i][0], p[i][1], p[j][0], p[j][1], R)
            flag = 1
            if pp[0] == INF:
                flag = 0
                continue
            else:
                for k in range(N):
                    if k != i and k != j:
                        if (pp[0] - p[k][0]) ** 2 + (pp[1] - p[k][1]) **2 > R ** 2:
                            flag = 0
                            break

                if flag == 0:
                    flag = 1
                    for k in range(N):
                        if k != i and k != j:

                            if (pp[2] - p[k][0]) ** 2 + (pp[3] - p[k][1]) ** 2 > R ** 2:
                                flag = 0
                                break

            if flag == 1:
                M = R
                R = (m + R) / 2.0
                break

        if flag == 1:
            break

    if flag == 0:
        m = R
        R = (R + M) / 2.0

    

print(R)

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

n = int(readline())
xy = tuple(map(int,read().split()))



def check(d):
    eps = 1/(10**10)
    points = []
    for c in itertools.combinations(range(n),2):
        x1,y1 = xy[c[0]*2 : c[0]*2+2]
        x2,y2 = xy[c[1]*2 : c[1]*2+2]

        dif = (x1-x2)**2 + (y1-y2)**2
        if(dif > 4*d**2):
            return False

        h = (d**2 - dif/4)**0.5
        xm,ym = (x1+x2)/2, (y1+y2)/2

        dx,dy = (y1-y2), -1*(x1-x2)
        dxy = (dx**2 + dy**2)**0.5

        points.append( (xm + dx*h/dxy, ym + dy*h/dxy)  )
        points.append( (xm - dx*h/dxy, ym - dy*h/dxy)  )

    for xp,yp in points:
        for i in range(n):
            xi,yi = xy[i*2:i*2+2]
            dif = (xp-xi)**2 + (yp-yi)**2
            if(dif > d**2 + eps):
                break
        else:
            return True

    return False

ok = 1000
ng = 0
for _ in range(50):
    mid = (ok+ng)/2
    if(check(mid)):
        ok = mid
    else:
        ng = mid

print(ok)