Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

n = int(input())
list1 = [''.join(sorted(input())) for i in range(n)]
dict1 = dict()
cout = 0
@lru_cache(maxsize = None)
def func(s):
	if s == 2:
		return 1 #2個の場合は1パターン
	return s-1 + func(s-1)

for i in range(n):
	if list1[i] in dict1:
		dict1[list1[i]] += 1
	else:
		dict1[list1[i]] = 1

for i in dict1:
	if dict1[i] != 1:
		cout += func(dict1[i])

print(cout)

Fixed submission:
from functools import lru_cache
import sys
sys.setrecursionlimit(1000000)
n = int(input())
list1 = [''.join(sorted(input())) for i in range(n)]
dict1 = dict()
cout = 0
@lru_cache(maxsize = None)
def func(s):
	if s == 2:
		return 1 #2個の場合は1パターン
	return s-1 + func(s-1)

for i in range(n):
	if list1[i] in dict1:
		dict1[list1[i]] += 1
	else:
		dict1[list1[i]] = 1

for i in dict1:
	if dict1[i] != 1:
		cout += func(dict1[i])

print(cout)

Buggy python submission (verdict: Runtime Error):
from functools import lru_cache

n = int(input())
list1 = [''.join(sorted(input())) for i in range(n)]
dict1 = dict()
cout = 0
@lru_cache(maxsize = None)
def func(s):
	if s == 2:
		return 1 #2個の場合は1パターン
	return s-1 + func(s-1)

for i in range(n):
	if list1[i] in dict1:
		dict1[list1[i]] += 1
	else:
		dict1[list1[i]] = 1

for i in dict1:
	if dict1[i] != 1:
		cout += func(dict1[i])

print(cout)

Fixed submission:
from functools import lru_cache
import sys
sys.setrecursionlimit(1000000)
n = int(input())
list1 = [''.join(sorted(input())) for i in range(n)]
dict1 = dict()
cout = 0
@lru_cache(maxsize = None)
def func(s):
	if s == 2:
		return 1 #2個の場合は1パターン
	return s-1 + func(s-1)

for i in range(n):
	if list1[i] in dict1:
		dict1[list1[i]] += 1
	else:
		dict1[list1[i]] = 1

for i in dict1:
	if dict1[i] != 1:
		cout += func(dict1[i])

print(cout)

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
n = int(input())
list1 = [list(list(input())) for i in range(n)]
list2 = []
cout = 0

def combinations_count(n,r):
    """組み合わせnCr"""
    return factorial(n) // (factorial(n-r)*factorial(r))

for i in range(n):
    list1[i].sort()
    if list1[i] in list2:
        list2[list2.index(list1[i])+1].append(1)
    else:
        list2.append(list(list1[i]))
        list2.append([1])

for i in range(1,len(list2),2):
    if len(list2[i]) != 1:
        cout += combinations_count(sum(list2[i]),2)
print(cout)


Fixed submission:
from functools import lru_cache
import sys
sys.setrecursionlimit(1000000)
n = int(input())
list1 = [''.join(sorted(input())) for i in range(n)]
dict1 = dict()
cout = 0
@lru_cache(maxsize = None)
def func(s):
	if s == 2:
		return 1 #2個の場合は1パターン
	return s-1 + func(s-1)

for i in range(n):
	if list1[i] in dict1:
		dict1[list1[i]] += 1
	else:
		dict1[list1[i]] = 1

for i in dict1:
	if dict1[i] != 1:
		cout += func(dict1[i])

print(cout)

Buggy python submission (verdict: Time Limit Exceeded):
from math import factorial
n = int(input())
list1 = [list(list(input())) for i in range(n)]
list2 = []
cout = 0

def combinations_count(n,r):
    """組み合わせnCr"""
    return factorial(n) // (factorial(n-r)*factorial(r))

for i in range(n):
    list1[i].sort()
    if list1[i] in list2:
        list2[list2.index(list1[i])+1].append(1)
    else:
        list2.append(list(list1[i]))
        list2.append([1])

for i in range(1,len(list2),2):
    if len(list2[i]) != 1:
        cout += combinations_count(sum(list2[i]),2)
print(cout)


Fixed submission:
from functools import lru_cache
import sys
sys.setrecursionlimit(1000000)
n = int(input())
list1 = [''.join(sorted(input())) for i in range(n)]
dict1 = dict()
cout = 0
@lru_cache(maxsize = None)
def func(s):
	if s == 2:
		return 1 #2個の場合は1パターン
	return s-1 + func(s-1)

for i in range(n):
	if list1[i] in dict1:
		dict1[list1[i]] += 1
	else:
		dict1[list1[i]] = 1

for i in dict1:
	if dict1[i] != 1:
		cout += func(dict1[i])

print(cout)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n = int(input())
s = []
for i in range(n):
    s.append(input())
"""
def func(seq):
    seen = []
    list2 = [x for x in seq if x not in seen and not seen.append(x)]
    return len(list2)
"""
count = 0
list1 = []
for i in range(n):
    list1.append(Counter(s[i]))
for i in range(n-1):
    for j in range(i+1,n):
        if list1[i] == list1[j] and i != j:
            count += 1
print(count)


Fixed submission:
from functools import lru_cache
import sys
sys.setrecursionlimit(1000000)
n = int(input())
list1 = [''.join(sorted(input())) for i in range(n)]
dict1 = dict()
cout = 0
@lru_cache(maxsize = None)
def func(s):
	if s == 2:
		return 1 #2個の場合は1パターン
	return s-1 + func(s-1)

for i in range(n):
	if list1[i] in dict1:
		dict1[list1[i]] += 1
	else:
		dict1[list1[i]] = 1

for i in dict1:
	if dict1[i] != 1:
		cout += func(dict1[i])

print(cout)