Buggy python submission (verdict: Runtime Error):
import collections
import math

def combination(n, m):
    return math.factorial(n) / (math.factorial(n - m) * math.factorial(m))

N = int(input())
S = []
for n in range(N):
    S.append(str(input()))

ans = 0
Y=[]
for s in S:
    X = []
    for w in s:
        X.append(w)
        X.sort()
        y = ''.join(X)
    Y.append(y)

c = collections.Counter(Y)
C = c.most_common()

len_C = len(C)

for n in range(len_C):
    if C[n][1] == 1:
        del C[n]
    else:
        pass

len_C = len(C)

for m in range(len_C):
    ans += combination(C[m][1], 2)

print(round(ans))

Fixed submission:
import collections
import math

def combination(n, m):
    return math.factorial(n) / (math.factorial(n - m) * math.factorial(m))

N = int(input())
S = []
for n in range(N):
    S.append(str(input()))

ans = 0
Y=[]
for s in S:
    X = []
    for w in s:
        X.append(w)
        X.sort()
        y = ''.join(X)
    Y.append(y)

c = collections.Counter(Y)
C = c.most_common()
len_C = len(C)

for n in range(len_C):
    if C[n][1] > 1:
        ans += combination(C[n][1], 2)
    else:
        pass

print(round(ans))

Buggy python submission (verdict: Runtime Error):
import collections
import math

def combination(n, m):
    return math.factorial(n) / (math.factorial(n - m) * math.factorial(m))

N = int(input())
S = []
for n in range(N):
    S.append(str(input()))

ans = 0
Y=[]
for s in S:
    X = []
    for w in s:
        X.append(w)
        X.sort()
        y = ''.join(X)
    Y.append(y)

print(Y)

c = collections.Counter(Y)
C = c.most_common()

len_C = len(C)
print(C)
print(len_C)

for n in range(len_C):
    if C[n][1] == 1:
        del C[n]
    else:
        pass
print(C)

len_C = len(C)

for m in range(len_C):
    ans += combination(C[m][1], 2)

print(round(ans))

Fixed submission:
import collections
import math

def combination(n, m):
    return math.factorial(n) / (math.factorial(n - m) * math.factorial(m))

N = int(input())
S = []
for n in range(N):
    S.append(str(input()))

ans = 0
Y=[]
for s in S:
    X = []
    for w in s:
        X.append(w)
        X.sort()
        y = ''.join(X)
    Y.append(y)

c = collections.Counter(Y)
C = c.most_common()
len_C = len(C)

for n in range(len_C):
    if C[n][1] > 1:
        ans += combination(C[n][1], 2)
    else:
        pass

print(round(ans))

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

Y=[]
for s in S:
    X = []
    for w in s:
        X.append(w)
        X.sort()
    Y.append(X)

ans_d = 0

for n in range(N):
    for i in range(N):
        if i == n:
            pass
        else:
            if Y[n] == Y[i]:
                ans_d += 1
            else:
                pass

ans = ans_d / 2
print(round(ans))

Fixed submission:
import collections
import math

def combination(n, m):
    return math.factorial(n) / (math.factorial(n - m) * math.factorial(m))

N = int(input())
S = []
for n in range(N):
    S.append(str(input()))

ans = 0
Y=[]
for s in S:
    X = []
    for w in s:
        X.append(w)
        X.sort()
        y = ''.join(X)
    Y.append(y)

c = collections.Counter(Y)
C = c.most_common()
len_C = len(C)

for n in range(len_C):
    if C[n][1] > 1:
        ans += combination(C[n][1], 2)
    else:
        pass

print(round(ans))