Buggy python submission (verdict: Time Limit Exceeded):
n = int(input().strip())

count_by_kw = {}
for i in range(n):
    s=''.join(sorted(input().strip()))
    if s in count_by_kw.keys():
        count_by_kw[s]+=1
    else:
        count_by_kw[s]=1

c=list(count_by_kw.values())
ans=0
for val in c:
    ans+=val*(val-1)//2

print(ans)

Fixed submission:
n = int(input().strip())

count_by_kw = {}
for i in range(n):
    s=''.join(sorted(input().strip()))
    if s in count_by_kw.keys():
        count_by_kw[s]+=1
    else:
        count_by_kw[s]=1

c=list(count_by_kw.values())
ans=0
for val in c:
    ans+=val*(val-1)//2

print(ans)

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

n = int(input().strip())

count_by_kw = Counter()
for i in range(n):
    s=str(sorted(input().strip()))
    count_by_kw[s]+=1

c=list(count_by_kw.values())
ans=0
for val in c:
    ans+=val*(val-1)//2
        
print(ans)

Fixed submission:
n = int(input().strip())

count_by_kw = {}
for i in range(n):
    s=''.join(sorted(input().strip()))
    if s in count_by_kw.keys():
        count_by_kw[s]+=1
    else:
        count_by_kw[s]=1

c=list(count_by_kw.values())
ans=0
for val in c:
    ans+=val*(val-1)//2

print(ans)

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

n = int(input().strip())

count_by_kw = Counter()
c=0
for i in range(n):
    s=str(sorted(input().strip()))
    if s in count_by_kw:
        c+=count_by_kw[s]
    count_by_kw[s]+=1
    
print(c)

Fixed submission:
n = int(input().strip())

count_by_kw = {}
for i in range(n):
    s=''.join(sorted(input().strip()))
    if s in count_by_kw.keys():
        count_by_kw[s]+=1
    else:
        count_by_kw[s]=1

c=list(count_by_kw.values())
ans=0
for val in c:
    ans+=val*(val-1)//2

print(ans)

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

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

n = int(input().strip())

count_by_kw = Counter()
for i in range(n):
    count_by_kw[str(sorted(input().strip()))]+=1
    
c=list(count_by_kw.values())
for i in range(len(c)):
    c[i]=combinations_count(c[i],2)
print(sum(c))

Fixed submission:
n = int(input().strip())

count_by_kw = {}
for i in range(n):
    s=''.join(sorted(input().strip()))
    if s in count_by_kw.keys():
        count_by_kw[s]+=1
    else:
        count_by_kw[s]=1

c=list(count_by_kw.values())
ans=0
for val in c:
    ans+=val*(val-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input().strip())
s=[sorted(input().strip()) for i in range(n)]

c=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(10):
            if s[i][k]!=s[j][k]:
                break
            if k==9:
                c+=1
print(c)

Fixed submission:
n = int(input().strip())

count_by_kw = {}
for i in range(n):
    s=''.join(sorted(input().strip()))
    if s in count_by_kw.keys():
        count_by_kw[s]+=1
    else:
        count_by_kw[s]=1

c=list(count_by_kw.values())
ans=0
for val in c:
    ans+=val*(val-1)//2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input().strip())
s=[sorted(input().strip()) for i in range(n)]

c=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(10):
            if s[i][k]!=s[j][k]:
                break
            if k==9:
                c+=1
print(c)

Fixed submission:
n = int(input().strip())

count_by_kw = {}
for i in range(n):
    s=''.join(sorted(input().strip()))
    if s in count_by_kw.keys():
        count_by_kw[s]+=1
    else:
        count_by_kw[s]=1

c=list(count_by_kw.values())
ans=0
for val in c:
    ans+=val*(val-1)//2

print(ans)