Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def resolve():
    H,N=(int(i) for i in input().split())
    magics=[[int(i) for i in input().split()] for j in range(N)]
    mx=2**31
    dpt=[mx for i in range(H+1)]
    dpt[-1]=0
    for i in range(H,0,-1):
        
        current=dpt[i]
        if current> dpt[0]:
            continue
        for m in magics:
            dpt[max(0,i-m[0])]=min(dpt[max(0,i-m[0])],current+m[1])
    print(dpt[0])

if __name__ == "__main__":
    resolve()

Fixed submission:
def resolve():
    H,N=(int(i) for i in input().split())
    magics=[[int(i) for i in input().split()] for j in range(N)]
    mx=2**31
    dpt=[mx for i in range(H+1)]
    dpt[-1]=0
    for i in range(H,0,-1):
        
        current=dpt[i]
        if current> dpt[0]:
            continue
        for m in magics:
            dpt[max(0,i-m[0])]=min(dpt[max(0,i-m[0])],current+m[1])
    print(dpt[0])

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
tl = input().split()

l = [int(i) for i in tl]

mn = n

count = 0
for i in range(len(l)):
    if l[i] > mn:
        continue

    sl = l[0:i+1]
    mn = min(sl)
    count += 1

print(count)


Fixed submission:
n = int(input())
tl = input().split()

l = [int(i) for i in tl]

mn = n

count = 0
mn_i = 0
for i in range(len(l)):
    if l[i] > mn:
        continue

    sl = l[mn_i:i+1]
    mn = min(sl)
    mn_i = i
    count += 1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n = int(input())

tl = [i for i in range(1, n+1) if i % 10 != 0]

l = list(itertools.product(tl, tl))

# print(l)

ans = []
count = 0
for pair in l:
    a = str(pair[0])
    b = str(pair[1])
    if (a[0] == b[len(b)-1]) and (a[len(a)-1] == b[0]):
        count += 1
        # ans.append(pair)

print(count)
# print(ans)


Fixed submission:
import itertools

n = int(input())

tl = [i for i in range(1, n+1) if i % 10 != 0]

"""
l = list(itertools.product(tl, tl))

# print(l)

ans = []
count = 0
for pair in l:
    a = str(pair[0])
    b = str(pair[1])
    if (a[0] == b[len(b)-1]) and (a[len(a)-1] == b[0]):
        count += 1
        # ans.append(pair)

print(count)
# print(ans)
"""

c = [[0 for j in range(10)] for i in range(10)]
for k in range(1, n+1):
    i = int(str(k)[0])  # 先頭 k=114514 なら1
    j = int(str(k)[len(str(k))-1])  # 末尾 k=114514 なら4
    c[i][j] += 1

count = 0
# print(c)
for i in range(10):
    for j in range(10):
        count += c[i][j]*c[j][i]

print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())


def prime(n):
    if n == 1:
        n += 1
    while True:
        flag = 0
        for k in range(2, int(n**0.5) + 1):
            if n % k == 0:
                flag = 1
                break
        if flag == 0:
            return n
        n += 1


ans = prime(n)
print(ans)


Fixed submission:
a = input().split()
print(a[1]+a[0])
Buggy python submission (verdict: Runtime Error):
# import math
import fractions

n = int(input())


def prime(n):
    if n == 1:
        n += 1
    while True:
        flag = 0
        for k in range(2, int(fractions.sqrt(n)) + 1):
            if n % k == 0:
                flag = 1
                break
        if flag == 0:
            return n
        n += 1


ans = prime(n)
print(ans)


Fixed submission:
n = int(input())


def prime(n):
    if n == 1:
        n += 1
    while True:
        flag = 0
        for k in range(2, int(n**0.5) + 1):
            if n % k == 0:
                flag = 1
                break
        if flag == 0:
            return n
        n += 1


ans = prime(n)
print(ans)
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
l = [1, 2, 3]
l.remove(a)
l.remove(b)
print(l[0])

