Buggy python submission (verdict: Time Limit Exceeded):

def anagram(list1, list2):

    anagramFlg = 1

    for i in range(len(list1)):
        if list1[i] != list2[i]:
            anagramFlg = 0
            break

    return anagramFlg


n = int(input())

inputList=[]
for i in range(n):
    line = input()
    inputList.append(line)

# print(inputList)

sortedList = []
for i in range(n):
    tmpList = list(inputList[i])
    tmpList.sort()
    sortedList.append(tmpList)

cnt = 0

for i in range(n):
    for j in range(i+1, n):
        if anagram(sortedList[i], sortedList[j]) == 1:
            cnt += 1

print(cnt)













Fixed submission:

def combinatnion(num, cmb):
    nmrtr = 1
    dnmntr = 1

    for i in range(cmb):
        nmrtr = nmrtr * (num - i)
        dnmntr = dnmntr * (i + 1)

    ans = int(nmrtr/dnmntr)
    return ans

n = int(input())

inputList=[]
for i in range(n):
    line = input()
    inputList.append(line)

# print(inputList)

sortedList = []
dic = {}
for i in range(n):
    tmpList = list(inputList[i])
    tmpList.sort()
    tmpword = "".join(tmpList)

    if tmpword in dic:
        dic[tmpword] = dic[tmpword] + 1
    else:
        dic[tmpword] = 1

    # print(dic)

# print(tmpword)

cnt = 0
for val in dic.values():
    if val != 1:
        cnt += combinatnion(val, 2)

print(cnt)

Buggy python submission (verdict: Runtime Error):

def anagram(list1, list2):

    anagramFlg = 1

    for i in range(len(str)):
        if list1[i] != list2[i]:
            anagramFlg = 0
            break

    return anagramFlg


n = int(input())

inputList=[]
for i in range(n):
    line = input()
    inputList.append(line)

# print(inputList)

sortedList = []
for i in range(n):
    tmpList = list(inputList[i])
    tmpList.sort()
    sortedList[i] = tmpList

cnt = 0

for i in range(n):
    for j in range(i+1, n):
        if anagram(sortedList[i], sortedList[j]) == 1:
            cnt += 1

print(cnt)













Fixed submission:

def combinatnion(num, cmb):
    nmrtr = 1
    dnmntr = 1

    for i in range(cmb):
        nmrtr = nmrtr * (num - i)
        dnmntr = dnmntr * (i + 1)

    ans = int(nmrtr/dnmntr)
    return ans

n = int(input())

inputList=[]
for i in range(n):
    line = input()
    inputList.append(line)

# print(inputList)

sortedList = []
dic = {}
for i in range(n):
    tmpList = list(inputList[i])
    tmpList.sort()
    tmpword = "".join(tmpList)

    if tmpword in dic:
        dic[tmpword] = dic[tmpword] + 1
    else:
        dic[tmpword] = 1

    # print(dic)

# print(tmpword)

cnt = 0
for val in dic.values():
    if val != 1:
        cnt += combinatnion(val, 2)

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):

def anagram(str1, str2):
    str1List = list(str1)
    str2List = list(str2)

    str1List.sort()
    str2List.sort()

    anagramFlg = 1

    for i in range(len(str1List)):
        if str1List[i] != str2List[i]:
            anagramFlg = 0
            break

    return anagramFlg


n = int(input())

inputList=[]
for i in range(n):
    line = input()
    inputList.append(line)

# print(inputList)

cnt = 0

for i in range(n):
    for j in range(i+1, n):
        if anagram(inputList[i], inputList[j]) == 1:
            cnt += 1

print(cnt)













Fixed submission:

def combinatnion(num, cmb):
    nmrtr = 1
    dnmntr = 1

    for i in range(cmb):
        nmrtr = nmrtr * (num - i)
        dnmntr = dnmntr * (i + 1)

    ans = int(nmrtr/dnmntr)
    return ans

n = int(input())

inputList=[]
for i in range(n):
    line = input()
    inputList.append(line)

# print(inputList)

sortedList = []
dic = {}
for i in range(n):
    tmpList = list(inputList[i])
    tmpList.sort()
    tmpword = "".join(tmpList)

    if tmpword in dic:
        dic[tmpword] = dic[tmpword] + 1
    else:
        dic[tmpword] = 1

    # print(dic)

# print(tmpword)

cnt = 0
for val in dic.values():
    if val != 1:
        cnt += combinatnion(val, 2)

print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):

def anagram(str1, str2):
    str1List = list(str1)
    str2List = list(str2)

    str1List.sort()
    str2List.sort()

    anagramFlg = 1

    for i in range(len(str1List)):
        if str1List[i] != str2List[i]:
            anagramFlg = 0
            break

    return anagramFlg


n = int(input())

inputList=[]
for i in range(n):
    line = input()
    inputList.append(line)

# print(inputList)

cnt = 0

for i in range(n):
    for j in range(i+1, n):
        if anagram(inputList[i], inputList[j]) == 1:
            cnt += 1

print(cnt)













Fixed submission:

def combinatnion(num, cmb):
    nmrtr = 1
    dnmntr = 1

    for i in range(cmb):
        nmrtr = nmrtr * (num - i)
        dnmntr = dnmntr * (i + 1)

    ans = int(nmrtr/dnmntr)
    return ans

n = int(input())

inputList=[]
for i in range(n):
    line = input()
    inputList.append(line)

# print(inputList)

sortedList = []
dic = {}
for i in range(n):
    tmpList = list(inputList[i])
    tmpList.sort()
    tmpword = "".join(tmpList)

    if tmpword in dic:
        dic[tmpword] = dic[tmpword] + 1
    else:
        dic[tmpword] = 1

    # print(dic)

# print(tmpword)

cnt = 0
for val in dic.values():
    if val != 1:
        cnt += combinatnion(val, 2)

print(cnt)