Buggy python submission (verdict: Runtime Error):
N = int(input())
texts = []
for i in range(N):
    texts.append((input()))

import collections
counters = []
count = 0
for text in texts:
    text_list = list(text)
    text_list.sort()
    text = "".join(text_list) 
    c = collections.Counter(text)
    counters.append(c)



ccccc = []
anss = 0
for ccc in counters:
    ccc = str(ccc)
    ccccc.append(ccc)
    

dd = collections.Counter(ccccc)
for v in dd.values():
    ans = v * (v-1) / 2
    anss.append(ans)
    
print(int(sum(anss)))

Fixed submission:
N = int(input())
texts = []
for i in range(N):
    texts.append((input()))

import collections
counters = []
count = 0
for text in texts:
    text_list = list(text)
    text_list.sort()
    text = "".join(text_list) 
    c = collections.Counter(text)
    counters.append(c)



ccccc = []
anss = []
for ccc in counters:
    ccc = str(ccc)
    ccccc.append(ccc)
    

dd = collections.Counter(ccccc)
for v in dd.values():
    ans = v * (v-1) / 2
    anss.append(ans)
    
print(int(sum(anss)))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
texts = []
for i in range(N):
    texts.append((input()))
    
import collections

counters = []
count_dict = {}
count = 0
for text in texts:
    text_list = list(text)
    text_list.sort()
    text = "".join(text_list) 
    
    c = collections.Counter(text)
    name = str(c)
    if c in counters:
        count_dict[name] += 1
        
        
    else:
        count_dict[name] = 1
        counters.append(c)

anss = []
for v in count_dict.values():
    ans = v * (v-1) / 2
    anss.append(ans)
    
print(int(sum(anss)))

Fixed submission:
N = int(input())
texts = []
for i in range(N):
    texts.append((input()))

import collections
counters = []
count = 0
for text in texts:
    text_list = list(text)
    text_list.sort()
    text = "".join(text_list) 
    c = collections.Counter(text)
    counters.append(c)



ccccc = []
anss = []
for ccc in counters:
    ccc = str(ccc)
    ccccc.append(ccc)
    

dd = collections.Counter(ccccc)
for v in dd.values():
    ans = v * (v-1) / 2
    anss.append(ans)
    
print(int(sum(anss)))

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

N = int(input())
texts = []
for i in range(N):
    texts.append((input()))
    
counters = []
count = 0
for i in range(N):
    for j in range(0,i-1):
        if collections.Counter(texts[j]) == collections.Counter(texts[i]):
            count += 1
    else:
        continue
print(count)

Fixed submission:
N = int(input())
texts = []
for i in range(N):
    texts.append((input()))

import collections
counters = []
count = 0
for text in texts:
    text_list = list(text)
    text_list.sort()
    text = "".join(text_list) 
    c = collections.Counter(text)
    counters.append(c)



ccccc = []
anss = []
for ccc in counters:
    ccc = str(ccc)
    ccccc.append(ccc)
    

dd = collections.Counter(ccccc)
for v in dd.values():
    ans = v * (v-1) / 2
    anss.append(ans)
    
print(int(sum(anss)))

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

N = int(input())
texts = []
for i in range(N):
    texts.append((input()))
    

counters = []
count = 0
for text in texts:
    c = collections.Counter(text)
    for t in counters:
        if t == c:
            count += 1
    counters.append(c)
print(count)

Fixed submission:
N = int(input())
texts = []
for i in range(N):
    texts.append((input()))

import collections
counters = []
count = 0
for text in texts:
    text_list = list(text)
    text_list.sort()
    text = "".join(text_list) 
    c = collections.Counter(text)
    counters.append(c)



ccccc = []
anss = []
for ccc in counters:
    ccc = str(ccc)
    ccccc.append(ccc)
    

dd = collections.Counter(ccccc)
for v in dd.values():
    ans = v * (v-1) / 2
    anss.append(ans)
    
print(int(sum(anss)))