Buggy python submission (verdict: Runtime Error):
N=int(input())
l=[]
for x in range(0,N):
    l.append(input())
for x in range(0,N):
    l[x]=sorted(list(l[x]))
l=sorted[l]
x=0
y=0
for i in range(0,N):
    for j in range(i+1,N):
        if l[i]==l[j]:
            x=x+1
        else:
            y=y+sum(range(1,x+1))
            i=i+x+1
            break
print(y)

Fixed submission:
N=int(input())
l=[]
for x in range(0,N):
    l.append(input())
for x in range(N):
    k=list(l[x])
    k.sort()
    k=''.join(k)
    l[x]=k
l.sort()
k=1
ans=0
for i in range(N-1):
    if l[i]==l[i+1]:
        k+=1
    else:
        ans+=k*(k-1)//2
        k=1
ans+=k*(k-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
l=[]
for x in range(0,N):
    l.append(input())
for x in range(0,N):
    l[x]=sorted(list(l[x]))
ans=0
for i in range(0,N):
    for j in range(i+1,N):
        if l[i]==l[j]:
            ans=ans+1
print(ans)

Fixed submission:
N=int(input())
l=[]
for x in range(0,N):
    l.append(input())
for x in range(N):
    k=list(l[x])
    k.sort()
    k=''.join(k)
    l[x]=k
l.sort()
k=1
ans=0
for i in range(N-1):
    if l[i]==l[i+1]:
        k+=1
    else:
        ans+=k*(k-1)//2
        k=1
ans+=k*(k-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
l=[]
for x in range(0,N):
    l.append(input())
A=[[0 for i in range(10)] for j in range(N)]
B=[[0 for i in range(10)] for j in range(N)]
for i in range(0,N):
    for j in range(0,10):
        if l[i][j]=='a':
            A[i][j]=0
        elif l[i][j]=='b':
            A[i][j]=1
        elif l[i][j]=='c':
            A[i][j]=2
        elif l[i][j]=='d':
            A[i][j]=3
        elif l[i][j]=='e':
            A[i][j]=4
        elif l[i][j]=='f':
            A[i][j]=5
        elif l[i][j]=='g':
            A[i][j]=6
        elif l[i][j]=='h':
            A[i][j]=7
        elif l[i][j]=='i':
            A[i][j]=8
        elif l[i][j]=='j':
            A[i][j]=9
        elif l[i][j]=='k':
            A[i][j]=10
        elif l[i][j]=='l':
            A[i][j]=11
        elif l[i][j]=='m':
            A[i][j]=12
        elif l[i][j]=='n':
            A[i][j]=13
        elif l[i][j]=='o':
            A[i][j]=14
        elif l[i][j]=='p':
            A[i][j]=15
        elif l[i][j]=='q':
            A[i][j]=16
        elif l[i][j]=='r':
            A[i][j]=17
        elif l[i][j]=='s':
            A[i][j]=18
        elif l[i][j]=='t':
            A[i][j]=19
        elif l[i][j]=='u':
            A[i][j]=20
        elif l[i][j]=='v':
            A[i][j]=21
        elif l[i][j]=='w':
            A[i][j]=22
        elif l[i][j]=='x':
            A[i][j]=23
        elif l[i][j]=='y':
            A[i][j]=24
        else:
            A[i][j]=25
    B[i]=sorted(A[i])
ans=0
for i in range(0,N):
    for j in range(i+1,N):
        if B[i]==B[j]:
            ans=ans+1
print(ans)


Fixed submission:
N=int(input())
l=[]
for x in range(0,N):
    l.append(input())
for x in range(N):
    k=list(l[x])
    k.sort()
    k=''.join(k)
    l[x]=k
l.sort()
k=1
ans=0
for i in range(N-1):
    if l[i]==l[i+1]:
        k+=1
    else:
        ans+=k*(k-1)//2
        k=1
ans+=k*(k-1)//2
print(ans)