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):
n=int(input())
xy=[list(map(int,input().split()))for _ in range(n)]
def gaisin(a,b,c,d,e,f):
  if (a-c)*(d-f)==(c-e)*(b-d):return ["ng"]
  aa=a**2
  bb=b**2
  cc=c**2
  dd=d**2
  ee=e**2
  ff=f**2
  py=((e-a)*(aa+bb-cc-dd)-(c-a)*(aa+bb-ee-ff))/(2*((e-a)*(b-d)-(c-a)*(b-f)))
  if a==c:px=(2*(b-f)*py-aa-bb+ee+ff)/(2*(e-a))
  else:px=(2*(b-d)*py-aa-bb+cc+dd)/(2*(c-a))
  return ["ok",px,py]
pxy=[]
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      x1,y1=xy[i]
      x2,y2=xy[j]
      x3,y3=xy[k]
      gai=gaisin(x1,y1,x2,y2,x3,y3)
      if len(gai)==1:continue
      _,px,py=gai
      pxy.append([px,py])
for i in range(n-1):
  for j in range(i+1,n):
    x1,y1=xy[i]
    x2,y2=xy[j]
    px=(x1+x2)/2
    py=(y1+y2)/2
    pxy.append([px,py])
ans=10**10
for px,py in pxy:
  ans=min(ans,max(((px-x)**2+(py-y)**2)**(0.5)for x,y in xy))
print(ans)

Solution (Python):
from math import sqrt
n = int(input())
xy = [[int(i) for i in input().split()] for _ in range(n)]

def d(x, y):
    return sqrt((x[0] - y[0]) ** 2 + (x[1] - y[1])** 2)
    

def nai(x, y, z):
    c,b,a = sorted([d(x, y),d(y, z),d(z, x)])
    co = (b ** 2 + c ** 2 - a ** 2) / (2 * b * c)
    if co < 0:
        return a/2
    si = sqrt(1 - co ** 2)
    return a / si / 2

if n == 2:
    print(d(xy[0],xy[1])/2)
else:
    ans = 0
    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                ans = max(ans, nai(xy[i], xy[j], xy[k]))
    print(ans)

Solution (Python):
import math
import sys
import itertools
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(input())
XY = [[float(x) for x in input().split()] for _ in range(N)]

ans = 1500.
eps = 10. ** -8


def circumcenter(A, B, C):
    ax = A[0]
    ay = A[1]
    bx = B[0]
    by = B[1]
    cx = C[0]
    cy = C[1]
    d = 2 * (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by))

    if d == 0.:
        return None

    ux = ((ax * ax + ay * ay) * (by - cy) + (bx * bx + by * by)
          * (cy - ay) + (cx * cx + cy * cy) * (ay - by)) / d
    uy = ((ax * ax + ay * ay) * (cx - bx) + (bx * bx + by * by)
          * (ax - cx) + (cx * cx + cy * cy) * (bx - ax)) / d
    return (ux, uy)


def check(center_x, center_y, R2):
    ok = True
    for x, y in XY:
        d = (center_x - x) ** 2. + (center_y - y) ** 2.
        if R2 + eps < d:
            ok = False
            break

    return ok



for i, j in itertools.combinations(range(N), 2):
    ax, ay = XY[i]
    bx, by = XY[j]

    center_x = (ax + bx) / 2.
    center_y = (ay + by) / 2.
    R2 = (ax - center_x) ** 2 + (ay - center_y) ** 2
    R = math.sqrt(R2)

    if check(center_x, center_y, R2):
        ans = min(R, ans)



for a, b, c in itertools.combinations(range(N), 3):
    d = circumcenter(XY[a], XY[b], XY[c])

    if d is None:
        continue

    center_x = d[0]
    center_y = d[1]

    ax = XY[a][0]
    ay = XY[a][1]
    R2 = (ax - center_x) ** 2. + (ay - center_y) ** 2.
    R = math.sqrt(R2)

    ok = check(center_x, center_y, R2)

    if check(center_x, center_y, R2):
        ans = min(ans, R)

print(ans)

Solution (Python):
import numpy as np

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

def circle(x, y, z):

    ra = np.array(x)
    rb = np.array(y)
    rc = np.array(z)

    A = np.dot(rb-rc,rb-rc)
    B = np.dot(rc-ra,rc-ra)
    C = np.dot(ra-rb,ra-rb)

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

    rcc = (T*ra + U*rb + W*rc)/(T + U + W)

    return rcc

