Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from sys import stdin

n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip() for _ in range(n)]
new = []
for i in range(n):
    sort = sorted(data[i])
    sorting = "".join(sort)
    new.append(sorting)
new.sort()
score = 0
s = 0
count  = 0
while s<n-1:
    daburi = 1
    stop = 0
    for p in range(s,n-1):
        if new[p] == new[p+1] and stop == 0:
            daburi += 1
        else:
            stop += 1
    score += daburi*(daburi-1)//2
    count += daburi
    s = count
print(score)


Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin

n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip() for _ in range(n)]
new = []
for i in range(n):
    sort = sorted(data[i])
    sorting = "".join(sort)
    new.append(sorting)
new.sort()
score = 0
s = 0
count  = 0
while s<n-1:
    daburi = 1
    for p in range(s,n-1):
        if new[p] == new[p+1]:
            daburi += 1
        else:
            break
    score += daburi*(daburi-1)//2
    count += daburi
    s = count
print(score)

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from sys import stdin

n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip() for _ in range(n)]
new = []
for i in range(n):
    sort = sorted(data[i])
    sorting = "".join(sort)
    new.append(sorting)
new.sort()
score = 0
news = list(set(new))
for s in range(len(news)):
    k = new.count(news[s])
    score += int((k-1)*k/2)
print(score)


Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin

n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip() for _ in range(n)]
new = []
for i in range(n):
    sort = sorted(data[i])
    sorting = "".join(sort)
    new.append(sorting)
new.sort()
score = 0
s = 0
count  = 0
while s<n-1:
    daburi = 1
    for p in range(s,n-1):
        if new[p] == new[p+1]:
            daburi += 1
        else:
            break
    score += daburi*(daburi-1)//2
    count += daburi
    s = count
print(score)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(str(input()) for i in range(n))
gou = []
count = 0
for g in range(len(li)):
    lis = []
    for k in range(len(li[g])):
        lis.append(li[g][k])
    lis.sort()
    gou.append(lis)
for p in range(len(gou)):
    for u in range(len(gou)):
        if gou[p] == gou[u] and p!=u:
            count += 1
print(count//2)

Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin

n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip() for _ in range(n)]
new = []
for i in range(n):
    sort = sorted(data[i])
    sorting = "".join(sort)
    new.append(sorting)
new.sort()
score = 0
s = 0
count  = 0
while s<n-1:
    daburi = 1
    for p in range(s,n-1):
        if new[p] == new[p+1]:
            daburi += 1
        else:
            break
    score += daburi*(daburi-1)//2
    count += daburi
    s = count
print(score)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(str(input()) for i in range(n))
gou = []
for g in range(len(li)):
    lis = []
    moji = ""
    for k in range(len(li[g])):
        lis.append(li[g][k])
    lis.sort()
    for m in range(len(lis)):
        moji += lis[m]
    gou.append(moji)
v = list(set(gou))
cou = 0
for y in range(len(v)):
    num = gou.count(v[y])
    cou += num*(num-1)//2
print(cou)

Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin

n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip() for _ in range(n)]
new = []
for i in range(n):
    sort = sorted(data[i])
    sorting = "".join(sort)
    new.append(sorting)
new.sort()
score = 0
s = 0
count  = 0
while s<n-1:
    daburi = 1
    for p in range(s,n-1):
        if new[p] == new[p+1]:
            daburi += 1
        else:
            break
    score += daburi*(daburi-1)//2
    count += daburi
    s = count
print(score)