Problem:


Score: 300 points

Problem Statement

We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it.

Print all strings that are written on the most number of votes, in lexicographical order.

Constraints

1 \leq N \leq 2 \times 10^5

S_i (1 \leq i \leq N) are strings consisting of lowercase English letters.

The length of S_i (1 \leq i \leq N) is between 1 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

N
S_1
:
S_N

Output

Print all strings in question in lexicographical order.

Sample Input 1

7
beat
vet
beet
bed
vet
bet
beet

Sample Output 1

beet
vet

beet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.

Sample Input 2

8
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo

Sample Output 2

buffalo

Sample Input 3

7
bass
bass
kick
kick
bass
kick
kick

Sample Output 3

kick

Sample Input 4

4
ushi
tapu
nichia
kun

Sample Output 4

kun
nichia
tapu
ushi



Sample input:
7
beat
vet
beet
bed
vet
bet
beet


Sample output:
beet
vet

Submission status: Accepted

Solution code:
from collections import Counter

N = int(input())
l = [input() for _ in range(N)]
cnt = Counter(l)
M = max(list(cnt.values()))
ans = []

for k in cnt.keys():
    if cnt[k]==M:
        ans.append(k)

ans.sort()

for ans_i in ans:
    print(ans_i)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    S = [input() for _ in range(N)]
    t = {}
    m = 0
    for s in S:
        t[s] = t.get(s, 0) + 1
        m = max(m, t[s])
    r = []
    for k, v in t.items():
        if v == m:
            r.append(k)
    r.sort()
    print('\n'.join(r))





main()

Submission status: Accepted

Solution code:
from sys import setrecursionlimit as srl; srl(10**7)
rr = raw_input
rrm = lambda: map(int, raw_input().split())

N =int(rr())
from collections import Counter
count = Counter()
for _ in xrange(N):
    count[rr()] += 1
M = max(count.values())
ans = []
for k in count:
    if count[k] == M:
        ans.append(k)
ans.sort()
for x in ans:
    print x

Submission status: Accepted

Solution code:
n = int(input())
s = [input() for _ in range(n)]
d = dict()
for st in s:
    if st not in d:
        d[st] = 1
    else:
        d[st] += 1
m = max(d.values())
ans = set()
for k, v in d.items():
    if v == m:
        ans.add(k)
ans = sorted(ans)
for st in ans:
    print(st)

Submission status: Accepted

Solution code:
import sys
def fastio():
    from io import StringIO
    from atexit import register
    global input
    sys.stdin = StringIO(sys.stdin.read())
    input = lambda : sys.stdin.readline().rstrip('\r\n')
    sys.stdout = StringIO()
    register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep = ' ', end = '\n'):
    print(*var, file=sys.stderr, end = end, sep = sep)

INF = 10**20
MOD = 10**9 + 7
I = lambda:list(map(int,input().split()))
# from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

n, = I()
d = dd(int)
maximum = 0
for i in range(n):
    s = input()
    d[s] += 1
    maximum = max(maximum, d[s])

ans = []
for i in d:
    if d[i] == maximum:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
C = Counter(S)
M = max(C.values())
print(*sorted(k for k, v in C.items() if v == M), sep="\n")

Submission status: Accepted

Solution code:
# coding: utf-8

N = int(input())
S = [None] * N
for i in range(N):
    S[i] = input()

cnt = {}

for s in S:
    if s in cnt.keys():
        cnt[s] += 1
    else:
        cnt[s] = 1

max_appeared = max(cnt.values())

max_list = [k for k, v in cnt.items() if v == max_appeared]
for k in sorted(max_list):
    print(k)

Submission status: Accepted

Solution code:
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
from collections import defaultdict
kai = defaultdict(lambda: 0)
for _ in range(N):
    S = read()[:-1]
    kai[S] += 1

m = max(kai.values())
ans = []
for k, v in kai.items():
    if v == m:
        ans.append(k)
ans.sort()
print(*ans, sep='\n')

Submission status: Accepted

Solution code:
n = int(input())
S = {}

for _ in range(n):
    s = input()
    if s in S:
        S[s] += 1
    else:
        S[s] = 1

