Buggy python submission (verdict: Runtime Error):
N = int(input())
A = []
for i in range(N):
    A.append(input())

dic = {}
for i in range(N):
    temp = {}
    for j in range(10):
        if A[i][j] in temp:
            temp[A[i][j]] += 1
        else:
            temp[A[i][j]] = 1
    if dic in temp:
        dic[temp] += 1
    else:
        dic[temp] = 1
        
ans = 0    
for key in dic:
    if dic[key] > 1:
        ans += (dic[key]*(dic[key]-1)//2)

print(ans)

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

L = ["0"]*N
for i in range(N):
    temp = ["0"]*10
    for j in range(10):
        temp[j] = S[i][j]
    temp.sort()
    L[i] = temp
        
L.sort()
ans = 0
cnt = 1
temp = L[0]
for i in range(1, N):
    if temp == L[i]:
        cnt += 1
    else:
        ans += cnt*(cnt-1)//2
        cnt = 1
        temp = L[i]
        
ans += cnt*(cnt-1)//2
print(ans)

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

List = []
for i in range(N):
    temp = {}
    for j in range(10):
        if A[i][j] in temp:
            temp[A[i][j]] += 1
        else:
            temp[A[i][j]] = 1
    List.append(temp)

    
ans = 0
i = 0
while i < len(List):
    j = i+1
    num = 1
    if List[i] != 0:
        while j < len(List):
            if List[i] == List[j]:
                num += 1
                List[j] = 0
            j += 1
        ans += (num*(num-1)*0.5)
    i += 1

print(int(ans))

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

L = ["0"]*N
for i in range(N):
    temp = ["0"]*10
    for j in range(10):
        temp[j] = S[i][j]
    temp.sort()
    L[i] = temp
        
L.sort()
ans = 0
cnt = 1
temp = L[0]
for i in range(1, N):
    if temp == L[i]:
        cnt += 1
    else:
        ans += cnt*(cnt-1)//2
        cnt = 1
        temp = L[i]
        
ans += cnt*(cnt-1)//2
print(ans)

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

List = []
for i in range(N):
    temp = {}
    for j in range(10):
        if A[i][j] in temp:
            temp[A[i][j]] += 1
        else:
            temp[A[i][j]] = 1
    List.append(temp)
    
ans = 0
i = 0
while i < len(List):
    j = i+1
    while j < len(List):
        if List[i] == List[j]:
            ans += 1
        j += 1
    i += 1

print(ans)

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

L = ["0"]*N
for i in range(N):
    temp = ["0"]*10
    for j in range(10):
        temp[j] = S[i][j]
    temp.sort()
    L[i] = temp
        
L.sort()
ans = 0
cnt = 1
temp = L[0]
for i in range(1, N):
    if temp == L[i]:
        cnt += 1
    else:
        ans += cnt*(cnt-1)//2
        cnt = 1
        temp = L[i]
        
ans += cnt*(cnt-1)//2
print(ans)

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

List = []
for i in range(N):
    temp = {}
    for j in range(10):
        if A[i][j] in temp:
            temp[A[i][j]] += 1
        else:
            temp[A[i][j]] = 1
    List.append(temp)
    
ans = 0
for i in range(N-1):
    for j in range(i+1,N):
        if List[i] == List[j]:
            ans += 1

print(ans)

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

L = ["0"]*N
for i in range(N):
    temp = ["0"]*10
    for j in range(10):
        temp[j] = S[i][j]
    temp.sort()
    L[i] = temp
        
L.sort()
ans = 0
cnt = 1
temp = L[0]
for i in range(1, N):
    if temp == L[i]:
        cnt += 1
    else:
        ans += cnt*(cnt-1)//2
        cnt = 1
        temp = L[i]
        
ans += cnt*(cnt-1)//2
print(ans)

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

List = []
for i in range(N):
    temp = []
    for j in range(10):
        temp.append(A[i][j])
    temp.sort()
    List.append(temp)
    
ans = 0
for i in range(N-1):
    for j in range(i+1,N):
        if List[i] == List[j]:
            ans += 1

print(ans)

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

L = ["0"]*N
for i in range(N):
    temp = ["0"]*10
    for j in range(10):
        temp[j] = S[i][j]
    temp.sort()
    L[i] = temp
        
L.sort()
ans = 0
cnt = 1
temp = L[0]
for i in range(1, N):
    if temp == L[i]:
        cnt += 1
    else:
        ans += cnt*(cnt-1)//2
        cnt = 1
        temp = L[i]
        
ans += cnt*(cnt-1)//2
print(ans)