def dis(a, b, c, d):
    return (a - b)**2 + (c - d)**2

e = 10 ** (-9)
ans = 10 ** 18
for i in range(n):
    for j in range(i+1, n):
        a = x[i]
        b = x[j]
        px, py = (a[0]+b[0])/2, (a[1]+b[1])/2
        r = dis(px, a[0], py, a[1])
        ok = True
        for s, t in x:
            if dis(px, s, py, t) > r + e:
                ok = False
                break
        if ok:
            ans = min(ans, r)

if ans != 10 ** 18:
    print(ans ** (1/2))
    exit()

for i in range(n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            a = x[i]
            b = x[j]
            c = x[k]
            px, py = circle(a, b, c)
            r = dis(px, a[0], py, a[1])
            ok = True
            for s, t in x:
                if dis(px, s, py, t) > r + e:
                    ok = False
                    break
            if ok:
                ans = min(ans, r)

print(ans ** (1/2))

Solution (Python):
import numpy as np
import sys, math

def circle3p(ps):
    A = []
    B = []
    for x, y in ps:
        
        Ai = [x, y, 1]
        A.append(Ai)
        B.append(- x * x - y * y)
    try:
        x = np.linalg.solve(A, B)
        return x[0], x[1], x[2]
    except np.linalg.LinAlgError:
        return None

def circle2p(ps):
    xy0, xy1 = ps
    return [(xy0[0] + xy1[0]) / 2., (xy0[1] + xy1[1]) / 2., ((xy0[0] - xy1[0]) ** 2 + (xy0[1] - xy1[1]) ** 2) / 4.]

eps = 1e-7

def main():
    N = int(sys.stdin.readline())
    ps = []
    for i in range(N):
        x, y = map(int, sys.stdin.readline().split())
        ps.append((x, y))

    n = len(ps)
    ok = False
    res = int(1e9)

    if n == 2:
        x0, y0 = ps[0]
        x1, y1 = ps[1]
        print('%.9f' % (math.sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2) / 2.))
        return

    for i in range(n):
        for j in range(i + 1, n):
            for k in range(j + 1, n):
                circle = circle3p([ps[i], ps[j], ps[k]])
                if circle is None:
                    continue
                a, b, c = circle
                for l in range(n):
                    if l in {i, j, k}:
                        continue
                    x, y = ps[l]
                    if x * x + y * y + a * x + b * y + c > eps:
                        break
                else:
                    res = min(res, a * a / 4 + b * b / 4 - c)

    for i in range(n):
        for j in range(i + 1, n):
            circle = circle2p([ps[i], ps[j]])
            if circle is None:
                continue
            a, b, c = circle
            for l in range(n):
                if l in {i, j}:
                    continue
                x, y = ps[l]
                if (x - a) ** 2 + (y - b) ** 2 > c + eps:
                    break
            else:
                res = min(res, c)

    print('%.9f' % float(math.sqrt(float(res))))


if __name__ == '__main__':
    main()

Solution (Python):
import math
import itertools

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

if N == 2:
  x1,y1 = l[0]
  x2,y2 = l[1]
  print( 0.5 * math.hypot(x1-x2,y1-y2))
  
else:
  ans = float("INF")
  l_ = itertools.combinations(l,3)
  for points in l_:
    a,b = points[0]
    c,d = points[1]
    e,f = points[2]
    
    if (e-a)*(b-d) == (c-a)*(b-f):
      continue
    else:
      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 = math.hypot(px - a, py - b) + 10**(-7)
    flag = 1
    for point in l:
      if flag:
        s,t = point
        if math.hypot(px - s, py - t) > r:
          flag = 0
    if flag:
      ans = min(r,ans)
      
  l_ = itertools.combinations(l,2)
  for points in l_:
    a,b = points[0]
    c,d = points[1]
    
    
    px,py = (a+c)/2,(b+d)/2

    r = math.hypot(px - a, py - b) + 10**(-7)
    flag = 1
    for point in l:
      if flag:
        s,t = point
        if math.hypot(px - s, py - t) > r:
          flag = 0
    if flag:
      ans = min(r,ans)
    
  print(ans)

Solution (Python):

