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

N = int(input())
words = [Counter(input()) for _ in range(N)]
ans = 0
def get_unique_list(seq):
    seen = []
    return [seq.count(x) for x in seq if x not in seen and not seen.append(x) and seq.count(x) != 1]

# counters_counts = [words.count(x) for x in get_unique_list(words) if words.count(x) > 1]

for count in get_unique_list(words):
    ans += int((count * (count-1)) / 2)
print(ans)

Fixed submission:
from collections import Counter

class hashabledict(dict):
    def __hash__(self):
        return hash(tuple(sorted(self.items())))

N = int(input())
words = [hashabledict(dict(Counter(input()))) for _ in range(N)]
ans = 0
counter_hash = {}
for counter in words:
    if counter not in counter_hash.keys():
        counter_hash[counter] = 1
    else:
        counter_hash[counter] += 1
 
for count in counter_hash.values():
    ans += int((count * (count-1)) / 2)
print(ans)

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

N = int(input())
words = [Counter(input()) for _ in range(N)]
ans = 0
def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]

counters_counts = [words.count(x) for x in get_unique_list(words) if words.count(x) > 1]

for count in counters_counts:
    ans += int((count * (count-1)) / 2)
print(ans)

Fixed submission:
from collections import Counter

class hashabledict(dict):
    def __hash__(self):
        return hash(tuple(sorted(self.items())))

N = int(input())
words = [hashabledict(dict(Counter(input()))) for _ in range(N)]
ans = 0
counter_hash = {}
for counter in words:
    if counter not in counter_hash.keys():
        counter_hash[counter] = 1
    else:
        counter_hash[counter] += 1
 
for count in counter_hash.values():
    ans += int((count * (count-1)) / 2)
print(ans)

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

N = int(input())
words = [Counter(input()) for _ in range(N)]
ans = 0
counters = []
counters_counts = []
for counter in words:
    try:
        idx = counters.index(counter)
        counters_counts[idx] += 1
    except ValueError:
        counters.append(counter)
        counters_counts.append(1)

for count in counters_counts:
    ans += int((count * (count-1)) / 2)
print(ans)

Fixed submission:
from collections import Counter

class hashabledict(dict):
    def __hash__(self):
        return hash(tuple(sorted(self.items())))

N = int(input())
words = [hashabledict(dict(Counter(input()))) for _ in range(N)]
ans = 0
counter_hash = {}
for counter in words:
    if counter not in counter_hash.keys():
        counter_hash[counter] = 1
    else:
        counter_hash[counter] += 1
 
for count in counter_hash.values():
    ans += int((count * (count-1)) / 2)
print(ans)

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

N = int(input())
words = [Counter(input()) for _ in range(N)]
ans = 0
while True:
    if not words:
        break
    target = words.pop(0)
    same_word_index = [i for i, word in enumerate(words) if target == word]
    loop_sum = len(same_word_index)
    # 同じやつをリストから消す
    [words.pop(index) for index in reversed(same_word_index)]
    # 合計に加算
    ans += int((loop_sum * (loop_sum+1)) / 2)
    
    # 後ろからも
    if not words:
        break
    target = words.pop()
    same_word_index = [i for i, word in enumerate(words) if target == word]
    loop_sum = len(same_word_index)
    # 同じやつをリストから消す
    [words.pop(index) for index in reversed(same_word_index)]
    # 合計に加算
    ans += int((loop_sum * (loop_sum+1)) / 2)

print(ans)

Fixed submission:
from collections import Counter

class hashabledict(dict):
    def __hash__(self):
        return hash(tuple(sorted(self.items())))

N = int(input())
words = [hashabledict(dict(Counter(input()))) for _ in range(N)]
ans = 0
counter_hash = {}
for counter in words:
    if counter not in counter_hash.keys():
        counter_hash[counter] = 1
    else:
        counter_hash[counter] += 1
 
for count in counter_hash.values():
    ans += int((count * (count-1)) / 2)
print(ans)

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

def verify_counters(first, second):
    return first == second