m = max(S.values())
A = []
for k, v in S.items():
    if v == m:
        A.append(k)

for a in sorted(A):
    print(a)

Submission status: Accepted

Solution code:
n=int(input())
d={}
m=0
for i in range(n):
  s=input()
  if s not in d:d[s]=1
  else:d[s]+=1
  m=max(m,d[s])
t=set()
for i in d:
  if d[i]==m:t.add(i)
x=[i for i in t]
x.sort()
for i in x:print(i)

Submission status: Accepted

Solution code:
import os
import sys
from collections import Counter

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N = int(sys.stdin.buffer.readline())
S = [sys.stdin.buffer.readline().decode().rstrip() for _ in range(N)]

counts = Counter(S)
_, m = counts.most_common(1)[0]
ans = []
for s, cnt in counts.items():
    if cnt == m:
        ans.append(s)
ans.sort()
print(*ans, sep='\n')

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    s = [input() for i in range(n)]
    d = defaultdict(lambda : 0)
    for i in s:
        d[i] += 1
    d = list(d.items())
    d.sort(key = lambda x:(-x[1],x[0]))
    a = d[0][1]
    for i,j in d:
        if j == a:
            print(i)
            
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
N = int(input())
S = [input() for i in range(N)]
d = {}
for s in S:
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1

max_cnt = 0
for i in d:
    max_cnt = max(max_cnt, d[i])

t = []
for i in d:
    if d[i]==max_cnt:
        t.append(i)
t.sort()
print(*t, sep='\n')

Submission status: Accepted

Solution code:
import sys

def solve():
    N = int(input())
    word = dict()
    for i in range(N):
        s = input()
        if s in word: word[s] += 1
        else: word[s] = 1

    L = []
    for key in word:
        L.append((word[key], key))
    L.sort(reverse = True)
    maxs = L[0][0]
    Ans = []
    for num, s in L:
        if num == maxs: Ans.append(s)
    Ans.sort()
    for a in Ans:
        print(a)

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
from collections import Counter

n = int(input())
sss = [input() for _ in range(n)]
cnt = Counter(sss)
l = max(cnt.values())
ans = [s for s, c in cnt.items() if c == l]
ans.sort()
print('\n'.join(ans))

Submission status: Runtime Error

Solution code:
n = int(input())
d = {}
for _ in range(N):
    S = input()
    if S in d:
        d[S] += 1
    else:
        d[S] = 1
m = d[max(d)]
l=[]
for i in d:
    if d[i] == m:
        l.append(i)
for i in sorted(l):
    print(i)

Submission status: Runtime Error

Solution code:
d = {}
for i in range(n):
    if s[i] in d:
        d[s[i]] += 1
    else:
        d[s[i]] = 1
m = d[max(d)]
l=[]
for i in d:
    if d[i] == m:
        l.append(i)
for i in sorted(l):
    print(i)

Submission status: Runtime Error

Solution code:
ss = sorted(list(set(s)))
lens = len(ss)
l = [0]*len(ss)
for i in range(lens):
    l[i] =s.count(ss[i])
for i in range(lens):
    if l[i] == max(l):
        print(ss[i])

Submission status: Runtime Error

Solution code:
n = int(input())
s = ([input() for _ in range(n)])

count = []
s_set = list(set(s))
max_count = 0

for i in range(len(s_set)):
    co = s.count(s_set[i])
    count.append(co)
    if co > max_count:
        max_count = co

ans = []
for i in range(len(count)):
    if max_count==count[i]:
        ans.append(s_set(i))

ans = sorted(ans)
for w in ans:
    print(w)

Submission status: Runtime Error

Solution code:
n=(int)(input())
dic={}
max_num=0
for i in range(n):
  get_str=input()
  max_num=0
  if get_str in dic:
    dic[get_str]=1
  else:
    dic[get_str]+=1
  if dic[get_str]>max_num:
    max_num=dic[get_str]
  
  
for i in dic:
  if dic[i]==max_num:
    print(i)

Submission status: Runtime Error

Solution code:
n=(int)(input())
dic={}
max_num=0
for i in range(n):
  get_str=input()
  max_num=0
  if get_str in dic:
    dic[get_str]=1
  else:
    dic[get_str]+=1
  if dic[get_str]>max_num:
    max_num=dic[get_str]
  
  
