Buggy python submission (verdict: Runtime Error):
#coding: utf-8

from math import factorial
N = int(input())

s_list = []
for i in range(N):
    input_string = list(input())
    input_string.sort()
    input_string = "".join(input_string)
    s_list.append(input_string)

count = 0
s_list.sort()
tmp_count = 0
for i in range(1, len(s_list)):
    if s_list[i-1] == s_list[i]:
        tmp_count = tmp_count + 1
    else:
        if tmp_count == 0:
            pass
        else:
            tmp_count = tmp_count + 1
            count = count + int(factorial(tmp_count) / factorial(2) / factorial(tmp_count - 2))
        tmp_count = 0

if tmp_count == 0:
    pass
else:
    tmp_count = tmp_count + 1
    count = count + int(factorial(tmp_count) / factorial(2) / factorial(tmp_count - 2))

print(count)


Fixed submission:
#coding: utf-8

from collections import Counter
N = int(input())

s_list = []
for i in range(N):
    input_string = list(input())
    input_string.sort()
    input_string = "".join(input_string)
    s_list.append(input_string)

s_list.sort()

list_counter = Counter(s_list)

count = 0
for key in list_counter.keys():
    tmp_count = list_counter[key]
    if tmp_count < 2:
        pass
    elif tmp_count == 2:
        count += 1
    else:
        permutations = tmp_count * (tmp_count - 1)
        combination = permutations/2
        count += int(combination)

print(int(count))

Buggy python submission (verdict: Time Limit Exceeded):
#coding: utf-8

N = int(input())


s_list = []
for i in range(N):
    input_string = list(input())
    input_string.sort()
    s_list.append(input_string)

count = 0
s_list.sort()
while len(s_list) != 0:
    for i in range(1, len(s_list)):
        if s_list[0] == s_list[i]:
            count = count + 1
        else:
            break

    del(s_list[0])
print(count)


Fixed submission:
#coding: utf-8

from collections import Counter
N = int(input())

s_list = []
for i in range(N):
    input_string = list(input())
    input_string.sort()
    input_string = "".join(input_string)
    s_list.append(input_string)

s_list.sort()

list_counter = Counter(s_list)

count = 0
for key in list_counter.keys():
    tmp_count = list_counter[key]
    if tmp_count < 2:
        pass
    elif tmp_count == 2:
        count += 1
    else:
        permutations = tmp_count * (tmp_count - 1)
        combination = permutations/2
        count += int(combination)

print(int(count))

Buggy python submission (verdict: Time Limit Exceeded):
#coding: utf-8

N = int(input())


s_list = []
for i in range(N):
    input_string = input()
    tmp_list = []
    for s in input_string:
        tmp_list.append(s)
    tmp_list.sort()
    sorted_string = ""
    for s in tmp_list:
        sorted_string = sorted_string + s
    s_list.append(sorted_string)


count = 0
s_list.sort()
while len(s_list) != 0:
    for i in range(1, len(s_list)):
        if s_list[0] == s_list[i]:
            count = count + 1
        else:
            break

    del(s_list[0])
print(count)


Fixed submission:
#coding: utf-8

from collections import Counter
N = int(input())

s_list = []
for i in range(N):
    input_string = list(input())
    input_string.sort()
    input_string = "".join(input_string)
    s_list.append(input_string)

s_list.sort()

list_counter = Counter(s_list)

count = 0
for key in list_counter.keys():
    tmp_count = list_counter[key]
    if tmp_count < 2:
        pass
    elif tmp_count == 2:
        count += 1
    else:
        permutations = tmp_count * (tmp_count - 1)
        combination = permutations/2
        count += int(combination)

print(int(count))

Buggy python submission (verdict: Time Limit Exceeded):
#coding: utf-8

N = int(input())


s_list = []
for i in range(N):
    input_string = input()
    tmp_list = []
    for s in input_string:
        tmp_list.append(s)
    tmp_list.sort()
    sorted_string = ""
    for s in tmp_list:
        sorted_string = sorted_string + s
    s_list.append(sorted_string)


count = 0

while len(s_list) != 0:
    for i in range(1, len(s_list)):
        if s_list[0] == s_list[i]:
            count = count + 1

    del(s_list[0])
print(count)


Fixed submission:
#coding: utf-8

from collections import Counter
N = int(input())

s_list = []
for i in range(N):
    input_string = list(input())
    input_string.sort()
    input_string = "".join(input_string)
    s_list.append(input_string)

s_list.sort()

list_counter = Counter(s_list)

count = 0
for key in list_counter.keys():
    tmp_count = list_counter[key]
    if tmp_count < 2:
        pass
    elif tmp_count == 2:
        count += 1
    else:
        permutations = tmp_count * (tmp_count - 1)
        combination = permutations/2
        count += int(combination)

print(int(count))