Fixed submission:
a = int(input())
b = int(input())
l = [1, 2, 3]
l.remove(a)
l.remove(b)
print(l[0])
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
t = input()
l = ""
for i in range(n):
    l += s[i]
    l += t[i]

print(l)


Fixed submission:
n = int(input())
s = input().split()
l = ""
for i in range(n):
    l += s[0][i]
    l += s[1][i]

print(l)
Buggy python submission (verdict: Runtime Error):
import math

s = input().split()
a, b = int(s[0]), int(s[1])


def lcm(x, y):
    return int((x * y) / math.gcd(x, y))


print(lcm(a, b))

Fixed submission:
import fractions
a,b=map(int, input().split())
f=fractions.gcd(a,b)
f2=a*b//f
print(f2)

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

s = input().split()
a, b = int(s[0]), int(s[1])


def lcm(x, y):
    return int((x * y) / math.gcd(x, y))


print(lcm(a, b))


Fixed submission:
import fractions
a,b=map(int, input().split())
f=fractions.gcd(a,b)
f2=a*b//f
print(f2)

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

s = input().split()
a, b = int(s[0]), int(s[1])


def lcm(x, y):
    return int((x * y) / math.gcd(x, y))


print(lcm(a, b))

Fixed submission:
import fractions
a,b=map(int, input().split())
f=fractions.gcd(a,b)
f2=a*b//f
print(f2)

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

s = input().split()
a, b = int(s[0]), int(s[1])


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


print(lcm(a, b))


Fixed submission:
import fractions
a,b=map(int, input().split())
f=fractions.gcd(a,b)
f2=a*b//f
print(f2)
Buggy python submission (verdict: Runtime Error):
import copy
from itertools import permutations, product

n = int(input())
al = []
xyl = []
for i in range(n):
    a = int(input())
    al.append(a)
    tl = []
    for j in range(a):
        t = [int(i) for i in input().split()]
        tl.append(t)
    xyl.append(tl)

l = [i for i in product([0, 1], repeat=n)]

ans_list = []

for ll in l:
    ans_flag = 1
    for i in range(n):
        flag = 1
        for j in range(a):
            if ll[xyl[i][j][0]-1] != xyl[i][j][1]:
                flag = 0
        if flag != ll[i]:
            ans_flag = 0
    if ans_flag == 1:
        ans_list.append(copy.deepcopy(ll))

ans = 0
for i in ans_list:
    k = i.count(1)
    if ans < k:
        ans = k

print(ans)

Fixed submission:
import copy
from itertools import permutations, product

n = int(input())
al = []
xyl = []
for i in range(n):
    a = int(input())
    al.append(a)
    tl = []
    for j in range(a):
        t = [int(i) for i in input().split()]
        tl.append(t)
    xyl.append(tl)

l = [i for i in product([0, 1], repeat=n)]

ans_list = []

for ll in l:
    ans_flag = 1
    for i in range(n):
        flag = 1
        for j in range(al[i]):
            if ll[xyl[i][j][0]-1] != xyl[i][j][1]:
                flag = 0
        if flag != ll[i]:
            ans_flag = 0
    if ans_flag == 1:
        ans_list.append(copy.deepcopy(ll))

ans = 0
for i in ans_list:
    k = i.count(1)
    if ans < k:
        ans = k

print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M,K = LI()
A = LI()
B = LI()
accumulate_A = list(itertools.accumulate(A))
accumulate_B = list(itertools.accumulate(B))
ans,j = 0,M-1
for i in range(N):
    if accumulate_A[i]>K:
        break
    while accumulate_A[i]+accumulate_B[j]>K:
        j -= 1
    ans = max(ans,i+j+2)
print(ans)