from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    def f2(x,y):
        return max([(x-px)**2+(y-py)**2 for (px,py) in p])

    def minf2(x):
        l = 0
        r = 1000
        while r-l > 1e-6:
            c1 = (2*l+r)/3
            c2 = (l+2*r)/3
            if f2(x,c1) < f2(x,c2):
                r = c2
            else:
                l = c1
        return f2(x,l)

    n = I()
    p = LIR(n)
    l = 0
    r = 1000
    while r-l > 1e-6:
        c1 = (2*l+r)/3
        c2 = (l+2*r)/3
        if minf2(c1) < minf2(c2):
            r = c2
        else:
            l = c1
    print(minf2(l)**0.5)

    """
    ans = float("inf")
    for i in range(n):
        x,y = p[i]
        q = [(p[j],(x-p[j][0])**2+(y-p[j][1])**2) for j in range(n) if j != i]
        q.sort(key = lambda x:-x[1])
        rx,ry = q[0][0]
        r2 = q[0][1]/4
        mx,my = (x+rx)/2,(y+ry)/2
        for P,D in q:
            s,t = P
            d2 = (s-mx)**2+(t-my)**2
            if d2 > r2+1e-6:
                break
        else:
            r = r2**0.5
            if r < ans:
                ans = r
    for i in range(n):
        ax,ay = p[i]
        for j in range(i):
            bx,by = p[j]
            sb,tb = ax-bx,ay-by
            mbx,mby = (ax+bx)/2,(ay+by)/2
            for k in range(j):
                cx,cy = p[k]
                l = -100000000
                r = 100000000
                while r-l > 1e-6:
                    m = (l+r)/2
                    mx,my = mbx-tb*m,mby+sb*m
                    d1 = (ax-mx)**2+(ay-my)**2
                    d2 = (cx-mx)**2+(cy-my)**2
                    if d1 < d2:
                        l = m
                    else:
                        r = m
                if r == 100000000:
                    l = -100000000
                    r = 100000000
                    while r-l > 1e-6:
                        m = (l+r)/2
                        mx,my = mbx-tb*m,mby+sb*m
                        d1 = (ax-mx)**2+(ay-my)**2
                        d2 = (cx-mx)**2+(cy-my)**2
                        if d1 < d2:
                            r = m
                        else:
                            l = m
                mx,my = mbx-tb*m,mby+sb*m
                r2 = (ax-mx)**2+(ay-my)**2
                for l in range(n):
                    if l in (i,j,k):
                        continue
                    s,t = p[l]
                    d2 = (s-mx)**2+(t-my)**2
                    if d2 > r2+1e-6:
                        break
                else:
                    r = r2**0.5
                    if r < ans:
                        ans = r

    print(ans)
    """
    return


if __name__ == "__main__":
    solve()

Solution (Python):
def main():
    import sys
    from math import sqrt, hypot
    input = sys.stdin.readline

    def dist(p1, p2):
        x1, y1 = p1
        x2, y2 = p2
        return hypot(x2-x1, y2-y1)

    def CP(x1, y1, r1, x2, y2, r2):
        rr0 = (x2 - x1) ** 2 + (y2 - y1) ** 2
        xd = x2 - x1
        yd = y2 - y1
        rr1 = r1 ** 2
        rr2 = r2 ** 2
        cv = (rr0 + rr1 - rr2)
        sv = sqrt(4 * rr0 * rr1 - cv ** 2)
        return (
            (x1 + (cv * xd - sv * yd) / (2. * rr0), y1 + (cv * yd + sv * xd) / (2. * rr0)),
            (x1 + (cv * xd + sv * yd) / (2. * rr0), y1 + (cv * yd - sv * xd) / (2. * rr0)),
        )

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

    dmax = 0
    for i in range(N):
        for j in range(i+1, N):
            dmax = max(dmax, dist(P[i], P[j]))

    eps = 10**-8
    ok = 1000.
    ng = dmax / 2
    mid = (ok+ng)/2
    while ok - ng > 10**-7:
        cp_list = []
        for i in range(N-1):
            x1, y1 = P[i]
            for j in range(i+1, N):
                x2, y2 = P[j]
                cp1, cp2 = CP(x1, y1, mid, x2, y2, mid)
                cp_list.append(cp1)
                cp_list.append(cp2)
        flg = 0
        for p0 in cp_list:
            tmp = 1
            for p in P:
                if dist(p0, p) > mid + eps:
                    tmp = 0
            if tmp:
                flg = 1
                break
        if flg:
            ok = mid
        else:
            ng = mid
        mid = (ok+ng)/2
    print(ok)


if __name__ == '__main__':
    main()

Solution (Python):
n=int(input())
x=[0]*n
y=[0]*n
for i in range(n):
  x[i],y[i]=map(int,input().split())
