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: Runtime Error

Solution code:
import collections

N=int(input())
S=[input() for i in range(N)]
S = sorted(collections.Counter(S))

print_list = []
count = []
S_max = 0

S_common = S.most_common()
#print(S_common)

values, counts = zip(*S_common)
#print(counts[0])

for i in range(len(values)):
	if counts[0] == counts[i]:
		print(values[i])

Submission status: Runtime Error

Solution code:
if __name__=="__main__":
    n = int(input())
    s=[]
    for i in range(n):
        s.append(input())
        
    s_most = s.most_common()

    print(s_most[0])

    for i in range(1,len(s_most)):
        if s_most[i]==s_most[0]:
            print(s_most[i])
        else:
            break

Submission status: Runtime Error

Solution code:
N = input()

strList = list([])

for i in range(N):
  strList.append(str(input()))

strDict = {}

for item in strList:
  if item not in strDict.keys():
    strDict[item] = 1
  else:
    strDict[item] += 1

maxList = list([])

for strKeys in strDict.keys():
  if strDict[strKeys] == max(strDict.items()):
    maxList.append(strKeys)

print(maxList.sort())

Submission status: Runtime Error

Solution code:
n=int(input())
a=[str() for i in range(n)]
b=[]
for j in range(n):
  for k in range(n):
    if a[j]==a[k]:
      b=a[j]
b.sort()
print(b)

Submission status: Runtime Error

Solution code:
N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
S.append("A")
print(S)
B = []
M = 1
T = 1
for i in range(N):
    if S[i] == S[i+1]:
        T += 1
    elif T < M:
        T = 1
    elif T == M:
        T = 1
        B.append(S[i])
    else:
        M = T
        T = 1
        B = [S[i]]

for i in range(B):
    print(B[i])

Submission status: Runtime Error

Solution code:
import collections

N = int(input())
L = []
for i in range(N):
  L.append(input())

C = collections.Counter(L)
M = max(counted.values())

CHARS = [key for key, value in counted.items() if value == m]
CHARS.sort()
print(CHARS)

Submission status: Runtime Error

Solution code:
from collections import Counter

n = int(input())
s = [input() for i in range(n)]
news = sorted(s)
c = Counter(news)
max = c.most_common()[0][1]
print(c)
for i in range(n):
  if max == c.most_common()[i][1]:
    print(c.most_common()[i][0])
  else:
    break

Submission status: Runtime Error

Solution code:
sl_s = sorted(list(set(sl)))

if len(sl_s) == 1:
    print(sl[0])
else:
    ans = []
    count = 1
    for s in sl_s:
        if sl.count(s) == count and ans.count(s) == 0:
            ans.append(s)
        elif sl.count(s) > count and ans.count(s) == 0:
            ans.clear()
            ans.append(s)
            count = sl.count(s)
    print('\n'.join(ans))

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(map(str, input().split()))

a = np.array(a)
unique_elements, counts_elements = np.unique(a, return_counts=True)
elements = unique_elements[counts_elements == max(counts_elements)]
for i in elements:
    print(i)

Submission status: Runtime Error

Solution code:
n = int(input())
s=()
for i in range(n):
  s.insert(input())

s=list(s)
s.sort()
for i in range(len(s)):
  print(s[i])

Submission status: Runtime Error

Solution code:
import math

N = int(input())
S = []
kaisuu = []
solution = []
index = 0

for i in range(N):
  tmp = input()
  
  if (tmp in S) == False:
    S.append(tmp)
    kaisuu.append(1)
    index += 1
  
  if (tmp in S) == True:
    index_tmp = S.index(tmp)
    kaisuu[index_tmp] += 1
  
max_ = max(kaisuu)

for i in range(N):
  if kaisuu[i] == max_:
    solution.append(S[i])
    
solution.sort()

for i in solution:
  print(i)

Submission status: Runtime Error

Solution code:
import collections
def resolve_c():
    n = input()
    s_l = [input() for i in range(int(n))]
    c = collections.Counter(s_l)
    for k, v in c.items():
        if v == c.most_common()[0][1]:
            results.append(v)
        else:
            break
    results = sorted(results)
    for r in results:
        print(r)
resolve_c()

Submission status: Runtime Error