Fixed submission:
import itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,M,K = LI()
A = LI()
B = LI()
accumulate_A = [0]+list(itertools.accumulate(A))
accumulate_B = [0]+list(itertools.accumulate(B))
ans,j = 0,M
for i in range(N+1):
    if accumulate_A[i]>K:
        break
    while accumulate_A[i]+accumulate_B[j]>K:
        j -= 1
    ans = max(ans,i+j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()

ans = 0
for i in range(1,N+1):
    n = N//i
    a1,d = i,i
    an = a1+(n-1)*d
    ans += n*(a1+an)//2
print(ans)


Fixed submission:
import sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()

ans = 0
for i in range(1,N+1):
    n = N//i
    a1,d = i,i
    an = a1+(n-1)*d
    ans += n*(a1+an)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
import string,sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
abc = string.ascii_lowercase
def main(N):
    if N<=26:
        return abc[N-1]
    if N%26==0:
        return abc[N//26-2]+'z'
    return main(N//26)+abc[N%26-1]
print(main(N))


Fixed submission:
import string,sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
abc = string.ascii_lowercase
def main(N):
    if N<=26:
        return abc[N-1]
    if N%26==0:
        return main(N//26-1)+abc[-1]
    return main(N//26)+abc[N%26-1]
print(main(N))
Buggy python submission (verdict: Time Limit Exceeded):
import collections,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
A = sorted(LI())
ans_bool = [0]*(10**6+1)
for a in A:
    num = a
    while num<=10**6:
        ans_bool[num] += 1
        num += a
ans = 0
for a in A:
    if ans_bool[a]==1:
        ans += 1
print(ans)


Fixed submission:
import collections,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
A = sorted(LI())
counter_A = collections.Counter(A)
sequence = [0]*(10**6+1)
ans = 0
for k,v in counter_A.items():
    if sequence[k]==1:
        continue
    if v==1:
        ans += 1
    for i in range(k,10**6+1,k):
        sequence[i] = 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
A = sorted(LI())
ans_bool = [0]*(10**6+1)
for a in A:
    num = a
    while num<=10**6:
        ans_bool[num] += 1
        num += a
ans = 0
for a in A:
    if ans_bool[a]==1:
        ans += 1
print(ans)


Fixed submission:
import collections,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
A = sorted(LI())
counter_A = collections.Counter(A)
sequence = [0]*(10**6+1)
ans = 0
for k,v in counter_A.items():
    if sequence[k]==1:
        continue
    if v==1:
        ans += 1
    for i in range(k,10**6+1,k):
        sequence[i] = 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
A,B,C,K = LI()
ans = 0
for _ in range(K):
    if A!=0:
        ans +=1
        A -= 1
    elif B!=0:
        B -= 1
    else:
        ans -= 1
print(ans)


Fixed submission:
import sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
A,B,C,K = LI()
ans = min(A,K)
if A+B<K:
    ans -= K-(A+B)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def LI(): return list(map(int,input().split()))
A,B,N = LI()
ans = 0
for i in range(max(N-N%B-A,1),N+1):
    temp = (A*i//B)-A*(i//B)
    ans = max(ans,temp)
print(ans)

Fixed submission:
def LI(): return list(map(int,input().split()))
A,B,N = LI()
ans = 0
if B<=N:
    print(int((A/B*(B-1))//1))
else:
    print(int((A/B)*(N%B)//1))

Buggy python submission (verdict: Time Limit Exceeded):
def LI(): return list(map(int,input().split()))
A,B,N = LI()
ans = 0
for i in range(max(N-N%B-B,1),N+1):
    temp = (A*i//B)-A*(i//B)
    ans = max(ans,temp)
print(ans)


Fixed submission:
def LI(): return list(map(int,input().split()))
A,B,N = LI()
ans = 0
if B<=N:
    print(int((A/B*(B-1))//1))
else:
    print(int((A/B)*(N%B)//1))
Buggy python submission (verdict: Runtime Error):
import itertools
S = input()
anskouho_set = set()
mod3 =[]
for x in S:
    mod3.append(int(x)%3)
mod3_accumulate = [x%3 for x in list(itertools.accumulate(mod3))]
ans = 0
for i in range(3):
    temp = []
    if i==0:
        temp.append(0)
    for j,x in enumerate(mod3_accumulate):
        if x==i:
            temp.append(j)
    for k in range(len(temp)):
        for l in range(k+1,len(temp)):
            if temp[l]-temp[k]>=4:
                anskouho_set.add((temp[k],temp[l]))
            if temp[l]+1-temp[k]>=4:
                anskouho_set.add((temp[k]+1,temp[l]))
for x in anskouho_set:
    if int(S[x[0]:x[1]+1])%2019==0:
        ans += 1
print(ans)


Fixed submission:
def LI(): return list(map(int,input().split()))
S,W = LI()
print('unsafe' if W>=S else 'safe')
Buggy python submission (verdict: Runtime Error):
import bisect,collections,copy,itertools,math,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
N = I()
A = LI()
_123 = [0]*N
_123count = [0]*N
for x in A:
    _123[x-1] += 1
_123copy = copy.copy(_123)
_123copy.sort(reverse=True)
_count = {}
for i,x in enumerate(_123copy):
    if x==0:
        break
    if x==1:
        _123count[i] = 0
    elif i!=0 and _123copy[i]==_123copy[i-1]:
        _123count[i] = _123count[i-1]
    else:
        _123count[i] = math.factorial(x)//((math.factorial(x-2))*(math.factorial(2)))
        _count[x] = _123count[i]
_sum = sum(_123count)
for x in A:
    temp = _123[x-1]-1
    if temp<=0:
        print(_sum)
    elif temp==1:
        print(_sum-1)
    else:
        if (temp+1) in _count:
            tempminus = _count[temp+1]
        else:
            tempminus = math.factorial(temp+1)//((math.factorial(temp-1))*(math.factorial(2)))
            _count[temp+1] = tempminus
        if (temp) in _count:
            tempplus = _count[temp]
        else:
            tempplus = math.factorial(temp)//((math.factorial(temp-2))*(math.factorial(2)))
            _count[temp] = tempplus
        print(_sum-tempminus+tempplus)


Fixed submission:
import bisect,collections,copy,itertools,math,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
N,M = LI()
if N <= 1:
    n = 0
else:
    n = math.factorial(N)//((math.factorial(N-2))*(math.factorial(2)))
if M <= 1:
    m = 0
else:
    m = math.factorial(M)//((math.factorial(M-2))*(math.factorial(2)))
print(n+m)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
def main(N,S):
    S.sort()
    setS = set(S)
    counterS = collections.Counter(S)
    maxcount = 0
    for i in setS:
        maxcount = max(maxcount, S.count(i))
    keys = [k for k, v in counterS.items() if v == maxcount]
    keys.sort()
    for j in keys:
        print(j)

N = int(input())
S = [input() for _ in range(N)]
main(N,S)

Fixed submission:
import collections
def main(N,S):
    counterS = collections.Counter(S)
    maxcount = max(counterS.values())
    keys = [k for k, v in counterS.items() if v == maxcount]
    keys.sort()
    for j in keys:
        print(j)

N = int(input())
S = [input() for _ in range(N)]
main(N,S)
Buggy python submission (verdict: Runtime Error):
def main(N,K,p):
    sumi = 0
    ruiseki = [0] * (N+1)
    for i in range(N):
        ruiseki[i+1] = ruiseki[i] + p[i]
    for j in range(K):
        sumi = max(sumi, (ruiseki[j+K]-ruiseki[j]))
    return (sumi + K) /2
N,K = map(int,input().split())
p = list(map(int,input().split()))
print(main(N,K,p))


Fixed submission:
def main(N,K,p):
    sumi = 0
    ruiseki = [0] * (N+1)
    for i in range(N):
        ruiseki[i+1] = ruiseki[i] + p[i]
    for j in range(N-K+1):
        sumi = max(sumi, (ruiseki[j+K]-ruiseki[j]))
    return (sumi + K) / 2
N,K = map(int,input().split())
p = list(map(int,input().split()))
print(main(N,K,p))

Buggy python submission (verdict: Time Limit Exceeded):
def main(N,K,p):
    summary = []
    sumi = 0
    for i in range(len(p)-K+1):
        for j in range(K):
            sumi += p[i+j]
        summary.append(sumi)
        sumi = 0
    return (max(summary) + K) / 2

N,K = map(int,input().split())
p = list(map(int,input().split()))
print(main(N,K,p))


Fixed submission:
def main(N,K,p):
    sumi = 0
    ruiseki = [0] * (N+1)
    for i in range(N):
        ruiseki[i+1] = ruiseki[i] + p[i]
    for j in range(N-K+1):
        sumi = max(sumi, (ruiseki[j+K]-ruiseki[j]))
    return (sumi + K) / 2
N,K = map(int,input().split())
p = list(map(int,input().split()))
print(main(N,K,p))

Buggy python submission (verdict: Time Limit Exceeded):
def main(N,K,p):
    summary = 0
    sumi = 0
    for i in range(len(p)-K+1):
        for j in range(K):
            sumi += p[i+j]
        summary = max(summary,sumi)
        sumi = 0
    return (summary + K) / 2 

N,K = map(int,input().split())
p = list(map(int,input().split()))
print(main(N,K,p))


Fixed submission:
def main(N,K,p):
    sumi = 0
    ruiseki = [0] * (N+1)
    for i in range(N):
        ruiseki[i+1] = ruiseki[i] + p[i]
    for j in range(N-K+1):
        sumi = max(sumi, (ruiseki[j+K]-ruiseki[j]))
    return (sumi + K) / 2
N,K = map(int,input().split())
p = list(map(int,input().split()))
print(main(N,K,p))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
count = 0
for i in range(N):
    minP = min(P[:i+1])
    if P[i] == minP:
        count = count + 1
print(count)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
count = 0
minP = P[0]
for i in range(N):
    if P[i] <= minP:
        count += 1
        minP = P[i] 

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
count = 0
minnum = 0
num = 1
while num <= max(P):
        minnum = P.index(min(P))
        del P[minnum+1:]
        count = count + 1
        num = minnum
print(count) 

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
count = 0
minP = P[0]
for i in range(N):
    if P[i] <= minP:
        count += 1
        minP = P[i] 

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
count = 0
minnum = 0
num = 1
while num <= max(P):
    if num in P:
        minnum = P.index(num)
        del P[minnum+1:]
        count = count + 1
        num = num + 1
    else:
        num = num + 1
print(count)        
    

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
count = 0
minP = P[0]
for i in range(N):
    if P[i] <= minP:
        count += 1
        minP = P[i] 

print(count)
Buggy python submission (verdict: Runtime Error):
import math
def main(X):
    max_search = min(101, (math.sqrt(X)+1 if math.sqrt(X) % 1 == 0 else math.ceil(math.sqrt(X))))
    if X <= 3:
        return X
    SosuuFlg = False
    while SosuuFlg == False:
        for i in range(2, max_search):
            if X % i == 0:
                break
        else:
            SosuuFlg = True
            return X
        X += 1
        
X = int(input())
print(main(X))

Fixed submission:
import math
def main(X):
    if X <= 3:
        return X
    SosuuFlg = False
    while SosuuFlg == False:
        max_search = int(math.sqrt(X)+1) if math.sqrt(X) % 1 == 0 else math.ceil(math.sqrt(X))
        for i in range(2, max_search):
            if X % i == 0:
                break
        else:
            SosuuFlg = True
            return X
        X += 1
        
X = int(input())
print(main(X))
Buggy python submission (verdict: Runtime Error):
list1 = [int(e) for e in input().split()]
sum = 0
for num in list1:
    sum += num

if sum >= 22:
    print 'bust'
else:
    print 'win'

Fixed submission:
list1 = [int(e) for e in input().split()]
sum = 0
for num in list1:
    sum += num

if sum >= 22:
    print ('bust')
else:
    print ('win')
Buggy python submission (verdict: Runtime Error):
#lang:reverse.py

result = 0
str = input()
#文字数
str_length = len(str)
rev_str = str[::-1]
count = 0

if str_length % 2 == 1:
    count = (str_length -1)/2
else:
    count = str_length / 2


for i in range(count):
    if str[i] != rev_str[i] :
        result = result + 1

print(result)


Fixed submission:
#lang:reverse.py

result = 0
str = input()
#文字数
str_length = len(str)
rev_str = str[::-1]
count = 0

if str_length % 2 == 1:
    count = (str_length -1)/2
else:
    count = str_length / 2


for i in range(int(count)):
    if str[i] != rev_str[i] :
        result = result + 1

print(result)

Buggy python submission (verdict: Runtime Error):
lang:reverse.py
result = 0
str = input()
--文字数
str_length = len(str)
rev_str = str[::-1]
count = 0

if str_length % 2 == 1:
    count = (str_length -1)/2
else:
    count = str_length / 2


for i in range(count):
    if str[i] != rev_str[i] :
        result = result + 1

print(result)


Fixed submission:
#lang:reverse.py

result = 0
str = input()
#文字数
str_length = len(str)
rev_str = str[::-1]
count = 0

if str_length % 2 == 1:
    count = (str_length -1)/2
else:
    count = str_length / 2


for i in range(int(count)):
    if str[i] != rev_str[i] :
        result = result + 1

print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
A = LI()
ans = float('INF')
for i in range(1,N):
    ans = min(ans,abs(sum(A[:i])-sum(A[i:])))
print(ans)


Fixed submission:
import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N = I()
A = LI()
ans = float('INF')
sum_A = sum(A)
accumulate_A = list(itertools.accumulate(A))
for i in range(N-1):
    ans = min(ans,abs(sum_A-accumulate_A[i]*2))
print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools,math,numpy as np
def I(): return int(input())
def LI(): return list(map(int,input().split()))
N = I()
xy = np.array([LI() for _ in range(N)])
sum_norm = 0
dict_norm = {}
for a in itertools.permutations(range(N)):
    for i in range(len(a)-1):
        vector = tuple(xy[a[i+1]]-xy[a[i]])
        if not vector in dict_norm:
            dict_norm[vector] = np.linalg.norm(vector)
            vector_inverse = tuple(vector[0]*-1,vector[1]*-1)
            dict_norm[vector_inverse] = dict_norm[vector]
        sum_norm += dict_norm[vector]
print(sum_norm/math.factorial(N))


Fixed submission:
import itertools,math,numpy as np
def I(): return int(input())
def LI(): return list(map(int,input().split()))
N = I()
xy = np.array([LI() for _ in range(N)])
sum_norm = 0
dict_norm = {}
for a in itertools.permutations(range(N)):
    for i in range(len(a)-1):
        vector = xy[a[i+1]]-xy[a[i]]
        if not tuple(vector) in dict_norm:
            dict_norm[tuple(vector)] = np.linalg.norm(vector)
        sum_norm += dict_norm[tuple(vector)]
print(sum_norm/math.factorial(N))

Buggy python submission (verdict: Time Limit Exceeded):
import itertools,math,numpy as np
def I(): return int(input())
def LI(): return list(map(int,input().split()))
N = I()
xy = np.array(sorted([LI() for _ in range(N)]))
sum_norm = 0
for a in itertools.permutations(range(N)):
    for i in range(len(a)-1):
        sum_norm += np.linalg.norm(xy[a[i+1]]-xy[a[i]])
print(sum_norm/math.factorial(N))


Fixed submission:
import itertools,math,numpy as np
def I(): return int(input())
def LI(): return list(map(int,input().split()))
N = I()
xy = np.array([LI() for _ in range(N)])
sum_norm = 0
dict_norm = {}
for a in itertools.permutations(range(N)):
    for i in range(len(a)-1):
        vector = xy[a[i+1]]-xy[a[i]]
        if not tuple(vector) in dict_norm:
            dict_norm[tuple(vector)] = np.linalg.norm(vector)
        sum_norm += dict_norm[tuple(vector)]
print(sum_norm/math.factorial(N))