Buggy python submission (verdict: Runtime Error):
N = int(input())
ana = {}
answer = 0

for i in range(N):
    s = sorted(input())
    new_str = ''.join(s)
    flag = 0

    try:
        k = ana.keys().index(new_str)y
        ana[k] += 1
        answer += ana[k]

    except:
        ana[new_str] = 0

print(answer)

Fixed submission:
N = int(input())
ana = {}
answer = 0

for i in range(N):
    s = sorted(input())
    new_str = ''.join(s)
    flag = 0

    if new_str in ana.keys():
        ana[new_str] += 1
        answer += ana[new_str]
        flag = 1

    if flag == 0:
        ana[new_str] = 0

print(answer)

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

N = int(input())
ana = {}
answer = 0

for i in range(N):
    s = sorted(input())
    new_str = ''.join(s)
    flag = 0

    for k in (ana.keys()):
        if new_str == k:
            ana[k] += 1
            answer += ana[k]
            flag = 1

    if flag == 0:
        ana[new_str] = 0

print(answer)

Fixed submission:
N = int(input())
ana = {}
answer = 0

for i in range(N):
    s = sorted(input())
    new_str = ''.join(s)
    flag = 0

    if new_str in ana.keys():
        ana[new_str] += 1
        answer += ana[new_str]
        flag = 1

    if flag == 0:
        ana[new_str] = 0

print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())

s = []
C = []
for i in range(n):                                                                                                                                                                                          
    a = input()                                                                                                                                                                                             
    b = str(a)                                                                                                                                                                                              
    d = sorted(b)                                                                                                                                                                                           
    s.append(d)                                                                                                                                                                                             
    # c = collections.Counter(s[i])                                                                                                                                                                         
    # C.append(c)                                                                                                                                                                                           

count = 0
for j in range(n-1):                                                                                                                                                                                        
    for k in range(j+1, n):                                                                                                                                                                                 
        # if C[j].items() == C[k].items():                                                                                                                                                                  
        if s[j] == s[k]:                                                                                                                                                                                    
            count += 1                                                                                                                                                                                      

print(count)


Fixed submission:
N = int(input())
ana = {}
answer = 0

for i in range(N):
    s = sorted(input())
    new_str = ''.join(s)
    flag = 0

    if new_str in ana.keys():
        ana[new_str] += 1
        answer += ana[new_str]
        flag = 1

    if flag == 0:
        ana[new_str] = 0

print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
import collections
n = int(input())

s = []
C = []
for i in range(n):                                                                                                                                                                                          
    s.append(input())                                                                                                                                                                                       
    c = collections.Counter(s[i])                                                                                                                                                                           
    C.append(c)                                                                                                                                                                                             

count = 0
for j in range(n-1):                                                                                                                                                                                        
    for k in range(j+1, n):                                                                                                                                                                                   
        if C[j].items() == C[k].items():                                                                                                                                                                    
            count += 1                                                                                                                                                                                      

print(count)

Fixed submission:
N = int(input())
ana = {}
answer = 0

for i in range(N):
    s = sorted(input())
    new_str = ''.join(s)
    flag = 0

    if new_str in ana.keys():
        ana[new_str] += 1
        answer += ana[new_str]
        flag = 1

    if flag == 0:
        ana[new_str] = 0

print(answer)