Solution code:
from statistics import mode

N=int(input())
S=[input() for i in range(N)]
S=sorted(S)
print(mode(S))

Submission status: Runtime Error

Solution code:
import collections
a = int(input())
line = [input() for k in range(a)]

c = collections.Counter(line)

max_number = max(c.values())
common = c.most_common()

max_common = []
for k in range(a):
  if common[k][1] == max_number:
    max_common.append(common[k][0])
  else:
    break
for k in sorted(max_common):
  print(k)

Submission status: Runtime Error

Solution code:
import pandas as pd

if __name__=="__main__":
    n = int(input())
    s=[]
    for i in range(n):
        s.append(input())
        
    dict_s=dict()
    dict_s["s"]=s
    df_s = pd.DataFrame(dict_s)

    df_s_grp = df_s.groupby("s").size()
    
    max_size = df_s_grp.max()

    ans_list = df_s_grp[df_s_grp==max_size].index

    for i in range(len(ans_list)):
        print(str(ans_list[i]))

Submission status: Runtime Error

Solution code:
for _ in range(n):
    s += input()+" "
ls = s.split()
counter = 0
res = []
for x in ls:
    if ls.count(x) > counter:
        counter = ls.count(x)
for x in set(ls):
    if ls.count(x) == counter:
        res.append(x)
r = sorted(res)
print("\n".join(r))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

from fractions import gcd
from math import ceil,floor
import collections

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

num = 0
ans = [S[0]]

for i in range(0,N):
    if S.count(S[i])>num:
        ans.clear()
        num=S.count(S[i])
        ans.append(S[i])
    elif S.count(S[i])==num:
        ans.append(S[i])

ans=list(set(ans))
ans.sort()

for i in range(0,len(ans)):
    print(ans[i])

Submission status: Runtime Error

Solution code:
num = int(input())
i = [int(input()) for _ in range(num)]

count_dict = {}
for ele in i:
  if ele not in count_dict:
    count_dict[ele] = 1
  else:
    count_dict[ele] += 1

max_count = max(count_dict.values())
max_str = [a for a in count_dict if count_dict[a] == max_count]
for string in sorted(max_str):
  print(string)

Submission status: Runtime Error

Solution code:
import collections

N = int(input())
s = [input() for i in range(N)] 
c = collections.Counter(s)

output = [kv[0] for kv in c.items() if kv[1] == max(c.values())]
output.sort()
[print(o) for o in output.sort()]

Submission status: Runtime Error

Solution code:
a=int(input())
b=[]
c=[]
for i in range(a):
  b[i]=input()
for i in range(a):
  c=b.count(b[i])
print(b[index(min(c))])

Submission status: Runtime Error

Solution code:
num = int(input())
i = [int(input()) for _ in range(num)]

count_dict = {}
for ele in i:
  if ele not in count_dict:
    count_dict[ele] = 1
  else:
    count_dict[ele] += 1
    
max_count = max(count_dict.values())
max_str = [a for a in count_dict if count_dict[a] == max_count]
for string in sorted(max_str):
  print(string)

Submission status: Runtime Error

Solution code:
N=int(input())
S=[str(input()) for hoge in range(N)]
P=[i for i in set(S)]
if len(S)==len(P):
    for i in (S):print(i)
else:
    for i in range(len(S)-len(P)):
        print(P[i])

Submission status: Runtime Error

Solution code:
import pandas as pd

if __name__=="__main__":
    n = int(input())
    s=[]
    for i in range(n):
        s.append(input())
        
    dict_s=dict()
    dict_s["s"]=s
    df_s = pd.DataFrame(dict_s)

    df_s_grp = df_s.groupby("s").size()
    
    max_size = df_s_grp.max()

    ans_list = df_s_grp[df_s_grp==max_size].index

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

Submission status: Runtime Error

Solution code:
n= int(input())
s= [input() for i in range(n)]
p=set(s)
p1=list(p)
N=len(s)
c=[0]*N
for i in range(N):
	c[i]=s.count(p1[i])
m =max(c)
c1=c.count(m)
ans =[]
for i in range(N):
	if c[i]==m:
		ans.append(p1[i])
ans1 = sorted(ans)
for i in range(c1):
	print(ans1[i])

