Problem p02801 (python)

Fixed submission:
n=input()
ans=chr(ord(n)+1)

print(ans)

Buggy submission (verdict: Runtime Error):
import math
import sys

def func(a,b,c,d,e,f):
    try:
        aa=(c-e)**2+(d-f)**2
        bb=(a-e)**2+(b-f)**2
        cc=(a-c)**2+(b-d)**2
        o,p,q=bb+cc-aa,cc+aa-bb,aa+bb-cc
        m=aa*o+bb*p+cc*q

        px=(aa*o*a+bb*p*c+cc*q*e)/m
        py=(aa*o*b+bb*p*d+cc*q*f)/m

        r = math.hypot(px-a, py-b)
        return px,py,r

    except ZeroDivisionError:
        return 0,0,10**6

n=int(input())

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


if n==2:
    print(math.hypot(x[0]-x[1],y[0]-y[1])/2)
    sys.exit()
elif n==3:
    px,py,r=func(x[0],y[0],x[1],y[1],x[2],y[2])
    print(r)
    sys.exit()
    

minr=10**6
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            px,py,r=func(x[i],y[i],x[j],y[j],x[k],y[k])

            sgn=1
            for p in range(n):
                if math.hypot(x[p]-px,y[p]-py)>r:
                    sgn=0
            if sgn==1: minr=min(minr,r)

print(minr)

Buggy submission (verdict: Runtime Error):
import math
import sys

def func(a,b,c,d,e,f):
    try:
        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)
        return px,py,r

    except ZeroDivisionError:
        return 0,0,10**6

n=int(input())

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


if n==2:
    print(math.hypot(x[0]-x[1],y[0]-y[1])/2)
    sys.exit()
elif n==3:
    px,py,r=func(x[0],y[0],x[1],y[1],x[2],y[2])
    print(r)
    sys.exit()
    

minr=10**6
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            px,py,r=func(x[i],y[i],x[j],y[j],x[k],y[k])

            sgn=1
            for p in range(n):
                if math.hypot(x[p]-px,y[p]-py)>r+10**(-5):
                    sgn=0
            if sgn==1: minr=min(minr,r)

print(minr)

Buggy submission (verdict: Runtime Error):
import math
import sys

def func(a,b,c,d,e,f):
    try:
        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)
        return px,py,r

    except ZeroDivisionError:
        return 0,0,10**6

n=int(input())

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


if n==2:
    print(math.hypot(x[0]-x[1],y[0]-y[1])/2)
    sys.exit()
elif n==3:
    px,py,r=func(x[0],y[0],x[1],y[1],x[2],y[2])
    print(r)
    sys.exit()
    

minr=10**6
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            px,py,r=func(x[i],y[i],x[j],y[j],x[k],y[k])

            sgn=1
            for p in range(n):
                if math.hypot(x[p]-px,y[p]-py)>r:
                    sgn=0
            if sgn==1: minr=min(minr,r)

print(minr)