if n==2:
  print(((x[0]-x[1])**2+(y[0]-y[1])**2)**(1/2)/2)
else:
  ans=10**5
  for i in range(n-1):
    for j in range(i+1,n):
      xc=(x[i]+x[j])/2
      yc=(y[i]+y[j])/2
      r=((x[i]-xc)**2+(y[i]-yc)**2)**(1/2)
      rr=max(r*1.000000999,r+0.000000999)
      aa=0
      for l in range(n):
        if ((x[l]-xc)**2+(y[l]-yc)**2)**(1/2)>rr:
          aa=1
      if aa==0:
        if r<ans:
          ans=r
  A=[0]*3
  B=[0]*3
  for i in range(n-2):
    for j in range(i+1,n-1):
      A[0]=x[j]-x[i]
      A[1]=y[j]-y[i]
      A[2]=A[0]*(x[i]+x[j])/2+A[1]*(y[i]+y[j])/2
      for k in range(j+1,n):
        B[0]=x[k]-x[i]
        B[1]=y[k]-y[i]
        B[2]=B[0]*(x[i]+x[k])/2+B[1]*(y[i]+y[k])/2
        
        if A[0]*B[1]==A[1]*B[0] and A[0]*B[1]!=0:
          r=((max(x[i],x[j],x[k])-min(x[i],x[j],x[k]))**2+(max(y[i],y[j],y[k])-min(y[i],y[j],y[k]))**2)**(1/2)/2
          xc=(max(x[i],x[j],x[k])+min(x[i],x[j],x[k]))/2
          yc=(max(y[i],y[j],y[k])+min(y[i],y[j],y[k]))/2
        elif A[0]==B[0]==0:
          r=(max(y[i],y[j],y[k])-min(y[i],y[j],y[k]))/2
          xc=x[i]
          yc=(max(y[i],y[j],y[k])+min(y[i],y[j],y[k]))/2
        elif A[1]==B[1]==0:
          r=(max(x[i],x[j],x[k])-min(x[i],x[j],x[k]))/2
          yc=y[i]
          xc=(max(x[i],x[j],x[k])+min(x[i],x[j],x[k]))/2
        else:
          xc=(A[2]*B[1]-A[1]*B[2])/(A[0]*B[1]-A[1]*B[0])
          yc=(A[0]*B[2]-A[2]*B[0])/(A[0]*B[1]-A[1]*B[0])
          r=((x[i]-xc)**2+(y[i]-yc)**2)**(1/2)
        aa=0
        rr=max(r*1.000000999,r+0.000000999)
        for l in range(n):
          if ((x[l]-xc)**2+(y[l]-yc)**2)**(1/2)>rr:
            aa=1
        if aa==0:
          if r<ans:
            ans=r
  print(ans)

Solution (Python):
from itertools import combinations as comb

N = int(input())
l = [tuple(map(int, input().split())) for _ in range(N)]
dist = lambda a,b:((a[0]-b[0])**2+(a[1]-b[1])**2)**0.5


def get_centers():
    ans = []
    for a, b, c in comb(l, 3):
        x1, y1 = a
        x2, y2 = b
        x3, y3 = c

        A = 2 * (x2-x1)
        B = 2 * (y2-y1)
        D = 2 * (x3-x2)
        E = 2 * (y3-y2)
        C = x1**2-x2**2+y1**2-y2**2
        F = x2**2-x3**2+y2**2-y3**2

        if B*D-A*E!=0:
            cy = (A*F-C*D)/(B*D-A*E)
            cx = -(F+E*cy)/D if D else -(C+B*cy)/A
            r = dist(a, (cx,cy))
            ans.append((cx, cy, r))

    for a, b in comb(l, 2):
        d = min(a,b)
        e = max(a,b)
        ans.append(((d[0]+e[0])/2, (d[1]+e[1])/2, dist(d,e)/2))

    return ans

if N==2:
    d = l[0]
    e = l[1]
    print(dist(d, e)/2)
else:
    ans = 10**12
    for xr, yr, r in get_centers():
        v = 0
        for x, y in l:
            v += dist((x,y),(xr,yr))<=r
        if v==N:
            ans = min(ans, r)
    print(ans)

Solution (Python):
from itertools import combinations as comb

N = int(input())
l = [tuple(map(int, input().split())) for _ in range(N)]
dist = lambda a,b:((a[0]-b[0])**2+(a[1]-b[1])**2)**0.5


