Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
mylist = []
for _ in range(n):
    s = input()
    s_list = [ c for c in s]
    mylist.append("".join(sorted(s_list)))

mylist2 = list(set(mylist))

ans=0
for i in range(len(mylist2)):
    count = mylist.count(mylist2[i])
    ans+=int(count*(count-1)/2)

print(ans)


Fixed submission:
n = int(input())
i = 0
sortedSet = {}
while i < n:
    temp = ''.join(sorted(input()))

    if temp in sortedSet:
        sortedSet[temp]+=1
    else:
        sortedSet[temp]=1
    i += 1

result = 0
for v in sortedSet.values():
    result = int(result + v*(v-1)/2)

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
mylist = []
for _ in range(n):
    s = input()
    s_list = [ c for c in s]
    mylist.append("".join(sorted(s_list)))

myset = set(mylist)
mylist2 = list(myset)

ans=0
for i in range(len(mylist2)):
    count = mylist.count(mylist2[i])
    mylist3 = list(range(count))
    ans += sum(mylist3)
    mylist.remove(mylist2[i])

print(ans)


Fixed submission:
n = int(input())
i = 0
sortedSet = {}
while i < n:
    temp = ''.join(sorted(input()))

    if temp in sortedSet:
        sortedSet[temp]+=1
    else:
        sortedSet[temp]=1
    i += 1

result = 0
for v in sortedSet.values():
    result = int(result + v*(v-1)/2)

print(result)

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

mylist = []
for s in l:
    s_list = [ c for c in s]
    mylist.append("".join(sorted(s_list)))

myset = set(mylist)
mylist2 = list(myset)

ans=0
for i in range(len(mylist2)):
    count = mylist.count(mylist2[i])
    mylist3 = list(range(count))
    ans += sum(mylist3)
    mylist.remove(mylist2[i])

print(ans)


Fixed submission:
n = int(input())
i = 0
sortedSet = {}
while i < n:
    temp = ''.join(sorted(input()))

    if temp in sortedSet:
        sortedSet[temp]+=1
    else:
        sortedSet[temp]=1
    i += 1

result = 0
for v in sortedSet.values():
    result = int(result + v*(v-1)/2)

print(result)

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

mylist = []
for s in l:
    s_list = [ c for c in s]
    mylist.append("".join(sorted(s_list)))

myset = set(mylist)
mylist2 = list(myset)

ans=0
for i in range(len(mylist2)):
    count = mylist.count(mylist2[i])
    mylist3 = list(range(count))
    ans += sum(mylist3)

print(ans)


Fixed submission:
n = int(input())
i = 0
sortedSet = {}
while i < n:
    temp = ''.join(sorted(input()))

    if temp in sortedSet:
        sortedSet[temp]+=1
    else:
        sortedSet[temp]=1
    i += 1

result = 0
for v in sortedSet.values():
    result = int(result + v*(v-1)/2)

print(result)

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

mylist = []
for s in l:
    s_list = [ c for c in s]
    mylist.append("".join(sorted(s_list)))

ans=0
for i in range(len(mylist)):
    ans += mylist.count(mylist[0]) - 1
    del mylist[0]

print(ans)

Fixed submission:
n = int(input())
i = 0
sortedSet = {}
while i < n:
    temp = ''.join(sorted(input()))

    if temp in sortedSet:
        sortedSet[temp]+=1
    else:
        sortedSet[temp]=1
    i += 1

result = 0
for v in sortedSet.values():
    result = int(result + v*(v-1)/2)

print(result)

Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [input() for i in range(n)]

mylist = []
for s in l:
    s_list = [ c for c in s]
    mylist.append("".join(sorted(s_list)))

ans=0
for i in range(len(mylist)):
    print(mylist)
    ans += mylist.count(mylist[0]) - 1
    del mylist[0]

print(ans)

Fixed submission:
n = int(input())
i = 0
sortedSet = {}
while i < n:
    temp = ''.join(sorted(input()))

    if temp in sortedSet:
        sortedSet[temp]+=1
    else:
        sortedSet[temp]=1
    i += 1

result = 0
for v in sortedSet.values():
    result = int(result + v*(v-1)/2)

print(result)

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

mylist = []
for s in l:
    s_list = [ c for c in s]
    mylist.append("".join(sorted(s_list)))

ans=0
for i in range(len(mylist)):
    for j in range(i+1, len(mylist)):
        if mylist[i] == mylist[j]:
            ans+=1
print(ans)

Fixed submission:
n = int(input())
i = 0
sortedSet = {}
while i < n:
    temp = ''.join(sorted(input()))

    if temp in sortedSet:
        sortedSet[temp]+=1
    else:
        sortedSet[temp]=1
    i += 1

result = 0
for v in sortedSet.values():
    result = int(result + v*(v-1)/2)

print(result)