Submission status: Runtime Error

Solution code:
import collections as co

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

c = co.Counter(s)
max = c.most_common()[0][1]
r = 1
i = 0

while r == 1:
  if max == c.most_common()[i][1]:
    print(c.most_common()[i][0])
  else:
    r = 0
  i += 1

Submission status: Runtime Error

Solution code:
    
dic = {}
m = 0

for i in L:
    if i in dic:
        dic[i] = dic[i] + 1
    else:
        dic[i] = 1
        
    if m < dic[i]:
        m = dic[i]

n = []
for i in dic:
    if dic[i] == m:
        n.append(i)
n.sort()
for i in n:
    print(i)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

from fractions import gcd
from math import ceil,floor
import collections

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

num = 0
ans = []

for i in range(0,N):
    if S.count(S[i])>num:
        ans.clear()
        num=S.count(S[i])
        ans.append(S[i])
    elif S.count(S[i])==num:
        ans.append(S[i])

ans=list(set(ans))
ans.sort()

for i in range(0,len(ans)):
    print(ans[i])

Submission status: Runtime Error

Solution code:
import collections
N=int(input())
S=[str(input()) for hoge in range(N)]
P=[i for i in set(S)]
if len(S)==len(P):
    for i in (S):print(i)
else:
    for i in range(len(S)-len(P)):
        print(P[i])

Submission status: Runtime Error

Solution code:
N = int(input())
S = [input() for i in range(N)]
S.sort()
maxi = 0
ans = []
total_count = 0
while total_count != N:
  tmp = S.count(S[total_count])
  total_count += tmp
  if maxi < tmp:
    maxi = tmp
    ans.clear()
    ans.append(S[total_count])
  elif maxi == tmp:
    ans.append(S[total_count])
for i in range(len(ans)):
  print(ans[i])

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

from fractions import gcd

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

num = 0
ans = []

for i in range(0,N):
    if S.count(S[i])>num:
        ans.clear()
        num=S.count(S[i])
        ans.append(S[i])
        
    if S.count(S[i])==num:
        ans.append(S[i])

ans=list(set(ans))
ans.sort()

for i in range(0,len(ans)):
    print(ans[i])

Submission status: Runtime Error

Solution code:
n = int(input())
s = ["" for i in range(n)]
for j in range(n):
    s[j] = str(input())
s.sort()
count = [0 for _ in range(len(set(s)))]
l = 0
name = list(sorted(set(s)))
for k in range(n-1):
    count[l] += 1
    if(s[k] != s[k+1]):
        l += 1
if(s[-1] == s[-2]):
    count[-1] += 1
else:
    count.append(1)

m_v = max(count)
ansnum = []

for h in range(len(count)):
    if(count[h] == m_v):
        ansnum.append(name[h])

print(sorted(ansnum))

Submission status: Runtime Error

Solution code:
N = int(input())
S = [input() for i in range(N)]
s = sorted(S)
import collections
c = collections.Counter(s)
C = c.most_common()

a = C[0][1]
b = []
for i in range(N):
  if a == C[i][1]:
    b.append(C[i][0])
  else:
    break
B = sorted(b)

for i in B:
  print(i)

Submission status: Runtime Error

Solution code:
import collections

n = int(input())
s_list = []
for _ in range(n):
    s_list.append(input())
s_data = collections.Counter(s_list).most_common()
s_count = s_data[0][1]
s_index = 1
for s in s_data:
    if s[1] == s_count:
        s_index += 1
    else:
        break
    

for i in range(s_index):
    print(s_data[i][0])

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

from fractions import gcd

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

num = 0
ans = []

for i in range(0,N):
    if S.count(S[i])>num:
        ans.clear()
        num=S.count(S[i])
        ans.append(S[i])
    if S.count(S[i])==num:
        ans.append(S[i])

ans=list(set(ans))
ans.sort()

for i in range(0,len(ans)):
    print(ans[i])

Submission status: Runtime Error

Solution code:
n = input()
a = input().split("")
b = list(set([x for x in a if a.count(x) > 1]))

for i in b:
    print(i)

Submission status: Runtime Error

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

c = collections.Counter(s)

ans = list()
ans.append(c.most_common()[0][0])

