Buggy python submission (verdict: Runtime Error):
from collections import Counter
#from math import factorial
from scipy.special import comb
def com(n , r):
    return factorial(n) // (factorial(n - r) * factorial(r))
N = int(input())
S = []
for _ in range(N):
    s = input()
    S.append("".join(sorted(s)))
CS = Counter(S)
ans = 0
for val in CS.values():
    ans += comb(val , 2 , exact = True)
print(ans)

Fixed submission:
#from Collections import Counter

N = int(input())
count = 0
word = {}
def str_sort(str):
    f = lambda y: "".join(sorted(map(lambda x: x.replace(' ', '').lower(), y)))
    return f(str)
for _ in range(N):
    sorted_str = str_sort(input())
    if sorted_str not in word:
        word[sorted_str] = [0]
        word[sorted_str].append(1)
    else:
        if word[sorted_str] == 0:
            word[sorted_str][0] = 1
        else:
            word[sorted_str][0] += word[sorted_str][1]
            word[sorted_str][1] += 1
            #word[sorted_str] = word[sorted_str][0] + word[sorted_str][1]
total = sum(
    v[0] for v in word.values()
)
#print(word)
print(total)

Buggy python submission (verdict: Runtime Error):
a

Fixed submission:
#from Collections import Counter

N = int(input())
count = 0
word = {}
def str_sort(str):
    f = lambda y: "".join(sorted(map(lambda x: x.replace(' ', '').lower(), y)))
    return f(str)
for _ in range(N):
    sorted_str = str_sort(input())
    if sorted_str not in word:
        word[sorted_str] = [0]
        word[sorted_str].append(1)
    else:
        if word[sorted_str] == 0:
            word[sorted_str][0] = 1
        else:
            word[sorted_str][0] += word[sorted_str][1]
            word[sorted_str][1] += 1
            #word[sorted_str] = word[sorted_str][0] + word[sorted_str][1]
total = sum(
    v[0] for v in word.values()
)
#print(word)
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
count = 0
word = []
def verify_anagrams(w1, w2):
    f = lambda y: "".join(sorted(map(lambda x: x.replace(' ', '').lower(), y)))
    return f(w1) == f(w2)

def str_sort(str):
    f = lambda y: "".join(sorted(map(lambda x: x.replace(' ', '').lower(), y)))
    return f(str)
for _ in range(N):
    word.append(str_sort(input()))


for i in range(N - 1):
    for j in range(i + 1,N):
        if word[i] ==  word[j]:
            count += 1
print(count)

Fixed submission:
#from Collections import Counter

N = int(input())
count = 0
word = {}
def str_sort(str):
    f = lambda y: "".join(sorted(map(lambda x: x.replace(' ', '').lower(), y)))
    return f(str)
for _ in range(N):
    sorted_str = str_sort(input())
    if sorted_str not in word:
        word[sorted_str] = [0]
        word[sorted_str].append(1)
    else:
        if word[sorted_str] == 0:
            word[sorted_str][0] = 1
        else:
            word[sorted_str][0] += word[sorted_str][1]
            word[sorted_str][1] += 1
            #word[sorted_str] = word[sorted_str][0] + word[sorted_str][1]
total = sum(
    v[0] for v in word.values()
)
#print(word)
print(total)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
count = 0
word = []
def verify_anagrams(w1, w2):
    f = lambda y: "".join(sorted(map(lambda x: x.replace(' ', '').lower(), y)))
    return f(w1) == f(w2)

for _ in range(N):
    word.append(input())

for i in range(N - 1):
    for j in range(i + 1,N):
        if verify_anagrams(word[i], word[j]):
            count += 1
print(count)

Fixed submission:
#from Collections import Counter

N = int(input())
count = 0
word = {}
def str_sort(str):
    f = lambda y: "".join(sorted(map(lambda x: x.replace(' ', '').lower(), y)))
    return f(str)
for _ in range(N):
    sorted_str = str_sort(input())
    if sorted_str not in word:
        word[sorted_str] = [0]
        word[sorted_str].append(1)
    else:
        if word[sorted_str] == 0:
            word[sorted_str][0] = 1
        else:
            word[sorted_str][0] += word[sorted_str][1]
            word[sorted_str][1] += 1
            #word[sorted_str] = word[sorted_str][0] + word[sorted_str][1]
total = sum(
    v[0] for v in word.values()
)
#print(word)
print(total)