Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N: int, s: "List[str]"):

    count = 0
    str_list = []
    for s_i in s:

        s_i = list(s_i)
        s_i.sort()

        if s_i in str_list:
            # print(s_i)
            # print("True")
            count += str_list.count(s_i)
            str_list.append(s_i)

        else:
            # print(s_i)
            # print("False")
            str_list.append(s_i)

    print(count)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int, s: "List[str]"):

    result = 0
    str_dict = dict()
    for s_i in s:

        s_i = list(s_i)
        s_i.sort()
        s_i = "".join(s_i)

        if s_i in str_dict:
            result += str_dict[s_i]
            str_dict[s_i] += 1
        else:
            str_dict[s_i] = 1

    print(result)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N: int, s: "List[str]"):

    count = 0
    for i in range(len(s) - 1):

        s_from = list(s[i])
        s_from.sort()
        # print(s_from)

        for j in range(i + 1, len(s)):

            s_target = list(s[j])
            s_target.sort()
            # print(s_target)

            if s_target == s_from:
                count += 1
            else:
                pass
    print(count)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int, s: "List[str]"):

    result = 0
    str_dict = dict()
    for s_i in s:

        s_i = list(s_i)
        s_i.sort()
        s_i = "".join(s_i)

        if s_i in str_dict:
            result += str_dict[s_i]
            str_dict[s_i] += 1
        else:
            str_dict[s_i] = 1

    print(result)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)


if __name__ == "__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
#!/usr/bin/env python3
import sys


def solve(N: int, s: "List[str]"):

    count = 0
    for i in range(len(s) - 1):

        s_from = list(s[i])
        s_from.sort()
        # print(s_from)

        for j in range(i + 1, len(s)):

            s_target = list(s[j])
            s_target.sort()
            # print(s_target)

            if s_target == s_from:
                count += 1
            else:
                pass
    print(count)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)


if __name__ == "__main__":
    main()


Fixed submission:
#!/usr/bin/env python3
import sys


def solve(N: int, s: "List[str]"):

    result = 0
    str_dict = dict()
    for s_i in s:

        s_i = list(s_i)
        s_i.sort()
        s_i = "".join(s_i)

        if s_i in str_dict:
            result += str_dict[s_i]
            str_dict[s_i] += 1
        else:
            str_dict[s_i] = 1

    print(result)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    s = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, s)


if __name__ == "__main__":
    main()