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


def main():
    n = int(input())
    polls_dict = {}
    for _ in range(n):
        poll = input()
        if poll not in polls_dict:
            polls_dict[poll] = 1
        else:
            polls_dict[poll] += 1

    max_poll = max(polls_dict.values())
    #polls_set = sorted(polls_dict.keys())
    polls_dict = sorted(polls_dict)

    for key, value in polls_dict.items():
        if value == max_poll:
            print(key)
        else:
            pass

    #for poll in polls_set:
    #    print(poll)
    
    return 0


if __name__ == '__main__':
    main()


Fixed submission:
# coding: utf-8


def main():
    n = int(input())
    polls_dict = {}
    for _ in range(n):
        poll = input()
        if poll not in polls_dict:
            polls_dict[poll] = 1
        else:
            polls_dict[poll] += 1

    max_poll = max(polls_dict.values())
    
    polls_set = set()
    for key, value in polls_dict.items():
        if value == max_poll:
            polls_set.add(key)

    polls_set = sorted(polls_set)
    for poll in polls_set:
        print(poll)
    
    return 0


if __name__ == '__main__':
    main()

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


def main():
    n = int(input())
    polls_dict = {}
    for _ in range(n):
        poll = input()
        if poll not in polls_dict:
            polls_dict[poll] = 1
        else:
            polls_dict[poll] += 1

    max_poll = max(polls_dict.values())
    polls_set = sorted(polls_dict.keys())
    for key, value in polls_dict.items():
        if value < max_poll:
            polls_set.remove(key)

    for poll in polls_set:
        print(poll)
    
    return 0


if __name__ == '__main__':
    main()


Fixed submission:
# coding: utf-8


def main():
    n = int(input())
    polls_dict = {}
    for _ in range(n):
        poll = input()
        if poll not in polls_dict:
            polls_dict[poll] = 1
        else:
            polls_dict[poll] += 1

    max_poll = max(polls_dict.values())
    
    polls_set = set()
    for key, value in polls_dict.items():
        if value == max_poll:
            polls_set.add(key)

    polls_set = sorted(polls_set)
    for poll in polls_set:
        print(poll)
    
    return 0


if __name__ == '__main__':
    main()

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


def main():
    n = int(input())
    my_polls_list = []
    for _ in range(n):
        my_polls_list.append(input())

    my_polls_set = set(my_polls_list)
    my_polls_dict = {}
    for poll in my_polls_set:
        if poll not in my_polls_dict:
            my_polls_dict[poll] = my_polls_list.count(poll)
        else:
            my_polls_dict[poll] += my_polls_list.count(poll)
    max_poll = max(my_polls_dict.values())

    for key, value in my_polls_dict.items():
        if value != max_poll:
            my_polls_set.remove(key)

    my_polls_set = sorted(my_polls_set)
    for poll in my_polls_set:
        print(poll)

    return 0


if __name__ == '__main__':
    main()


Fixed submission:
# coding: utf-8


def main():
    n = int(input())
    polls_dict = {}
    for _ in range(n):
        poll = input()
        if poll not in polls_dict:
            polls_dict[poll] = 1
        else:
            polls_dict[poll] += 1

    max_poll = max(polls_dict.values())
    
    polls_set = set()
    for key, value in polls_dict.items():
        if value == max_poll:
            polls_set.add(key)

    polls_set = sorted(polls_set)
    for poll in polls_set:
        print(poll)
    
    return 0


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
# coding: utf-8

def main():
   
    n = int(input())
    alltohyo = list()
    counter = {}
    for _ in range(n):
        alltohyo.append(input())
   
    tohyo = set(alltohyo)
   
    for i in tohyo:
        counter[i] = alltohyo.count(i)
       
    max_val = max(counter.values())
    keys_of_max_val = [key for key in counter if counter[key] == max_val]
    #slist = sorted(counter.items(), key=lambda x: x[1], reverse=True)    
   
    s_keys_of_max_val = sorted(keys_of_max_val)
   
    for i in s_keys_of_max_val:
        print(i)
    #max_count = max(counter)
    #print(max_count)
    #print(alltohyo,tohyo, counter)
   
    return 0


if __name__ == '__main__':
  main()

Fixed submission:
# coding: utf-8


def main():
    n = int(input())
    polls_dict = {}
    for _ in range(n):
        poll = input()
        if poll not in polls_dict:
            polls_dict[poll] = 1
        else:
            polls_dict[poll] += 1

    max_poll = max(polls_dict.values())
    
    polls_set = set()
    for key, value in polls_dict.items():
        if value == max_poll:
            polls_set.add(key)

    polls_set = sorted(polls_set)
    for poll in polls_set:
        print(poll)
    
    return 0


if __name__ == '__main__':
    main()