Buggy python submission (verdict: Time Limit Exceeded):
import sys
from itertools import permutations
from math import factorial
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
XY = np.array([list(map(int, readline().split())) for _ in range(N)])

dist = 0
for route in permutations(XY, N):
    acc = 0
    dists = [
        np.sqrt(sum(pow(route[i] - route[i + 1], 2))) for i in range(N - 1)
    ]
    dist += sum(dists)
print(dist / factorial(N))

Fixed submission:
import sys
from itertools import permutations
from math import factorial
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
XY = [list(map(int, readline().split())) for _ in range(N)]

dist = 0
for route in permutations(XY, N):
    acc = 0
    dists = [
        np.sqrt(
            pow(route[i][0] - route[i + 1][0], 2) +
            pow(route[i][1] - route[i + 1][1], 2)) for i in range(N - 1)
    ]
    dist += sum(dists)
print(dist / factorial(N))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from itertools import permutations
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
XY = np.array([list(map(int, readline().split())) for _ in range(N)])

dist = 0
cnt = 0
for route in permutations(XY, N):
    acc = 0
    for i in range(N - 1):
        acc += np.sqrt(sum(pow(route[i] - route[i + 1], 2)))
    dist += acc
    cnt += 1
print(dist / cnt)

Fixed submission:
import sys
from itertools import permutations
from math import factorial
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
XY = [list(map(int, readline().split())) for _ in range(N)]

dist = 0
for route in permutations(XY, N):
    acc = 0
    dists = [
        np.sqrt(
            pow(route[i][0] - route[i + 1][0], 2) +
            pow(route[i][1] - route[i + 1][1], 2)) for i in range(N - 1)
    ]
    dist += sum(dists)
print(dist / factorial(N))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from itertools import permutations
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
XY = np.array([list(map(int, readline().split())) for _ in range(N)])

dist = []
for route in permutations(XY, N):
    acc = 0
    for i in range(N - 1):
        acc += np.sqrt(sum(pow(route[i] - route[i + 1], 2)))
    dist.append(acc)

print(np.mean(dist))

Fixed submission:
import sys
from itertools import permutations
from math import factorial
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
XY = [list(map(int, readline().split())) for _ in range(N)]

dist = 0
for route in permutations(XY, N):
    acc = 0
    dists = [
        np.sqrt(
            pow(route[i][0] - route[i + 1][0], 2) +
            pow(route[i][1] - route[i + 1][1], 2)) for i in range(N - 1)
    ]
    dist += sum(dists)
print(dist / factorial(N))