for i in range(1,n):
    if c.most_common()[0][1] == c.most_common()[i][1]:
        ans.append(c.most_common()[i][0])
    else:
        break

ans = sorted(ans)
[print(i) for i in ans]

Submission status: Runtime Error

Solution code:
mport collections

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

for i in range(N):
    S.append(input())

S.sort()
counter = collections.Counter(S)

tmp = counter.most_common()

if (len(tmp) == 1):
    print(tmp[0][0])
else:
    for i in range(len(tmp)-1):
        print(tmp[i][0])
        if (tmp[i][1] != tmp[i + 1][1]):
            break

Submission status: Runtime Error

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

max_num = 0
max_str = []
for i in str_lis:
  if str_lis.count(i) > max_num and not i in max_str:
    max_num = str_lis.count(i)
    max_str = []
    max_str.append(i)
  elif str_lis.count(i) == max_num and not i in max_str:
    max_num = str_lis.count(i)
    max_str.append(i)
    
new_max_str = sorted(max_str)

for i in new_max_str:
  print(chr(i))

Submission status: Runtime Error

Solution code:
N = int(input())
S = []
for i in range(N):
  S.append(str(input()))
  
from collections import Counter
N = int(input())
S = []
for i in range(N):
  S.append(str(input()))
ans_list = []
  

c = Counter(S)
keys, values = zip(*c.most_common())

for i in range(len(values)):
  if max(values) == values[i]:
    ans_list.append(keys[i])
    
sorted(ans_list)
for i in range(len(ans_list)):
  print(ans_list[i])

Submission status: Runtime Error

Solution code:
N = int(input())

dic = set()
for i in range(N):
    dic.add(str(input()))

dic.sort()

for i in list(dic):
    print(i)

Submission status: Runtime Error

Solution code:
n = input()
a = input().split("")
b = list(set([x for x in a if a.count(x) > 2]))

for i in b:
  print(i)

Submission status: Runtime Error

Solution code:
from collections import Counter

N = int(input())
ss = []
for i in range(N):
  ss.append(input())

c = Counter(ss)

max_count = max(c.values())

out_k = []
for k, v in c.items():
  if v == max_count:
    out_k.append(k)
sort(out_k)
for k in out_k:
  print(k)

Submission status: Runtime Error

Solution code:
input_line=int(input())
count=0
input_list=[]
while count < input_line:
  input_list.append(input())
  count+=1
ans={}
max_appeard=0
ans_list=[]
list_set=set[ans_list]
for item in list_set:
    appeard=input_list.count(item)
    ans[item]=appeard
    if appeard > max_appeard:
        max_appeard=appeard
for key,value in ans.items():
    if value==max_appeard:
        ans_list.append(key)
ans_list.sort()
for item in ans_list:
  print (item)

Submission status: Runtime Error

Solution code:
dct = {}
for i in range(N):
    S = input()
    if dct.get(S) == None:
        dct[S] = 1
    else:
        dct[S] += 1
sortedDct = sorted(dct.items(), key=lambda x: -x[1])
L = []
maxNum = 0
for k, v in sortedDct:
    if (maxNum <= v):
        L.append(k)
        maxNum = v
L.sort()
for l in L:
    print(l)

Submission status: Runtime Error

Solution code:
if __name__ == '__main__':
    N = int(input())
    kv = collections.defaultdict(int)
    max_cnt = 0
    res = []
    for _ in range(N):
        word = input()
        kv[word] += 1
        if kv[word] == max_cnt:
            res.append(word)
        elif kv[word] > max_cnt:
            res = [word]
            max_cnt = kv[word]
    print('\n'.join(sorted(res)))

Submission status: Runtime Error

Solution code:
def mostFrequent(L):
  return max(set(L), key = L.count)

N = input()
L = []
for i in range(0,N):
  L.append(input())
print(mostFrequent(L))

Submission status: Runtime Error

Solution code:
def mostFrequent(L):
  return max(set(A), key = A.count)

N = input()
L = []
for i in range(0,N):
  L.append(input())
print(mostFrequent(L))

Submission status: Runtime Error

Solution code:
N = int(input())
dicta = {}
for i in range(N):
    word = input()
    dicta.setdefault(word, 0)
    dicta[word] += 1
