Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
n = int(raw_input())
s = [ raw_input() for  _ in range(n) ]
x = [ ''.join(sorted(i)) for i in s ]
_x = sorted(x)
count = 0
for i in range(n-1):
    tmp = _x[i]
    for j in range(i+1,n):
        if tmp == _x[j]:
            count += 1
        else:
            break
print(count)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(raw_input())
d = {}
ans = 0
for i in range(n):
    si = ''.join(sorted(raw_input()))
    if si in d:
        ans += d[si]
        d[si] += 1
    else:
        d[si] = 1
print(ans)

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

n = int(raw_input())
s = [ raw_input() for i in range(n) ]

x = [ "".join(sorted(i)) for i in s ]
_x = sorted(x)
count = 0
for i in xrange(n-1):
    tmp = _x[i]
    for j in xrange(i+1,n):
        if tmp == _x[j]:
            count += 1
        else:
            break

print(count)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(raw_input())
d = {}
ans = 0
for i in range(n):
    si = ''.join(sorted(raw_input()))
    if si in d:
        ans += d[si]
        d[si] += 1
    else:
        d[si] = 1
print(ans)

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

n = int(input())
s = [ input() for i in range(n)]
count = 0
x = [sorted(i) for i in s]
_x = sorted(x)

for i in range(n-1):
    tmp = _x[i]
    for j in range(i+1,n):
        if tmp == _x[j]:
            count += 1
        else:
            break

print(count)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(raw_input())
d = {}
ans = 0
for i in range(n):
    si = ''.join(sorted(raw_input()))
    if si in d:
        ans += d[si]
        d[si] += 1
    else:
        d[si] = 1
print(ans)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n = int(input())
s = [ input() for i in range(n)]
count = 0
x = [sorted(i) for i in s]
_x = sorted(x)

for i in range(n-1):
  	tmp = -x[i]
    for j in range(i+1,n):
        if tmp == _x[j]:
            count += 1
        else:
            break

print(count)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(raw_input())
d = {}
ans = 0
for i in range(n):
    si = ''.join(sorted(raw_input()))
    if si in d:
        ans += d[si]
        d[si] += 1
    else:
        d[si] = 1
print(ans)

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

n = int(input())
s = [ input() for i in range(n)]
count = 0
x = [sorted(i) for i in s]
_x = sorted(x)

for i in range(n-1):
    for j in range(i+1,n):
        if _x[i] == _x[j]:
            count += 1
        else:
            break

print(count)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(raw_input())
d = {}
ans = 0
for i in range(n):
    si = ''.join(sorted(raw_input()))
    if si in d:
        ans += d[si]
        d[si] += 1
    else:
        d[si] = 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def green_bin(n,s):
    count = 0
 
    x = [sorted(i) for i in s]
    _x = sorted(x)
 
    for i in range(n-1):
        for j in range(i+1,n):
            if _x[i] == _x[j]:
                count += 1
            else:
                break
 
    return count
if __name__ == '__main__':
    n = int(input())
    s = [ input() for i in range(n)]
 
    print(green_bin(n,s))

Fixed submission:
# -*- coding: utf-8 -*-
n = int(raw_input())
d = {}
ans = 0
for i in range(n):
    si = ''.join(sorted(raw_input()))
    if si in d:
        ans += d[si]
        d[si] += 1
    else:
        d[si] = 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def green_bin(n,s):
    count = 0

    x = [sorted(i) for i in s]
    _x = sorted(x)

    for i in range(n-1):
        for j in range(i+1,n):
            if _x[i] == _x[j]:
                count += 1
            else:
                break

    return count
if __name__ == '__main__':
    n = int(input())
    s = [ input() for i in range(n)]

    print(green_bin(n,s))

Fixed submission:
# -*- coding: utf-8 -*-
n = int(raw_input())
d = {}
ans = 0
for i in range(n):
    si = ''.join(sorted(raw_input()))
    if si in d:
        ans += d[si]
        d[si] += 1
    else:
        d[si] = 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def green_bin(n,s):
    count = 0
    x = [sorted(i) for i in s]

    for i in range(n-1):
        for j in range(i+1,n):
            if x[i] == x[j]:
                count += 1

    return count
if __name__ == '__main__':
    n = int(input())
    s = [ input() for i in range(n)]

    print(green_bin(n,s))

Fixed submission:
# -*- coding: utf-8 -*-
n = int(raw_input())
d = {}
ans = 0
for i in range(n):
    si = ''.join(sorted(raw_input()))
    if si in d:
        ans += d[si]
        d[si] += 1
    else:
        d[si] = 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def green_bin(n,s):
    count = 0
    x = []
    for i in range(n):
        tmp = sorted(s[i])
        x.append(tmp)

    for i in range(n-1):
        si = x[i]
        for j in range(i+1,n):
            if i == j:
                continue
            else:
                sj = x[j]
                if si == sj:
                    count += 1

    return count
if __name__ == '__main__':
    n = int(input())
    s = [ input() for i in range(n)]

    print(green_bin(n,s))

Fixed submission:
# -*- coding: utf-8 -*-
n = int(raw_input())
d = {}
ans = 0
for i in range(n):
    si = ''.join(sorted(raw_input()))
    if si in d:
        ans += d[si]
        d[si] += 1
    else:
        d[si] = 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
def green_bin(n,s):
    count = 0
    for i in range(n-1):
        si = sorted(s[i])
        for j in range(i+1,n):
            if i == j:
                continue
            else:
                sj = sorted(s[j])
            if si == sj:
                count += 1

    return count
if __name__ == '__main__':
    n = int(input())
    s = [ input() for i in range(n)]

    print(green_bin(n,s))

Fixed submission:
# -*- coding: utf-8 -*-
n = int(raw_input())
d = {}
ans = 0
for i in range(n):
    si = ''.join(sorted(raw_input()))
    if si in d:
        ans += d[si]
        d[si] += 1
    else:
        d[si] = 1
print(ans)