def get_centers():
    ans = []
    for a, b, c in comb(l, 3):
        x1, y1 = a
        x2, y2 = b
        x3, y3 = c

        A = 2 * (x2-x1)
        B = 2 * (y2-y1)
        D = 2 * (x3-x2)
        E = 2 * (y3-y2)
        C = x1**2-x2**2+y1**2-y2**2
        F = x2**2-x3**2+y2**2-y3**2

        if B*D-A*E!=0:
            cy = (A*F-C*D)/(B*D-A*E)
            cx = -(F+E*cy)/D if D else -(C+B*cy)/A
            r = dist(a, (cx,cy))
            ans.append((cx, cy, r))

    for a, b in comb(l, 2):
        d = min(a,b)
        e = max(a,b)
        ans.append(((d[0]+e[0])/2, (d[1]+e[1])/2, dist(d,e)/2))

    return ans

if N==2:
    d = l[0]
    e = l[1]
    print(dist(d, e)/2)
else:
    ans = 10**12
    for xr, yr, r in get_centers():
        v = 0
        for x, y in l:
            v += dist((x,y),(xr,yr))<=r
        if v==N:
            ans = min(ans, r)
    print(ans)

Solution (Python):
import sys
input = sys.stdin.buffer.readline
from itertools import combinations
from math import hypot
n=int(input())
P=[tuple(map(int,input().split())) for _ in range(n)]
ans=1e9
for p1,p2 in combinations(P,2):
	X,Y=(p1[0]+p2[0])/2,(p1[1]+p2[1])/2
	r=0
	for x,y in P:
		t=hypot(X-x,Y-y)
		if r<t:r=t
	if ans>r:ans=r
if n>2:
	ans_=1e9
	for p1,p2,p3 in combinations(P,3):
		a=hypot(p2[0]-p3[0],p2[1]-p3[1])
		b=hypot(p3[0]-p1[0],p3[1]-p1[1])
		c=hypot(p1[0]-p2[0],p1[1]-p2[1])
		if (a+b+c)-2*max(a,b,c)<1e-8:continue
		s,t,u=(-a*a+b*b+c*c)*a*a,(a*a-b*b+c*c)*b*b,(a*a+b*b-c*c)*c*c
		X=(s*p1[0]+t*p2[0]+u*p3[0])/(s+t+u)
		Y=(s*p1[1]+t*p2[1]+u*p3[1])/(s+t+u)
		r=0
		for x,y in P:
			t=hypot(X-x,Y-y)
			if r<t:r=t
		if ans_>r:ans_=r
	
	ans=min(ans,ans_)
print(ans)

Solution (Python):
import sys
from math import sqrt
input = sys.stdin.readline
N = int(input())
ps = [tuple(map(int, input().split())) for _ in range(N)]
rang = 0
for t in ps:
  rang = max(rang, abs(t[0]), abs(t[1]))
def calc(x, y):
  res = 0
  for t in ps:
    u, v = t
    res = max(res, sqrt((x - u) ** 2 + (y - v) ** 2))
  return res

x0 = -1000
x3 = 1000
x1 = (x0 * 2 + x3) / 3
x2 = (x0 + x3 * 2) / 3
res = float("inf")
xl = 0
yl = 0
for i in range(0, rang * 2 + 1, 10):
  u = i - rang
  for j in range(0, rang * 2 + 1, 10):
    v = j - rang
    if calc(xl, yl) > calc(u, v):
      xl = u
      yl = v
x0 = xl - 10
x3 = xl + 10
while x3 - x0 > 0.1 ** 12:
  x1 = (x0 * 2 + x3) / 3
  x2 = (x0 + x3 * 2) / 3

  cc1 = 0
  cc2 = 0

  y0 = yl - 10
  y3 = yl + 10
  y1 = (y0 * 2 + y3) / 3
  y2 = (y0 + y3 * 2) / 3

  while y3 - y0 > 0.1 ** 12:
    y1 = (y0 * 2 + y3) / 3
    y2 = (y0 + y3 * 2) / 3
    c1 = calc(x1, y1)
    c2 = calc(x1, y2)
    if c1 < c2: y3 = y2
    else: y0 = y1

  cy1 = y1 + 0

  y0 = yl - 10
  y3 = yl + 10
  y1 = (y0 * 2 + y3) / 3
  y2 = (y0 + y3 * 2) / 3

  while y3 - y0 > 0.1 ** 12:
    y1 = (y0 * 2 + y3) / 3
    y2 = (y0 + y3 * 2) / 3
    c1 = calc(x2, y1)
    c2 = calc(x2, y2)
    if c1 < c2: y3 = y2
    else: y0 = y1

  cy2 = y1 + 0

  cc1 = calc(x1, cy1)
  cc2 = calc(x2, cy2)
  if cc1 < cc2: x3 = x2
  else: x0 = x1
  res = min(cc1, cc2)

