Problem p02861 (python)

Fixed submission:
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
from itertools import permutations

def resolve():
    N=int(input())
    l=[[0,0] for i in range(N)]
    for i in range(N):
        x,y=map(int,input().split())
        l[i][0],l[i][1]=x,y

    p=permutations(l)
    dist = 0
    for v in p:
        for i in range(N-1):
            dist+=((v[i][0]-v[i+1][0])**2+(v[i][1]-v[i+1][1])**2)**0.5

    print(dist/len(list(permutations((l)))))


resolve()

Buggy submission (verdict: Runtime Error):
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
from itertools import permutations
import math
#import numpy as np
input = sys.stdin.readline

def resolve():
    N=int(input())
    l=[[0,0] for i in range(N)]
    for i in range(N):
        x,y=map(int,input().split())
        l[i][0],l[i][1]=x,y

    p=permutations(l)
    dist = 0
    for v in p:
        for i in range(N-1):
            dist+=math.sqrt((v[i][0]-v[i+1][0])**2+(v[i][1]-v[i+1][1])**2)
    print(dist/len(list(permutations((l)))))


resolve()

Buggy submission (verdict: Runtime Error):
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
from itertools import permutations
# import math
import numpy as np
input = sys.stdin.readline

def resolve():
    N=int(input())
    l=[[0,0] for i in range(N)]
    for i in range(N):
        x,y=map(int,input().split())
        l[i][0],l[i][1]=x,y

    p=permutations(l)
    dist = 0
    for v in p:
        for i in range(N-1):
            dist+=np.sqrt((v[i][0]-v[i+1][0])**2+(v[i][1]-v[i+1][1])**2)
    print(dist/len(list(permutations((l)))))


resolve()

Buggy submission (verdict: Runtime Error):
# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    l=[[0,0] for i in range(N)]
    for i in range(N):
        x,y=map(int,input().split())
        l[i][0],l[i][1]=x,y

    p=permutations(l)
    dist = 0
    for v in p:
        for i in range(N-1):
            dist+=np.sqrt((v[i][0]-v[i+1][0])**2+(v[i][1]-v[i+1][1])**2)
    print(dist/len(list(permutations((l)))))


resolve()

Buggy submission (verdict: Runtime Error):
# import bisect
# import copy
# import fractions
import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
import statistics as st

def resolve():

    N=int(input())
    x, y = [0] * N, [0] * N
    for i in range(N):
        x[i], y[i] = map(int, input().split())

    total=0
    all=[]
    for i in range(N):
        if i!=N-1:
            all.append(math.sqrt((x[i]-x[i+1])**2+(y[i]-y[i+1])**2))
        else:
            all.append(math.sqrt((x[0]-x[N-1])**2+(y[0]-y[N-1])**2))
            #total+=math.sqrt((x[0]-x[N-1])**2+(y[0]-y[N-1])**2)
    print(sum(all)-st.mean(all))




resolve()