word_c = list(dicta.items())
word_c.sort(key=lambda tup: tup[1], reverse=True)
max_len_word = [word_c[0][0]]
for j in range(1,N):
    if word_c[j][1] == word_c[0][1]:
        max_len_word.append(word_c[j][0])
    else:
        break
max_len_word.sort()
for word in max_len_word:
    print(word)

Submission status: Runtime Error

Solution code:
N = input()
L = []
for i in range(0,N):
	L.append(input())
    
def mostFrequent(L):
  return max(set(A), key = A.count)

print(mostFrequent(L))

Submission status: Runtime Error

Solution code:
N = int(input())

dicts = {}

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

dicts = sorted(dicts.items(), key=lambda x:x[1])
max_list = []

buf = dicts[1][1]
for k, v in dicts:
    if v == buf:
        max_list.append(k)
    else:
        break

for k in max_list:
    print(k)

Submission status: Runtime Error

Solution code:
n=int(input())
s=[]
ansl=[]
for i in range(n):
    s.append(input())
counter = Counter(s)
max=counter.most_common(1)[0][1]
for w in counter.most_common():
    if w[1]==max:
        ansl.append(w[0])
ansl.sort()
for i in range(len(ansl)):
    print(ansl[i])

Submission status: Runtime Error

Solution code:
N = int(input())
S = []
for i in range(N):
  S.append(input())
m = max(S.count(S[i]), for i in range(N))
S_new = set(S)
for s in S_new:
  if m == S.count(s):
    print(s)

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define ffor(i,n) for(int i = 0;i < (n); ++i)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pii>
#define ff first
#define ss second
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int n;
    cin >> n;
    map<string,int> mp;
    for(int i = 0;i < n; ++i){
        string s;
        cin >> s;
        mp[s]++;
    }
    int maxi = 0;
    for(auto x : mp){
        maxi = max(maxi,x.second);
    }
    set<string> st;
    for(auto x : mp){
        if(x.second == maxi){
            st.insert(x.first);
        }
    }
    for(auto x : st){
        cout << x << '\n';
    }
}

Submission status: Runtime Error

Solution code:
def resolve():
    import collections
    n = int(input())
    c = list(collections.Counter([int(input()) for _ in range(n)]).most_common())
    s = []
    m = c[0][0]
    for i in c:
        if c !=m:
            break
        s.append(i[0])
    s.sort()
    print("\n".join(s))
resolve()

Submission status: Runtime Error

Solution code:
i=int(input())
l=[""]*i
for k in range(i):
  l[k]=input()
l.sort()
maxi=0
kosu=0
for k in l:
  kosu+=1
  if kosu=maxi:
    li.append(k)
  elif kosu>maxi:
    li.clear()
    li.append(k)
print(*li)

Submission status: Runtime Error

Solution code:
import collections

n = int(input())

l = []

for i in range(n):
    l.append(input())
c = collections.Counter(l)
cx = c.most_common()
nm = cx[0][1]
for i in range(n):
    if (nm == cx[i][1]):
        print(cx[i][0])
    else:
        break

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read

N,*S=read().split()
cnt=0
res=[]
for s in S:
  x=S.count(S)
  if cnt<x:
    cnt=x
    res=[s]
  elif cnt=x:
    res.append(s)
print(sorted(res))

Submission status: Runtime Error

Solution code:
import sys
import math
import fractions
import bisect
import queue
import heapq
from collections import deque
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint=====================================
N, K = map(int, input().split())

A, B = map(int, input().split())

H, W = map(int, input().split())

L, R = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

A = list(map(int,input().split()))
B = list(map(int,input().split()))

D = list(map(int,input().split()))

L = list(map(int,input().split()))
R = list(map(int,input().split()))

T = list(map(int,input().split()))

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
B = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    A.append(x1)
    B.append(y1)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''

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

S.sort()

ans = []
now = 0
renzoku = 0
fin = 0