print(res)

Solution (Python):
from math import sqrt
import itertools

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

def minR(x1, y1, x2, y2, x3, y3):
    """
    3点(x1, y1), (x2, y2), (x3, y3)を通る円の半径を返す
    """
    
    if (x3 - x1) * (y2 - y1) == (y3 - y1) * (x2 - x1):
        C = [(x1, y1), (x2, y2), (x3, y3)]
        C.sort()
        m = (C[0][0] + C[2][0]) / 2
        n = (C[0][1] + C[2][1]) / 2
        return m, n, sqrt((m - C[0][0]) ** 2 + (n - C[0][1]) ** 2)
    else:
        
        m12 = (x1 + x2) / 2
        n12 = (y1 + y2) / 2
        m13 = (x1 + x3) / 2
        n13 = (y1 + y3) / 2
        m23 = (x2 + x3) / 2
        n23 = (y2 + y3) / 2

        if y1 == y2:
            x0 = m12
            y0 = n13 - (x3 - x1) * (x0 - m13) / (y3 - y1)
        elif y1 == y3:
            x0 = m13
            y0 = n12 - (x2 - x1) * (x0 - m12) / (y2 - y1)
        elif y2 == y3:
            x0 = m23
            y0 = n12 - (x2 - x1) * (x0 - m12) / (y2 - y1)
        else:
            r12 = (x2 - x1) / (y2 - y1)
            r13 = (x3 - x1) / (y3 - y1)
            x0 = (n12 - n13 + m12 * r12 - m13 * r13) / (r12 - r13)
            y0 = n12 - (x2 - x1) * (x0 - m12) / (y2 - y1)

        return x0, y0, sqrt((x0 - x1) ** 2 + (y0 - y1) ** 2)


if N == 2:
    m = 0
    n = 0
    x = 0
    y = 0
    for c in coordinate:
        x = c[0]
        y = c[1]
        m += c[0] / 2
        n += c[1] / 2
    print(sqrt((x - m) ** 2 + (y - n) ** 2))
else:
    ans = float("inf")
    L = [i for i in range(N)]
    for pair in list(itertools.combinations(L, 3)):
        x1, y1 = coordinate[pair[0]]
        x2, y2 = coordinate[pair[1]]
        x3, y3 = coordinate[pair[2]]

        m12 = (x1 + x2) / 2
        n12 = (y1 + y2) / 2
        m13 = (x1 + x3) / 2
        n13 = (y1 + y3) / 2
        m23 = (x2 + x3) / 2
        n23 = (y2 + y3) / 2

        x0, y0, r = minR(x1, y1, x2, y2, x3, y3)
        
        x12, y12, r12 = m12, n12, sqrt((x1 - m12) ** 2 + (y1 - n12) ** 2)
        x13, y13, r13 = m13, n13, sqrt((x1 - m13) ** 2 + (y1 - n13) ** 2)
        x23, y23, r23 = m23, n23, sqrt((x2 - m23) ** 2 + (y2 - n23) ** 2)

        
        for x, y in coordinate:
            r = max(r, sqrt((x - x0) ** 2 + (y - y0) ** 2))
            r12 = max(r12, sqrt((x - x12) ** 2 + (y - y12) ** 2))
            r13 = max(r13, sqrt((x - x13) ** 2 + (y - y13) ** 2))
            r23 = max(r23, sqrt((x - x23) ** 2 + (y - y23) ** 2))

        ans = min(ans, r, r12, r13, r23)

    print(ans)

Solution (Python):





n = int(input())
l = []
for i in range(n):
    x,y = [int(j) for j in input().split()]
    l.append((x,y))
    

def loss(x,y):
    maxi = 0
    for i,j in l:
        maxi = max(maxi, (i-x)**2 + (j-y)**2)
    return maxi

def f(x):
    
    left = 0
    right = 1000
    num = 100

    for i in range(num):
        c1 = (2*left + right)/3
        c2 = (left + 2*right)/3    
        if(loss(x,c1)<loss(x,c2)):
            right = c2
        else:
            left = c1
            
    return loss(x,left)

        
    