N = int(input())
words = [Counter(input()) for _ in range(N)]
ans = 0
while True:
    if not words:
        break
    target = words.pop(0)
    same_word_index = []
    loop_sum = 0
    for i, word in enumerate(words):
        if verify_counters(target, word):
            same_word_index.append(i)
            loop_sum += 1
    # 同じやつをリストから消す
    if same_word_index:
        for index in reversed(same_word_index):
            words.pop(index)
    # 合計に加算
    ans += int((loop_sum * (loop_sum+1)) / 2)
    
    # 後ろからも
    if not words:
        break
    target = words.pop()
    same_word_index = []
    loop_sum = 0
    for i, word in enumerate(words):
        if verify_counters(target, word):
            same_word_index.append(i)
            loop_sum += 1
    # 同じやつをリストから消す
    if same_word_index:
        for index in reversed(same_word_index):
            words.pop(index)
    # 合計に加算
    ans += int((loop_sum * (loop_sum+1)) / 2)

print(ans)

Fixed submission:
from collections import Counter

class hashabledict(dict):
    def __hash__(self):
        return hash(tuple(sorted(self.items())))

N = int(input())
words = [hashabledict(dict(Counter(input()))) for _ in range(N)]
ans = 0
counter_hash = {}
for counter in words:
    if counter not in counter_hash.keys():
        counter_hash[counter] = 1
    else:
        counter_hash[counter] += 1
 
for count in counter_hash.values():
    ans += int((count * (count-1)) / 2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
 
def verify_anagrams(first_word, second_word):
    def get_counter(s):
        return Counter(s)
 
    return get_counter(first_word) == get_counter(second_word)

N = int(input())
words = [input() for _ in range(N)]
ans = 0
while True:
    if not words:
        break
    target = words.pop(0)
    same_word_index = []
    loop_sum = 0
    for i, word in enumerate(words):
        if verify_anagrams(target, word):
            same_word_index.append(i)
            loop_sum += 1
    # 同じやつをリストから消す
    if same_word_index:
        for index in reversed(same_word_index):
            words.pop(index)
    # 合計に加算
    ans += int((loop_sum * (loop_sum+1)) / 2)
    
    # 後ろからも
    if not words:
        break
    target = words.pop()
    same_word_index = []
    loop_sum = 0
    for i, word in enumerate(words):
        if verify_anagrams(target, word):
            same_word_index.append(i)
            loop_sum += 1
    # 同じやつをリストから消す
    if same_word_index:
        for index in reversed(same_word_index):
            words.pop(index)
    # 合計に加算
    ans += int((loop_sum * (loop_sum+1)) / 2)

print(ans)

Fixed submission:
from collections import Counter

class hashabledict(dict):
    def __hash__(self):
        return hash(tuple(sorted(self.items())))

N = int(input())
words = [hashabledict(dict(Counter(input()))) for _ in range(N)]
ans = 0
counter_hash = {}
for counter in words:
    if counter not in counter_hash.keys():
        counter_hash[counter] = 1
    else:
        counter_hash[counter] += 1
 
for count in counter_hash.values():
    ans += int((count * (count-1)) / 2)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
 
def verify_anagrams(first_word, second_word):
    def get_counter(s):
        return Counter(s)
 
    return get_counter(first_word) == get_counter(second_word)

N = int(input())
words = [input() for _ in range(N)]
ans = 0
while True:
    if not words:
        break
    target = words.pop(0)
    same_word_index = []
    loop_sum = 0
    for i, word in enumerate(words):
        if verify_anagrams(target, word):
            same_word_index.append(i)
            loop_sum += 1
    # 同じやつをリストから消す
    if same_word_index:
        for index in reversed(same_word_index):
            words.pop(index)
    # 合計に加算
    ans += int((loop_sum * (loop_sum+1)) / 2)

print(ans)

Fixed submission:
from collections import Counter

class hashabledict(dict):
    def __hash__(self):
        return hash(tuple(sorted(self.items())))

N = int(input())
words = [hashabledict(dict(Counter(input()))) for _ in range(N)]
ans = 0
counter_hash = {}
for counter in words:
    if counter not in counter_hash.keys():
        counter_hash[counter] = 1
    else:
        counter_hash[counter] += 1
 
for count in counter_hash.values():
    ans += int((count * (count-1)) / 2)
print(ans)