for i in dic:
  if dic[i]=max_num:
    print(i)

Submission status: Runtime Error

Solution code:
import collections
N=int(input())
s=[str(input()) for i in range(N)]
c=collections.Counter(s)
maximum =max(c.values()) 
max_c_list = soreted(key for key,value in c.items() if value == maximum)
for s in max_c_list:
  print(s)

Submission status: Runtime Error

Solution code:
from collections import Counter

n = int(input())
s = [input() for _ in range(n)]

scnt = Counter(s)
cnt = max(s.values())
ans = sorted(k for k in scnt if scnt[v] == cnt)
print(*ans, sep='\n')

if n == 4:
    print(n)

Submission status: Runtime Error

Solution code:
N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

for i in len(ans):
  print(ans[i])

Submission status: Runtime Error

Solution code:
N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

for i in ans:
  print(ans[i])

Submission status: Runtime Error

Solution code:
N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.apend(keys)
    
ans.sort()

for i in ans:
  print(ans[i])

Submission status: Runtime Error

Solution code:
N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for i in dic.keys():
  if dic[keys] == maxim:
    ans.apend(keys)
    
ans.sort()

for i in ans:
  print(ans[i])

Submission status: Runtime Error

Solution code:
N = int(input())
dict = {}
for _ in range(N):
  word = input()
  if word in dict:
    dict[word] += 1
  else:
    dict[word] = 1
sorted_dict = sorted(dict.items(), key=lambda(k,v): (-v,k))
max_v = sorted_dict[0][1]
for k, v in sorted_dict:
  if v == max_v:
    print(k)
  else:
    exit()

Submission status: Runtime Error

Solution code:
import collections

n = int(input())  # nは入力回数
string_list = [input() for _ in range(n)]
c = collections.Counter(a)
ans_list = []

for i in range(len(c)):
    if c.most_common()[0][1] == c.most_common()[i][1]:
        ans_list.append(c.most_common()[i][0])
    else:
        break

for i in range(ans_list):
    print(sorted(ans_list)[i])

Submission status: Runtime Error

Solution code:
from collections import defaultdict
dic=defaultdict(int)
n=int(input())
for _ in range(n): dic[input()]+=1
lis=sorted(dic.items(),key=lambda x:x[1],reverse=True)
M=lis[0][1]
ans=[]
for i in range(n):
    if lis[i][1]==M: ans.append(lis[i][0])
    else: break
ans.sort()
for i in ans: print(i)

Submission status: Runtime Error

Solution code:

n = int(input())

d = {}

for i in range(n):
  a = input()
  if a not in d:
    d[a] = 1
  else:
    d[a] += 1

dsorted = sorted(d, key=lambda x:x[1])

cnt = 0
for i in dsorted:
  print(i)
  cnt += 1
  if cnt == 2:
    break

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >>N;
    map<string,int> mp;
    for(int i=0;i<N;i++){
     string s;
     cin >>s;
     mp[s]++;
   }  
   int mx=0;
   for(auto p :mp){
       mx=max(mx,p.second);
   }
   for(auto p : mp){
       if(p.second != mx) continue;
       cout <<p.first <<endl;
   }

}

Submission status: Runtime Error

Solution code:
from sys import setrecursionlimit
setrecursionlimit(10**9)


def main():
    from sys import stdin
    import pandas as pd
    readline = stdin.readline

    n = int(readline())
    S = pd.Series([readline()[:-1] for _ in [0]*n])

    S = S.value_counts().copy()
    cond = S[0]
    answers = list(S[S == cond].sort_index().index)

    for ans in answers:
        print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    from sys import stdin
    import pandas as pd
    readline = stdin.readline

    n = int(readline())
    S = pd.Series([readline()[:-1] for _ in [0]*n])

    S = S.value_counts().copy()
    cond = S[0]
    answers = list(S[S == cond].sort_index().index)

    for ans in answers:
        print(ans)


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n = int(input())
aux = 0
palavras = list()
resultado = list()