left = 0
right = 1000
num = 100

for i in range(num):
    c1 = (2*left + right)/3
    c2 = (left + 2*right)/3    
    if(f(c1)<f(c2)):
        right = c2
    else:
        left = c1
        
ans = f(left)**0.5
print(ans)

Solution (Python):



from scipy.optimize import fmin

n = int(input())
l = []
for i in range(n):
    x,y = [int(j) for j in input().split()]
    l.append((x,y))
    

def f(s):
    x,y = s
    maxi = 0
    for i,j in l:
        maxi = max(maxi, (i-x)**2 + (j-y)**2)
    return maxi

x,y = fmin(f, [100,100], xtol=10**-9, disp=0)
ans = f((x,y)) ** 0.5
print(ans)

Solution (Python):
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

import math
def dist(xx,yy,u,v):
    return math.sqrt((xx-u)**2+(yy-v)**2)

def do2(x1,y1,x2,y2):
    return ((x1+x2)/2, (y1+y2)/2, dist(x1,y1,x2,y2)/2)

def do3(x1,y1,x2,y2,x3,y3):
    p = (x2-x1)*(y3-y1)-(x3-x1)*(y2-y1)
    if p==0:
        return (0,0,-1)
    x1s = x1**2
    y1s = y1**2
    x2s = x2**2
    y2s = y2**2
    x3s = x3**2
    y3s = y3**2
    u = ((x2s+y2s-x1s-y1s)*(y3-y1)-(x3s+y3s-x1s-y1s)*(y2-y1))/(2*p)
    v = -((x2s+y2s-x1s-y1s)*(x3-x1)-(x3s+y3s-x1s-y1s)*(x2-x1))/(2*p)
    r = dist(u,v,x1,y1)
    
    return (u,v,r)

eps = 10**(-13)
def fit(u,v,r):
    for i in range(n):
        if dist(x[i],y[i],u,v)>r+eps:
            return False
    return True

n = inn()
x = []
y = []
for i in range(n):
    xx,yy = inm()
    x.append(xx)
    y.append(yy)
mn = 2000.0
for i in range(n-1):
    for j in range(i+1,n):
        u,v,r = do2(x[i],y[i],x[j],y[j])
        if r>0 and fit(u,v,r):
            mn = min(mn,r)
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            u,v,r = do3(x[i],y[i],x[j],y[j],x[k],y[k])
            if r>0 and fit(u,v,r):
                mn = min(mn,r)
print(mn)

Solution (Python):
import sys
import itertools
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
XY = [lr() for _ in range(N)]
XY = [x + y * 1j for x, y in XY]

cen_cand = [] 
'''
z = (ab(a-b).conjugete()) / (a.conjugate()*b-a*b.conjugate())
'''
def find_center(a, b, c):
    
    a -= c; b -= c
    if abs((a * b.conjugate()).imag) < 0.5:
        
        return None
    num = a * b * (a-b).conjugate()
    den = a.conjugate() * b
    den -= den.conjugate()
    return (num / den) + c

for comb in itertools.combinations(XY, 3):
    o = find_center(*comb)
    if o is None:
        continue
    cen_cand.append(o)

for a, b in itertools.combinations(XY, 2):
    o = (a+b) / 2
    cen_cand.append(o)

cen_cand = np.array(cen_cand); XY = np.array(XY)
answer = np.abs(cen_cand[:, None] - XY[None, :]).max(axis=1).min()
print(answer)

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

def f(x, y):
    r = 0
    for xi, yi in XY:
        d = ((x - xi)**2 + (y - yi)**2)**0.5
        if d > r:
            r = d
    return r

def g(x):
    l, r = 0, 1000
    for _ in range(75):
        c1, c2 = (2 * l + r) / 3, (l + 2 * r) / 3
        if f(x, c1) > f(x, c2):
            l = c1
        else:
            r = c2
    return f(x, l)

l, r = 0, 1000
for _ in range(75):
    c1, c2 = (2 * l + r) / 3, (l + 2 * r) / 3
    if g(c1) > g(c2):
        l = c1
    else:
        r = c2

print(g(l))

Solution (Python):
Point = complex


N, *XY = map(int, open(0).read().split())

P = [Point(x, y) for x, y in zip(*[iter(XY)] * 2)]

def max_distance(center):
    return max(abs(center - p) for p in P)

