Buggy python submission (verdict: Runtime Error):
#他の人の回答
import collections

N = int(input())
s = ["".join(sorted(input())) for _ in range(N)]　#sortedでリストになった文字列をjoinでもう一度文字列に
c = collections.Counter(s)　　#cは辞書の形をとる
ans = 0
for si in set(s):　# sから重複を無くす
    n = c[si]
    ans += n * (n - 1) // 2   # n C 2を計算
print(ans)

Fixed submission:
import itertools,math
n = int(input())
word = [input() for _ in range(n)]
count = 0

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(n):
    word[i] = sorted(word[i])

new_word = list(sorted(word))

x = 1

for i in range(n-1):
    if new_word[i] == new_word[i+1]:
        x += 1
    elif x >= 2:
        count += combinations_count(x,2)
        x = 1
if x >= 2:
    count +=  combinations_count(x,2)

print(count)

Buggy python submission (verdict: Runtime Error):
import itertools,math
n = int(input())
word = [input() for _ in range(n)]
count = 0

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(n):
    word[i] = sorted(word[i])

new_word = list(sorted(word))

x = 1

for i in range(n-1):
    if new_word[i] == new_word[i+1]:
        x += 1
    else:
        count += combinations_count(x,2)
        x = 1
if x >= 2:
    count +=  combinations_count(x,2)
    
print(count)

Fixed submission:
import itertools,math
n = int(input())
word = [input() for _ in range(n)]
count = 0

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(n):
    word[i] = sorted(word[i])

new_word = list(sorted(word))

x = 1

for i in range(n-1):
    if new_word[i] == new_word[i+1]:
        x += 1
    elif x >= 2:
        count += combinations_count(x,2)
        x = 1
if x >= 2:
    count +=  combinations_count(x,2)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
word = [input() for _ in range(n)]
count = 0

for i in range(n):
    word[i] = sorted(word[i])

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

print(count)


Fixed submission:
import itertools,math
n = int(input())
word = [input() for _ in range(n)]
count = 0

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(n):
    word[i] = sorted(word[i])

new_word = list(sorted(word))

x = 1

for i in range(n-1):
    if new_word[i] == new_word[i+1]:
        x += 1
    elif x >= 2:
        count += combinations_count(x,2)
        x = 1
if x >= 2:
    count +=  combinations_count(x,2)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
word = [input() for _ in range(n)]
count = 0

for i in range(n-1):
    for j in range(i+1,n):
        a = sorted(word[i])
        b = sorted(word[j])
        if a == b:
            count += 1

print(count)


Fixed submission:
import itertools,math
n = int(input())
word = [input() for _ in range(n)]
count = 0

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(n):
    word[i] = sorted(word[i])

new_word = list(sorted(word))

x = 1

for i in range(n-1):
    if new_word[i] == new_word[i+1]:
        x += 1
    elif x >= 2:
        count += combinations_count(x,2)
        x = 1
if x >= 2:
    count +=  combinations_count(x,2)

print(count)