while aux < n:
 	palavra = input()
 	
	if palavras != []:
		length = len(palavras)
		flag = True
		
		for i in range(length):
			if palavras[i][0] == palavra:
 				palavras[i][1] = palavras[i][1] + 1
				flag = False
				continue
		
		if flag:
			palavras.append([palavra, 1])
	
	else:
		palavras.append([palavra, 1])  
	
	aux += 1

maior = 1

for j in palavras:
	if j[1] > maior:
		maior = j[1]

for k in palavras:
	if k[1] == maior:
		resultado.append(k[0])
				
resultado.sort()

for l in resultado:
	print(l)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for _ in range(n)]
t = s.sort()
x = 0
maxx = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        x += 1
        if x == maxx:
            maxx = x
            t.append(s[i])
        elif x > maxx:
            maxx = x
            t = [s[i]]
    else:
        x = 0
for j in t:
    print(j)

Submission status: Runtime Error

Solution code:
N = int(input())
hashmap = {}
Array = [[] for _ in range(N+1)]
for _ range(N):
  st = input()
  if st not in hashmap:
    hashmap[st] = 0
  hashmap[st]+=1
max_num = max(hashmap.values())
hashmap.sort()
for k,v in hashmap.items():
  if v == max_num:
    print(k)

Submission status: Runtime Error