def ternary_search(f, left, right, MAX_ITER=100):
    for _ in range(MAX_ITER):
        m1 = (left * 2 + right) / 3
        m2 = (left + right * 2) / 3
        if f(m1) < f(m2):
            right = m2
        else:
            left = m1
    return f(left)

def g(x):
    return ternary_search(lambda y: max_distance(Point(x, y)), -1000, 1000)

print(ternary_search(g, -1000, 1000))

Solution (Python):
Point = complex


N, *XY = map(int, open(0).read().split())

P = [Point(x, y) for x, y in zip(*[iter(XY)] * 2)]

def max_distance(center):
    return max(abs(center - p) for p in P)

def g(x):
    left, right = -1000, 1000
    for _ in range(100):
        m1 = (left * 2 + right) / 3
        m2 = (left + right * 2) / 3
        if max_distance(Point(x, m1)) < max_distance(Point(x, m2)):
            right = m2
        else:
            left = m1

    return max_distance(Point(x, left))

left, right = -1000, 1000
for _ in range(100):
    m1 = (left * 2 + right) / 3
    m2 = (left + right * 2) / 3
    if g(m1) < g(m2):
        right = m2
    else:
        left = m1

print(g(left))

Solution (Python):
def calc_intersection(z1, z2, R):
  d2 = (z1[0]-z2[0])**2 + (z1[1]-z2[1])**2
  d = d2 ** 0.5
  if R < d/2:
    return None
  else:
    m = [(z1[0]+z2[0])*0.5, (z1[1]+z2[1])*0.5]
    l = (R**2/d2 - 0.25)**0.5
    v = [l*(z2[1]-z1[1]), l*(z1[0]-z2[0])]
    return [[m[0]+v[0], m[1]+v[1]], [m[0]-v[0], m[1]-v[1]]]


def check(R):
  intersections = []
  for i in range(N):
    for j in range(i+1, N):
      points = calc_intersection(xy[i], xy[j], R)
      if points is None:
        return False
      else:
        intersections.extend(points)
  
  for px, py in intersections:
    res = True
    for x, y in xy:
      res *= ((x-px)**2 + (y-py)**2 <= R**2+0.000001)
      if not res:
        break
    if res:
      return True
  return False


N = int(input())
xy = [list(map(int, input().split())) for i in range(N)]
left = 0 
right = 500 * 2**0.5 
while right - left > 0.000001:
  mid = (left + right) / 2
  if check(mid):
    right = mid
  else:
    left = mid

print(right)

Solution (Python):
from scipy.optimize import fmin
l=[list(map(int, input().split()))for i in range(int(input()))]
def g(s):
    a,b=s
    d=0
    for i,j in l:
        d=max(d,(i-a)**2+(j-b)**2)
    return d
x,y=fmin(g,[500,500],ftol=10**-7,disp=0)
print(g((x,y))**0.5)

Solution (Python):
def calc1(x1,y1,x2,y2,x3,y3):
  a=x1-x2
  b=y1-y2
  c=x2-x3
  d=y2-y3
  if a*d-b*c==0:
    return [0,0,0]
  x4=(d*((x1**2+y1**2)-(x2**2+y2**2))-b*((x2**2+y2**2)-(x3**2+y3**2)))/(2*(a*d-b*c))
  y4=(-c*((x1**2+y1**2)-(x2**2+y2**2))+a*((x2**2+y2**2)-(x3**2+y3**2)))/(2*(a*d-b*c))
  r=((x1-x4)**2+(y1-y4)**2)**0.5
  return [x4,y4,r]
def calc2(x1,y1,x2,y2):
  r=(((x2-x1)**2+(y2-y1)**2)**0.5)/2
  return [(x1+x2)/2,(y1+y2)/2,r]

eps=10**(-9)
n=int(input())
arr=[list(map(int,input().split())) for _ in range(n)]
ans=10**18
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      cx,cy,r=calc1(arr[i][0],arr[i][1],arr[j][0],arr[j][1],arr[k][0],arr[k][1])
      for l in range(n):
        tx,ty=arr[l]
        if ((cx-tx)**2+(cy-ty)**2)>r**2+eps:
          break
      else:
        ans=min(ans,r)
for i in range(n):
  for j in range(i+1,n):
    cx,cy,r=calc2(arr[i][0],arr[i][1],arr[j][0],arr[j][1])
    for k in range(n):
      tx,ty=arr[k]
      if ((cx-tx)**2+(cy-ty)**2)>r**2+eps:
        break
    else:
      ans=min(ans,r)
print(ans)