Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ls = [sorted(list(input())) for i in range(N)]
print(sum([ls[i:N].count(x)-1 for i, x in enumerate(ls)]))

Fixed submission:
N = int(input())
s = [''.join(sorted(input().rstrip())) for _ in range(N)]

memo = {}
for x in s:
    if x not in memo:
        memo[x] = 1
    else:
        memo[x] += 1

print(sum(x*(x-1)//2 for x in memo.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ls = [sorted(list(input())) for i in range(N)]
print(sum([ls[i:N].count(ls[i])-1 for i in range(N)]))

Fixed submission:
N = int(input())
s = [''.join(sorted(input().rstrip())) for _ in range(N)]

memo = {}
for x in s:
    if x not in memo:
        memo[x] = 1
    else:
        memo[x] += 1

print(sum(x*(x-1)//2 for x in memo.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
ls = [sorted(list(input())) for i in range(N)]
print(sum([ls[i:N].count(ls[i])-1 for i in range(N)]))

Fixed submission:
N = int(input())
s = [''.join(sorted(input().rstrip())) for _ in range(N)]

memo = {}
for x in s:
    if x not in memo:
        memo[x] = 1
    else:
        memo[x] += 1

print(sum(x*(x-1)//2 for x in memo.values()))

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

hoge = 0
for i in range(N):
    hoge+=ls[i:N].count(ls[i])-1
print(hoge)

Fixed submission:
N = int(input())
s = [''.join(sorted(input().rstrip())) for _ in range(N)]

memo = {}
for x in s:
    if x not in memo:
        memo[x] = 1
    else:
        memo[x] += 1

print(sum(x*(x-1)//2 for x in memo.values()))

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

hoge = 0
for i in range(N):
    hoge+=ls[i:N].count(ls[i])-1
print(hoge)

Fixed submission:
N = int(input())
s = [''.join(sorted(input().rstrip())) for _ in range(N)]

memo = {}
for x in s:
    if x not in memo:
        memo[x] = 1
    else:
        memo[x] += 1

print(sum(x*(x-1)//2 for x in memo.values()))

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

hoge = 0
for i in range(N):
    hoge += sum([1 if x==ls[i] else 0 for x in ls[i:N]]) - 1
print(hoge)

Fixed submission:
N = int(input())
s = [''.join(sorted(input().rstrip())) for _ in range(N)]

memo = {}
for x in s:
    if x not in memo:
        memo[x] = 1
    else:
        memo[x] += 1

print(sum(x*(x-1)//2 for x in memo.values()))

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

hoge = 0
for i in range(N):
    hoge += sum([1 if x==ls[i] else 0 for x in ls[i:len(ls)]]) - 1

print(hoge)

Fixed submission:
N = int(input())
s = [''.join(sorted(input().rstrip())) for _ in range(N)]

memo = {}
for x in s:
    if x not in memo:
        memo[x] = 1
    else:
        memo[x] += 1

print(sum(x*(x-1)//2 for x in memo.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

ls = [input() for i in range(N)]

ls = [sorted(list(s)) for s in ls]

hoge = 0
for i in range(N):
    hoge += sum([1 if x==ls[i] else 0 for x in ls[i:len(ls)]]) - 1

print(hoge)

Fixed submission:
N = int(input())
s = [''.join(sorted(input().rstrip())) for _ in range(N)]

memo = {}
for x in s:
    if x not in memo:
        memo[x] = 1
    else:
        memo[x] += 1

print(sum(x*(x-1)//2 for x in memo.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

ls = [input() for i in range(N)]

ls = [sorted(list(s)) for s in ls]

hoge = 0
for _ in range(N):
    hoge += sum([1 if x==ls[0] else 0 for x in ls]) - 1
    del ls[0]

print(hoge)

Fixed submission:
N = int(input())
s = [''.join(sorted(input().rstrip())) for _ in range(N)]

memo = {}
for x in s:
    if x not in memo:
        memo[x] = 1
    else:
        memo[x] += 1

print(sum(x*(x-1)//2 for x in memo.values()))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

ls = [input() for i in range(N)]

ls = [sorted(list(s)) for s in ls]

hoge = 0
for _ in range(N):
    hoge += sum([1 if x==ls[0] else 0 for x in ls]) - 1
    del ls[0]

print(hoge)

Fixed submission:
N = int(input())
s = [''.join(sorted(input().rstrip())) for _ in range(N)]

memo = {}
for x in s:
    if x not in memo:
        memo[x] = 1
    else:
        memo[x] += 1

print(sum(x*(x-1)//2 for x in memo.values()))