Solution code:
n = int(input()
s = {}
for i in range(n):
    si = input()
    if si in s:
        s[si] +=1
    else:
        s[si] = 0
l = max(s.values())
ans = []
for i in s:
    if s[i] == l:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
n = int(input()
s = dict()
for i in range(n):
    si = input()
    if si in s:
        s[si] +=1
    else:
        s[si] = 0
l = max(s.values())
ans = []
for i in s:
    if s[i] == l:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
n = int(input()
s = dict()
for i in range(n):
    si = input()
    if si in s:
        s[si] +=1
    else:
        s[si] = 0
l = max(s.values())
ans = []
for i in s:
    if s[i] == 1:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
N = int(input())
d = {}
for _ in range(N):
  S = input()
  if S in d:
    d[S] += 1
  else:
   　d[S] = 1
m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
  print(s)

Submission status: Runtime Error

Solution code:

def writeSC(s,i):
    if s in SC[i] :
        i = writeSC(s,i+1)
        # print(i,SC[i])
        return(i)
    else:
        SC[i].append(s)
        return(i)

n=int(input())

SC=[[] for i in range(n)] 

maxr=0
for i in range(n):
    s=input()
    res = writeSC(s,0)
    if maxr<res :
        maxr=res

SC[maxr].sort()
# print(maxr, SC[maxr])
for i in range(len(SC[maxr])):
    print(SC[maxr][i])

Submission status: Runtime Error

Solution code:
# abc156_c.py
# https://atcoder.jp/contests/abc156/tasks/abc156_c

# C - Rally /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 300点

# 問題文
# 数直線上に N人の人が住んでいます。
# i番目の人が住んでいるのは座標 Xiです。
# あなたは N人全員が参加する集会を開くことを考えています。
# 集会は数直線上の任意の 整数値の座標 で開くことができ、座標 Pで集会を開くとき、
# i 番目の人は集会に参加するために (Xi−P)2の体力を消費します。
# N人が消費する体力の総和としてありえる値の最小値を求めてください。

# 制約
#     入力は全て整数である。
#     1≤N≤100
#     1≤Xi≤100

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N
# X1 X2 ... XN

# 出力
# N人が消費する体力の総和としてありえる値の最小値を出力せよ。

# 入力例 1
# 2
# 1 4

# 出力例 1
# 5

# 座標 2で集会を開くとき、1 番目の人が消費する体力は (1−2)2=1、 2 番目の人が消費する体力は (4−2)2=4、よってその総和は 5 です。 
# これが 2人が消費する体力の総和としてありえる値の最小値です。
# 集会を開くことができるのは整数値の座標だけであることに注意してください。

# 入力例 2
# 7
# 14 14 2 13 56 2 37

# 出力例 2
# 2354


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    N = int(lines[0])
    # N, M = list(map(int, lines[0].split()))
    values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(N):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(N):
    #     valueses.append(list(map(int, lines[i+1].split())))

    result = None
    for p in range(101):
        su = 0
        for n in range(N):
            su += (values[n] - p)**2
        if result is None:
            result = su
        elif result > su:
            result = su

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['2', '1 4']
        lines_export = [5]
    if pattern == 2:
        lines_input = ['7', '14 14 2 13 56 2 37']
        lines_export = [2354]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
from sys import stdin
import sys
import math
from functools import reduce
import itertools

n = int(stdin.readline().rstrip())

d = {}

for i in range(n):
    s = stdin.readline().rstrip()

    if s in d:
        d[s] += 1
    else:
        d[s] = 1

d = sorted(d.items(), key=lambda x:x[1], reverse=True)

m = d[0][1]
a = []
for i in range(n):
    if d[i][1] == m:
        a.append(d[i][0])
    else:
        break

a.sort()

for aa in a:
    print(aa)

Submission status: Runtime Error

Solution code:
n=int(input())
dict={}
xs=[]
for i in range(n):
  s=input()
  xs+=[s]
  if s not in dict:
    dict[s]=1
  else:
    dict[s]+=1
pin=0
xs=list(set(xs))
for i in xs:
  pin=max(pin,dict[i])
ans=[]
for i in xs:
  if dict[i]==pin:
    ans*=[i]
ans.sort()
for i in ans:
  print(i)

Submission status: Runtime Error

Solution code:
n=int(input())
dict={}
xs=[]
for i in range(n):
  s=input()
  xs+=[s]
  if s not in dict:
    dict[s]=1
  else:
    dict[s]+=1
pin=0
xs=list(set(xs))
for i in xs:
  pin=max(pin,dict[xs])
ans=[]
for i in xs:
  if dict[i]==pin:
    ans*=[i]
ans.sort()
for i in ans:
  print(i)

Submission status: Runtime Error

Solution code:
n=int(input())
lst=[input() for i in range(n)]
xs=list(set(lst))
ans=[]
for i in xs:
  cnt=lst.count(i)
  ans,append([i,cnt])
ans.sort(key=lambda x:x[1])
pin=ans[-1][1]
ans2=[]
for i in ans:
  if i[1]==pin:
    ans2.append(i[0])
ans2.sort()
for i in ans2:
  print(i)

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for _ in range(n)]

s_sort = sorted(s)

s_num = [1]*n

for i in range(1,n):
    if s_sort[i] == s_sort[i-1]:
        s_num[i] += s_num[i-1]

Maxnum = max(s_num)

index_num = [n for n, v in enumerate(s_num) if v == Maxnum]

[print(s_sort[i]) for i in index_num,]

Submission status: Runtime Error

Solution code:
import pandas
 
n = int(input())
s = [input() for _ in range(n)]

x = pandas.Series(s)
lis = x.mode().tolist()
 
for i in range(len(lis)):
  print(lis[i])

Submission status: Runtime Error

Solution code:
import pandas
 
n = int(input())
s = [input() for _ in range(n)]
 
x = pandas.Series(s)
lis = x.mode().tolist()

for i in range(len(lis)):
  print(lis[i])

Submission status: Runtime Error

Solution code:
import pandas
 
n = int(input())
s = [input() for _ in range(n)]
 
x = pandas.Series(s)
lis = x.mode().tolist()
lis = sort(lis)
for i in range(len(lis)):
  print(lis[i])

Submission status: Runtime Error

Solution code:
import pandas

n = int(input())
s = [input() for _ in range(n)]

x = pandas.Series(s)
lis = x.mode().tolist()
lis = sort(lis)
for i in range(len(lis)):
  print(lis[i])

Submission status: Runtime Error

Solution code:
n = int(input())
arr = {input() for _ in range(n)}
dic={}

#各単語の出現回数を数える
for i in range(n):
    if arr[i] not in dic:
        dic[arr[i]] = 1
    else:
        dic[arr[i]] += 1
#最大の出現回数を求める
largest = max(dic.values())
ans = []

for keys in dic.keys():
    if dic[keys] == largest:
        ans.append(keys)
#単語を辞書順に並べ替えて出力する
ans = sorted(ans)

for words in ans:
    print(words)

Submission status: Runtime Error

Solution code:
N = int(input())
S = []
for i in range(N):
    s = input()
    S.append(s)

ret = [letter for letter,count in S.most_common() if count == S.most_common()[0][1]]
print(ret)

Submission status: Runtime Error

Solution code:
import collections

N = int(input())

S = []
for _ in range(N):
    S.append(input())

c = collections.Counter(S)
c1 = c.most_common()

# print(c1[0][0])

tmp = []
for i in range(len(c1)):
    tmp.append(c1[i][0])
    print(sorted(tmp))
    if (c1[0][1] > c1[i][1]):
        break

ans = sorted(tmp)
for i in range(len(ans)):
    print(ans[i])

Submission status: Runtime Error

Solution code:
d = {}
for _ in range(N):
    S = input()
    if S in d:
        d[S] += 1
    else:
        d[S] = 1

m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
    print(s)

Submission status: Runtime Error

Solution code:
N = int(input())
Dictionary = {}
for i in range(N):
    S = input()
    if S not in Dictionary :
        Dictionary[S] = 1
    else :
        Dictionary[S] = Dictionary[S]+1
sorted_Dic = sorted(Dictionary.items(), key=lambda x: x[1],reverse=True)

ans_list = []
for i in range(N):
    if sorted_Dic[i][1]==sorted_Dic[0][1]:
        ans_list.append(sorted_Dic[i][0])
    else:
        break;
for item in sorted(ans_list):
  print(item)

Submission status: Runtime Error

Solution code:
n = int(input())
d = {}
for _ in range(n) :
    s = input()
    if s in d :
        d[s] += 1
    else :
        d[s] = 1

mx = max(d.values())
for s in sorted(k for k in d if d[k] == m) :
    print(s)

Submission status: Runtime Error

Solution code:
n = int(input())
w = {}
for _ in range(n):
  	s = input()
    w[s] = w.get(s, 0) + 1
ans = sorted(i for i, j in w.items() if j == max(w.values()))
for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
n = int(input())
w = {}
for _ in range(n):
    w[i] = w.get(input(), 0) + 1
ans = sorted(i for i, j in w.items() if j == max(w.values()))
for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
from sys import stdin
def read():
    return stdin.readline().strip()

dict={}
output=[]

iteration=int(read())

max_val=-1

for _ in range(iteration):
    item=read()
    
    if dict.get(item) is None:
        dict[item]=0 
    dict[item]+=1 
    max_val = max(dict[item],max_val)
#max_val=max(dict.values())
for k,v in dict.items():
    
    if(max_val==v):
        output.append(max_key)
    
    
output.sort()
print('\n'.join(output))

Submission status: Runtime Error

Solution code:
from sys import stdin
def read():
    return stdin.readline().strip()

dict={}
output=[]

iteration=int(read())

max_val=-1

for _ in range(iteration):
    item=read()
    
    if dict.get(item) is None:
        dict[item]=0 
    dict[item]+=1 
    max_val = max(dict[item],max_val)
#max_val=max(dict.values())
for k,v in dict:
    
    if(max_val==v):
        output.append(k)
    
    
output.sort()
print('\n'.join(output))

Submission status: Runtime Error

Solution code:
dict={}
output=[]

iteration=read()
if(iteration.isdigit()):
    iteration=int(iteration)
else:
    iteration=int(float(iteration))
for _ in range(iteration):
    item=read()
    
    if dict.get(item) is None:
        dict[item]=0 
    dict[item]+=1 
max_val=max(dict.values())
while(bool(dict)):
    max_key=max(dict,key=dict.get)
    if(max_val!=dict[max_key]):
        break
    output.append(max_key)
    
    del dict[max_key]
output.sort()
print('\n'.join(output))

Submission status: Runtime Error

Solution code:
dict={}
output=[]

iteration=int(input())
for _ in range(iteration):
    item=input()
    
    if dict.get(item) is None:
        dict[item]=0 
    dict[item]+=1 
max_val=max(dict.values())
for i in range(iteration):
    max_key=max(dict,key=dict.get)
    if(max_val!=dict[max_key]):
        break
    output.append(max_key)
    
    del dict[max_key]
output.sort()
print('\n'.join(output))

Submission status: Runtime Error

Solution code:
# https://atcoder.jp/contests/abc155/tasks/abc155_c

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

    S_dict = {}
    for s in S_list:
        S_dict[s]=0
    for s in S_list:
        S_dict[s]+=1



    max_k_list = [kv[0] for kv in S_dict.items() if kv[1] == max(S_dict.values())]
    max_k_list.sort()
    for k in max_k_list:
        print(k)

if __name__ == '__main__'
     main()

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    S_list = []
    for _ in range(N):
        S_list.append(input())

    S_dict = {}
    for s in S_list:
        S_dict[s]=0
    for s in S_list:
        S_dict[s]+=1

    max_kv = max(S_dict.values())

    max_k_list = [kv[0] for kv in S_dict.items() if kv[1] == max_kv]
    max_k_list.sort()
    for k in max_k_list:
        print(k)

if __name__ == '__main__'
     main()

Submission status: Runtime Error

Solution code:
import math
import collections

def main():
  N = int(input())
  S = list()
  S = [input() for _ in range(N)]
  
  s = collections.counter(S)
  
  MaxCount = max(s.values())
  
  ans = []
  
  for key, value in s.items():
    if value == MaxCount:
      ans.append(key)
                 
  ans.sort()
  
  for i in ans:
    print(ans[i])
  
  
  
  
main()

Submission status: Runtime Error

Solution code:
N = int(input())
A = {}

MAX = 0
for i in range(N):
    s = input()
    A[s] = A.get(s,0) + 1
    MAX = max(MAX, A[s])

A = sorted(A.items())
for k,v in A.items():
  if MAX == v:
    print(k)

Submission status: Runtime Error

Solution code:
def main():
    d = {}
    N = int(input())
    for i in range(N):
        s = input()
        d.setdefault(s, 1)
        d[s] += 1
    
    d = sorted(d.items())
    d = sorted(d, key=lambda x:x[1], reverse=True)
    n = d[0][1]
    for i in range(N):
        if d[i][1] != n:
            break
        print(d[i][0])

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def main():
    d = {}
    N = int(input())
    for i in range(N):
        s = input()
        d.setdefault(s, 1)
        d[s] += 1
    
    d = sorted(d.items())
    d = sorted(d, key=lambda x:x[1], reverse=True)
    for i in range(N):
        print(d[i][0])

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n=int(input())
s=[]
for _ in range(n):
  s.append(input())
import collections
d=collections.Counter(s)
largest=max(list(d.values()))
ans=[]
for key in d.keys():
  if d[key]==largest:
    ans.append(key)
ans.sort()
while len(ans)>0:
  print(ans.popleft(-1))

Submission status: Runtime Error

Solution code:
N = int(input())
d = {}
for _ in range(N):
    S = input()
    if S in l :
        d[S] += 1
    else :
        d[S] = 1

m = max(d.values())

for s in sorted(k for k in d if d[k]==m) :
    print(s)

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.read
from collections import Counter
def main():
    n, *s = read().split()
    n = int(n)
    sc = Counter(s)
    scm = sc.most_common()
    maxnum = scm[0][1]
    r = []
    for i1 in range(n):
        if scm[i1][1] == maxnum:
            r.append(scm[i1][0])
        else:
            break
    r.sort()
    print(*r, sep="\n")

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
if (n := int(input())) > 0:
  for _ in range(n):
    input()

Submission status: Runtime Error

Solution code:
class Counter(dict):
  def __missing__(self, i):
    return 0

n = int(input())

s = Counter()

for _ in range(n):
  i = input()
  s[i] += 1

s = dict(sorted(s.items(), key=lambda x: x[1]))
m = s.values()[0]

ans = []
for i in s:
  if s[i] == m:
    ans.append(i)

print('\n'.join(ans))

Submission status: Runtime Error

Solution code:
from collections import OrderedDict

N=int(input())
S=[]

for _ in range(N):
    s=input()
    S.append(s)

c=OrderedDict(sorted(S))

max_s_list= [kv[0] for kv in c.items() if kv[1]==max(c.values())]

for a in max_s_list:
    print(a)