for i in range(N):
    if S[now] !=S[i]:
        renzoku = i-now
        if i == 1:
            ans.append(S[0])
            fin = 1


        if fin < renzoku:
            ans.clear()
            ans.append(S[i-1])
            now=i
            fin = renzoku
            renzoku = 0
        elif fin == renzoku:
            ans.append(S[i-1])
            now=i
            fin = renzoku
            renzoku = 0

    elif i == N-1:
        renzoku = i-now+1
        if fin < renzoku:
            ans.clear()
            ans.append(S[i-1])
            now=i
            fin = renzoku
            renzoku = 0
        elif fin == renzoku:
            ans.append(S[i-1])
            now=i
            fin = renzoku
            renzoku = 0

ans.sort()
for i in range(1, len(ans)):
    if ans[i] == ans[i-1]:
        ans.remove()


for a in ans:
    print(a)

Submission status: Runtime Error

Solution code:
N = int(input())

dicts = {}

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

max_list = [kv[0] for kv in d.items() if kv[1] == max(dicts.values())]

print(sorted(max_list))

Submission status: Runtime Error

Solution code:
N = int(input())
C = {}
for _ in range(N):
    s = input().strip()
    if s not in C:
        C[s] = 0
    C[s] += 1
C = sorted(list(C.items()),key=lambda x:x[0])
C = sorted(C,key=lambda x:x[1],reverse=True)
k = C[0][1]
for i in range(N):
    if C[i][1]==k:
        print(C[i][0])
    else:break

Submission status: Runtime Error

Solution code:
import sys
readline = sys.stdin.readline

N = int(readline())
A = list(map(int, readline().split()))

for n in A:
    if n % 2 == 0:
        if not (n % 3 == 0 or n % 5 == 0):
            print('DENIED')
            exit(0)

print('APPROVED')

Submission status: Runtime Error

Solution code:
from collections import defaultdict

n = int(input())
counts = defaultdict(int)

for _ in range(n):
    counts[input().strip()] += 1

vec = sorted([(-value, key) in counts.items()], reverse=True)
best = vec[0][0]
for v, s in vec:
    if v != best:
        break
    print(s)

Submission status: Runtime Error

Solution code:
N = int(input())
words = []
for _ in range(N):
    words.append(input())
count_table = {}
for w in words:
    if w in count_table:
        count_table[w] += 1
    else:
        count_table[w] = 0
best_count = 0
for w in count_table:
    if best_count < count_table[w]:
        best_count = count_table[w]
        best_words = [w]
    elif best_count == count_table[w]:
        best_words.append(w)
for w in sorted(best_words):
    print(w)

Submission status: Runtime Error

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

n = int(input())
sss = open(0).read().split()

m = {}
for s in sss:
    if s in m:
        m[s] += 1
    else:
        m[s] = 1

items = m.items()
items = list(sorted(items, key=lambda i:i[0]))
items = list(sorted(items, key=lambda i: i[1], reverse=True))

max_ = items[0][1]
i = 0
while i<len(items) and items[i][1] == max_:
    print(items[i][0])
    i+=1

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input())
S = ['_']*n
for i in range(n):
    S[i] = input()
cS = Counter(S).most_common()
mx = cS[0][1]
ans = []
for i in range(n):
    if cS[i][1]==mx:
        ans.append(cS[i][0])
    else:
        break
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[i])

Submission status: Runtime Error

Solution code:
//#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <stack>
#include <deque>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <time.h>
#include <stdio.h>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<typename T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }
template<typename T>
void vdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) {
		if (i == da.size() - 1) std::cout << da[i];
		else std::cout << da[i] << ' ';
	}
	std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
	for (int i = 0;i < da.size();i++) vdeb(da[i]);
	std::cout << std::endl;
}
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<string> da(n);
	rip(i,n,0) cin >> da[i];
	map<string, int> mp;
	rip(i,n,0){
		if(mp.count(da[i])){
			mp[da[i]]++;
		}
		else{
			mp[da[i]] = 1;
		}
	}
	vector<string> ans(0);
	int ma = 0;
	for(auto i:mp){
		chmax(ma, i.second);
	}
	for(auto i:mp){
		if(ma == i.second){
			ans.push_back(i.first);
		}
	}
	rip(i, ans.size(),0){
		cout << ans[i] << endl;
	}
}

Submission status: Runtime Error

Solution code:
from sys import setrecursionlimit as srl; srl(10**7)
rr = lambda: int(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