Problem p02805 (python)

Fixed submission:
from itertools import combinations
INFTY = 10**4
epsilon = 1e-10
def dist(x,y):
    return ((x[0]-y[0])**2+(x[1]-y[1])**2)**0.5
def cross(x,y):
    return x[0]*y[1]-x[1]*y[0]
def dot(x,y):
    return x[0]*y[0]+x[1]*y[1]
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
rmin = INFTY
for z in combinations(range(N),3):
    i,j,k = z
    x0,y0 = X[i]
    x1,y1 = X[j]
    x2,y2 = X[k]
    r = max(dist(X[i],X[j]),dist(X[j],X[k]),dist(X[k],X[i]))/2
    if r==dist(X[i],X[j])/2:
        x = (x0+x1)/2
        y = (y0+y1)/2
    elif r==dist(X[j],X[k])/2:
        x = (x1+x2)/2
        y = (y1+y2)/2
    else:
        x = (x2+x0)/2
        y = (y2+y0)/2
    a = cross([x1-x0,y1-y0],[x2-x0,y2-y0])
    if a==0:continue
    if dot([x1-x0,y1-y0],[x2-x0,y2-y0])>=0 and dot([x0-x1,y0-y1],[x2-x1,y2-y1])>=0 and dot([x1-x2,y1-y2],[x0-x2,y0-y2])>=0:
        s = ((x1-x0)**2+(y1-y0)**2-(x0+x1-2*x2)**2-(y0+y1-2*y2)**2)/8
        s = s/(x0*y1-x1*y0-x2*y1+x2*y0-x0*y2+x1*y2)
        x = (x0+x1)/2+s*(y1-y0)
        y = (y0+y1)/2+s*(x0-x1)
        r = dist([x,y],[x0,y0])
    flag = 0
    for i in range(N):
        if dist([x,y],X[i])<=r+epsilon:
            continue
        else:
            flag = 1
            break
    if flag==0:
        rmin = min(rmin,r)
if rmin==INFTY:
    rmin = 0
    for i in range(N-1):
        for j in range(i+1,N):
            rmin = max(rmin,dist(X[i],X[j]))
    print(rmin/2)
else:
    print(rmin)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
INFTY = 10**4
epsilon = 1e-12
def dist(x,y):
    return ((x[0]-y[0])**2+(x[1]-y[1])**2)**0.5
def cross(x,y):
    return x[0]*y[1]-x[1]*y[0]
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
rmin = INFTY
for z in combinations(range(N),3):
    i,j,k = z
    x0,y0 = X[i]
    x1,y1 = X[j]
    x2,y2 = X[k]
    a = cross([x1-x0,y1-y0],[x2-x0,y2-y0])
    if a==0:continue
    s = ((x1-x0)**2+(y1-y0)**2-(x0+x1-2*x2)**2-(y0+y1-2*y2)**2)/8
    s = s/(x0*y1-x1*y0-x2*y1+x2*y0-x0*y2+x1*y2)
    x = (x0+x1)/2+s*(y1-y0)
    y = (y0+y1)/2+s*(x0-x1)
    r = dist([x,y],[x0,y0])
    flag = 0
    for m in range(N):
        if dist([x,y],X[m])<=r:
            continue
        else:
            flag = 1
            break
    if flag==0:
        rmin = min(rmin,r)
if rmin==INFTY:
    rmin = 0
    for i in range(N-1):
        for j in range(i+1,N):
            rmin = max(rmin,dist(X[i],X[j]))
    print(rmin/2)
else:
    print(rmin

Buggy submission (verdict: Runtime Error):
from itertools import combinations
INFTY = 4*10**6
epsilon = 1e-12
def dist2(x,y):
    return (x[0]-y[0])**2+(x[1]-y[1])**2
def cross(x,y):
    return x[0]*y[1]-x[1]*y[0]
N = int(input())
X = [list(map(int,input().split())) for _ in range(N)]
rmin = INFTY
for z in combinations(range(N),3):
    i,j,k = z
    x0,y0 = X[i]
    x1,y1 = X[j]
    x2,y2 = X[k]
    a = cross([x1-x0,y1-y0],[x2-x0,y2-y0])
    if a==0:continue
    s = ((x1-x0)**2+(y1-y0)**2-(x0+x1-2*x2)**2-(y0+y1-2*y2)**2)/8
    s = s/(x0*y1-x1*y0-x2*y1+x2*y0-x0*y2+x1*y2)
    x = (x0+x1)/2+s*(y1-y0)
    y = (y0+y1)/2+s*(x0-x1)
    r2 = dist2([x,y],[x0,y0])
    flag = 0
    for m in range(N):
        if dist2([x,y],X[m])<=r2+epsilon:
            continue
        else:
            flag = 1
            break
    if flag==0:
        rmin = min(rmin,r2)
if rmin==INFTY:
    rmin = 0
    for i in range(N-1):
        for j in range(i+1,N):
            rmin = max(rmin,dist(X[i],X[j]))
    print(rmin/2)
else:
    print(rmin**0.5)

Buggy submission (verdict: Runtime Error):
rmin = 10000
for z in combinations(range(N),3):
    i,j,k = z
    x0,y0 = X[i]
    x1,y1 = X[j]
    x2,y2 = X[k]
    a = cross([x1-x0,y1-y0],[x2-x0,y2-y0])
    if a==0:continue
    s = ((x1-x0)**2+(y1-y0)**2-(x0+x1-2*x2)**2-(y0+y1-2*y2)**2)/8
    s = s/(x0*y1-x1*y0-x2*y1+x2*y0-x0*y2+x1*y2)
    x = (x0+x1)/2+s*(y1-y0)
    y = (y0+y1)/2+s*(x0-x1)
    r = dist([x,y],[x0,y0])
    flag = 0
    for m in range(N):
        if dist([x,y],X[m])<=r+epsilon:
            continue
        else:
            flag = 1
            break
    if flag==0:
        rmin = min(rmin,r)
if rmin==1000:
    rmin = 0
    for i in range(N-1):
        for j in range(i,N):
            rmin = max(rmin,dist(X[i],X[j]))
    rmin = rmin/2
print(rmin)