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

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

cnt = 0

N = int(input())
string_counters = []

cnt = dict()
for i in range(N):
    string = collections.Counter(input())
    if string not in string_counters:
        string_counters.append(string)
        cnt.setdefault(i, 1)
    else :
        cnt[string_counters.index(string)] += 1

output = 0
for k, v in cnt.items():
    if v == 1:
        pass
    else :
        output += combinations_count(v, 2)

print(output)


Fixed submission:
N = int(input())
cnt = dict()
output = 0

for i in range(N):
    string = ''.join(sorted(input()))
    cnt.setdefault(string, 0)
    output += cnt[string]
    cnt[string] += 1

print(output)

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

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

cnt = 0

N = int(input())
string_counters = []

cnt = dict()
for i in range(N):
    string = collections.Counter(input())
    if string not in string_counters:
        string_counters.append(string)
        cnt.setdefault(i, 1)
    else :
        cnt[string_counters.index(string)] += 1

output = 0
for k, v in cnt.items():
    output += combinations_count(v, 2)

print(output)


Fixed submission:
N = int(input())
cnt = dict()
output = 0

for i in range(N):
    string = ''.join(sorted(input()))
    cnt.setdefault(string, 0)
    output += cnt[string]
    cnt[string] += 1

print(output)

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

cnt = 0

N = int(input())
string_counters = []

cnt = dict()
for i in range(N):
    string = collections.Counter(input())
    if string not in string_counters:
        string_counters.append(string)
        cnt[i] = 1
    else :
        cnt[string_counters.index(string)] += 1

output = 0
for k, v in cnt.items():
    output += v - 1
print(output)

Fixed submission:
N = int(input())
cnt = dict()
output = 0

for i in range(N):
    string = ''.join(sorted(input()))
    cnt.setdefault(string, 0)
    output += cnt[string]
    cnt[string] += 1

print(output)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

cnt = 0

N = int(input())
string_counters = [collections.Counter(input()) for i in range(N)]

cnt = 0
for i in range(len(string_counters)-1):
    pattern_i = string_counters[i]
    for j in range(i+1, len(string_counters)):
        pattern_j = string_counters[j]
        if pattern_i == pattern_j:
            cnt += 1

print(cnt)

Fixed submission:
N = int(input())
cnt = dict()
output = 0

for i in range(N):
    string = ''.join(sorted(input()))
    cnt.setdefault(string, 0)
    output += cnt[string]
    cnt[string] += 1

print(output)

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

cnt = 0

N = int(input())
string_counters = [collections.Counter(input()) for i in range(N)]
for pair in list(itertools.combinations(string_counters, 2)):
    if pair[0] == pair[1]:
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
cnt = dict()
output = 0

for i in range(N):
    string = ''.join(sorted(input()))
    cnt.setdefault(string, 0)
    output += cnt[string]
    cnt[string] += 1

print(output)