Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = []
c = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b:
      check = False
      b.append(strings)
      c[strings] = 1
    if check == True:
      ans += c[strings]
      c[strings] += 1

print(ans)

Fixed submission:
a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = []
c = []
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = sorted(list(input()))
    if strings not in b:
      check = False
      b.append(strings)
      c.append(1)
    if check == True:
      for j in range(len(b)):
          if b[j] == strings:
              ans += c[j]
              c[j] += 1

print(ans)

Fixed submission:
a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

print(ans)

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

a = int(input())
b = []
for _ in range(a):
  b.append(list(input()))

ans = 0
for i in range(a):
  for j in range(i+1, a):
    check = True
    if collections.Counter(b[i]) != collections.Counter(b[j]):
      check = False
    if check == True:
      ans += 1
print(ans)

Fixed submission:
a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = []
for _ in range(a):
  b.append(sorted(list(input())))

ans = 0
for i in range(a):
  for j in range(i+1, a):
    check = True
    if b[i] != b[j]:
      check = False
    if check == True:
      ans += 1
print(ans)

Fixed submission:
a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = []
for _ in range(a):
  b.append(sorted(list(input())))

ans = 0
for i in range(a):
  for j in range(i+1, a):
    check = True
    for k in range(10):
      if b[i] != b[j]:
        check = False
        break
    if check == True:
      ans += 1
print(ans)

Fixed submission:
a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = []
for _ in range(a):
  b.append(sorted(list(input())))

ans = 0
for i in range(a):
  for j in range(i+1, a):
    check = True
    for k in range(10):
      if b[i] != b[j]:
        check = False
        break
    if check == True:
      ans += 1
print(ans)

Fixed submission:
a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
b = []
for _ in range(a):
  b.append(sorted(list(input())))

ans = 0
for i in range(a):
  for j in range(i+1, a):
    check = True
    for k in range(10):
      if b[i] != b[j]:
        check = False
    if check == True:
      ans += 1
print(ans)

Fixed submission:
a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = []
for _ in range(a):
  b.append(sorted(list(input())))

for i in range(a):
  for j in range(i+1, a):
    check = True
    for k in range(10):
      if b[i] != b[j]:
        check = False
    if check = True:
      ans += 1
print(ans)

Fixed submission:
a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

print(ans)