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

import itertools
word_list=[]
num_list=[]
for word in S:
  word=''.join(sorted(word))
  word_list.append(word)
  word_set=set(word_list)
  
for word in word_set:
  num = len(list(itertools.combinations(range(word_list.count(word)),2)))
  num_list.append(num)
print(sum(num_list))

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

list = {}
for i in S:
  i=''.join(sorted(i))
  if i in list:
    list[i] = list[i] + 1
  else:
    list[i] = 1

count = 0
for i in list.values():
  n = i - 1
  count = count + int(((n * (n + 1)) / 2))
  
print(count)

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

import itertools
word_list=[]
for word in S:
  word=''.join(sorted(word))
  word_list.append(word)
word_set=set(word_list)

num_list=[]
for word in word_set:
  num = len(list(itertools.combinations(range(word_list.count(word)),2)))
  num_list.append(num)
print(sum(num_list))

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

list = {}
for i in S:
  i=''.join(sorted(i))
  if i in list:
    list[i] = list[i] + 1
  else:
    list[i] = 1

count = 0
for i in list.values():
  n = i - 1
  count = count + int(((n * (n + 1)) / 2))
  
print(count)

Buggy python submission (verdict: Runtime Error):
word_dict={}
for word in S:
  word=''.join(sorted(word))
  if word in word_dict.keys() and word_dict[word]==0:#2nd
    word_dict[word] = word_dict[word]+1
  elif word in word_dict.keys() and word_dict[word]==1:#3rd
    word_dict[word]= word_dict[word]+2
  elif word in word_dict.keys() and word_dict[word]==3:#4th
    word_dict[word]= word_dict[word]+3
  elif word in word_dict.keys() and word_dict[word]==6:#5th
    word_dict[word]= word_dict[word]+4
  elif word in word_dict.keys() and word_dict[word]==10:#6th
    word_dict[word]= word_dict[word]+5
  elif word in word_dict.keys() and word_dict[word]==15:#7th
    word_dict[word]= word_dict[word]+6
  else:
    word_dict[word] = 0
print(word_dict)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

list = {}
for i in S:
  i=''.join(sorted(i))
  if i in list:
    list[i] = list[i] + 1
  else:
    list[i] = 1

count = 0
for i in list.values():
  n = i - 1
  count = count + int(((n * (n + 1)) / 2))
  
print(count)

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

word_list=list(map(lambda x: ''.join(sorted(x)),S))

import itertools
word_set=set(word_list)
total_counts=[]
for word in word_set:
  num = len(list(itertools.combinations(range(word_list.count(word)),2)))
  total_counts.append(num)
  
print(sum(total_counts))

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

list = {}
for i in S:
  i=''.join(sorted(i))
  if i in list:
    list[i] = list[i] + 1
  else:
    list[i] = 1

count = 0
for i in list.values():
  n = i - 1
  count = count + int(((n * (n + 1)) / 2))
  
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [input() for i in range(N)]
word_list=[]
for w in S:
  sort_word=''.join(sorted(w))
  word_list.append(sort_word)
word_list.sort()

import itertools
word_set=set(word_list)
total_counts=[]
for word in word_set:
  num = len(list(itertools.combinations(range(word_list.count(word)),2)))
  total_counts.append(num)
  
print(sum(total_counts))

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

list = {}
for i in S:
  i=''.join(sorted(i))
  if i in list:
    list[i] = list[i] + 1
  else:
    list[i] = 1

count = 0
for i in list.values():
  n = i - 1
  count = count + int(((n * (n + 1)) / 2))
  
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [input() for i in range(N)]
word_list=[]
for w in S:
  sort_word=''.join(sorted(w))
  word_list.append(sort_word)
word_list.sort()

import itertools
word_set=set(word_list)
count_list=[]
for word in word_set:
  count_list.append(word_list.count(word))

total_counts=[]
for num in count_list:
  total_counts.append(len(list(itertools.combinations(range(num),2))))
  
print(sum(total_counts))

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

list = {}
for i in S:
  i=''.join(sorted(i))
  if i in list:
    list[i] = list[i] + 1
  else:
    list[i] = 1

count = 0
for i in list.values():
  n = i - 1
  count = count + int(((n * (n + 1)) / 2))
  
print(count)