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:
#　文字列の並べ替え
N = int(input())
list_S = [input() for i in range(N) ]
list_S.sort()
#　同一文字列の回数を数える
list_a = []
a = 1
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a)
        a = 1
list_a.append(a)

#　最大回数がわかりやすくなるように並べ替え
newlist_a = sorted(list_a,reverse=True)

# 最大回数の個数で場合分け
n = newlist_a.count(newlist_a[0])

list_ans = []
if n == 1:
# list_aにおける最大回数のインデックスを調べる
    t = list_a.index(newlist_a[0])
# list_aにおけるインデックスtまでの要素の数を調べて再頻出の文字列を書き出す
    m = 0
    for i in range(t):
        m += list_a[i]
    list_ans.append(list_S[m+t])
else:
# list_aにおける最大回数のインデックスを把握
    list_A = []
    for i in range(len(list_a)):
        list_A.append(list_a[i])
    list_t = []
    list_t.append(list_A.index(newlist_a[0]))
    for i in range(newlist_a.count(newlist_a[0])-1):
        list_A.remove(newlist_a[i])
        list_t.append(list_A.index(newlist_a[i])+i+1)
        
    for i in range(len(list_t)):
        m = 0
        for j in range(list_t[i]):
            m += list_a[j]
        if newlist_a[0]==1:
            list_ans.append(list_S[m])
        else:
            list_ans.append(list_S[m+list_t[i]])
list_ans.sort()
print(list_ans)

Submission status: Runtime Error

Solution code:
# ABC 155 C
import numpy as np
N = int(input())
S = [str(input()) for i in range(N)]
S = np.array(S)
 
uni, count = np.unique(S, return_counts=True)
max_list = np.argwhere(count==np.max(count))
for index in max_list:
    print(str(uni[index][0]))

Submission status: Runtime Error

Solution code:
# ABC 155 C
import numpy as np
N = int(input())
S = [str(input()) for i in range(N)]
S = np.array(S)

uni, count = np.unique(S, return_counts=True)
max_list = np.argwhere(count==np.max(count))
for index in max_list:
    print(uni[index][0])

Submission status: Runtime Error

Solution code:
N=int(input())
word=[list(map(str,input().split())) for i in range(N)]
word.sort()
#print(word)
answer=[]
for i in range(N-1):
    q=0
    while True:
        for j in range(N-i-1):
            if word[i+j]==word[i+j+1]:
                q+=1
            else:
                newdata=[-q,word[i]]  
                i=i+j
                break      
        answer.append(newdata)
        break
newdata=[0,word[N-1]]
answer.append(newdata)
answer.sort(reverse=True)        
#print(answer)
q=answer[len(answer)-1][0]
for i in range(len(answer)):
    if answer[len(answer)-1-i][0]==q:
        print(answer[len(answer)-1-i][1][0])

Submission status: Runtime Error

Solution code:
from itertools import groupby

n = int(input())

words = []

for i in range(n):
    words.append(input())

words.sort()

count_w = {}

for key, value in groupby(words):
    count_w[key] = len(list(value))

for i in list(count_w.keys):
    if count_w[i] == max(list(count_w.values)):
        print(i)

Submission status: Runtime Error

Solution code:

import numpy as np

N = int(input())
S = [input() for x in range(N)]
S = np.array(S)
U, counts = np.unique(S, return_counts=True)
T = np.where(counts == counts.max())
for ans in U[T] :
    print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
from collections import Counter
def main():
    N = int(input())
    S = [str(input()) for i in range(N)]
    c = Counter(S)
    ans = []
    tmp = []
    tmp = c.most_common()
    cmax = c.most_common()[0][1]
    for i in range(N):
        if tmp[i][1] != cmax:
            break
        ans.append(tmp[i][0])
    ans.sort()
    print('\n'.join(ans))
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import collections
def main():
    N = int(input())
    S = [str(input()) for i in range(N)]
    c = collections.Counter(S)
    ans = []
    tmp = []
    tmp = c.most_common()
    cmax = c.most_common()[0][1]
    for i in range(N):
        if tmp[i][1] != cmax:
            break
        ans.append(tmp[i][0])
    ans.sort()
    print('\n'.join(ans))
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import collections
def main():
    N = int(input())
    S = [str(input()) for i in range(N)]
    c = collections.Counter(S)
    ans = []
    tmp = []
    tmp = c.most_common()
    cmax = c.most_common()[0][1]
    for i in range(N):
        if tmp[i][1] != cmax:
            break
        ans.append(tmp[i][0])
    ans.sort()
    for j in ans:
        print(j)
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import collections
def main():
    N = int(input())
    S = [str(input()) for i in range(N)]
    c = collections.Counter(S)
    ans = []
    for i in range(N):
        if c.most_common()[i][1] != c.most_common()[0][1]:
            break
        ans.append(c.most_common()[i][0])
    ans.sort()
    for j in ans:
        print(j)
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n=int(input())
l=[]
L=[]
for _ in range(n):
  s=input()
  l.append(s)
import collections
c = collections.Counter(l)

for i in range(n):
  L.append(c.most_common()[i][0])
  if i!=n-1:
    if c.most_common()[i][1] != c.most_common()[i+1][1]:
      break
L.sort()
L=' '.join(L)
print(L)

Submission status: Runtime Error

Solution code:
n=int(input())

jisho={}

for _ in range(n):
    s=input().strip()
    
    if s not in jisho:
        jisho[s]=1
    
    else:
        jisho[s]+=1

word_list = []
for word, count in jisho.items():
    word_list.append((-count, word))

word_list.sort()

mx=word_list[0][0]

ans=[]

for i in range(n):
    if word_list[i][0]==mx:
        ans.append(word_list[i][1])
    else:
        break
        
ans.sort()

for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
n=int(input())

jisho={}

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

word_list = []
for word, count in jisho.items():
    word_list.append((-count, word))

word_list.sort()

mx=word_list[0][0]

ans=[]

i=0

while 1:
    if word_list[i][0]==mx and i <= n:
        ans.append(word_list[i][1])
        i+=1
    else:
        break
        
ans.sort()

for j in ans:
    print(j)

Submission status: Runtime Error

Solution code:
n=int(input())

jisho={}

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

word_list = []
for word, count in jisho.items():
    word_list.append((-count, word))

word_list.sort()

mx=word_list[0][0]

ans=[]

for i in range(n):
    if word_list[i][0]==mx:
        ans.append(word_list[i][1])
    else:
        break
        
ans.sort()

for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
n=int(input())

jisho={}

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

word_list = []
for word, count in jisho.items():
    word_list.append((-count, word))

word_list.sort()

mx=word_list[0][0]

ans=[]

for i in range(n):
    if word_list[i][0]==mx:
        ans.append(word_list[i][1])
    else:
        break
        
ans.sort()

for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
n=int(input())

s=0
ls=[]

jisho={}

for _ in range(n):
    s=input()
    
    if s not in ls:
        jisho[s]=1
    
    else:
        jisho[s]+=1
    
    ls.append(s)

word_list = []
for word, count in jisho.items():
    word_list.append([count, word])

word_list.sort()
word_list.reverse()

mx=word_list[0][0]

ans=[]

for i in range(n):
    if word_list[i][0]==mx:
        print(word_list[i][1])
    else:
        break

Submission status: Runtime Error

Solution code:
n=int(input())

s=0
ls=[]

jisho={}

for _ in range(n):
    s=input()
    
    if s not in ls:
        jisho[s]=1
    
    else:
        jisho[s]+=1
    
    ls.append(s)

word_list = []
for word, count in jisho.items():
    word_list.append([count, word])

word_list.sort()
word_list.reverse()

mx=word_list[0][0]

ans=[]

for i in range(n):
    if word_list[i][0]==mx:
        ans.append(word_list[i][1])
    else:
        break

ans.sort()

for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
import collections

N = int(input())
words = []
top = int()
for i in range(N):
    words.append(input())
c = collections.Counter(words)

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

top = int(c_sorted[0][1])
answer = []
count = int(0)
for i in range(N):
    if int(c_sorted[i][1]) == top:
        answer.append(c_sorted[i][0])
        count = count + 1
    else:
        break

answer.sort()

for i in range(count):
    print(answer[i])

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
from collections import Counter
# input
n = int(input())
s = []
for i in range(n):
    s.append(input())
c = Counter(s)
# output
#ma = c.most_common()[0][1]
o = list(k for k, v in s.items() if v == s.most_common()[0][1])
#o = [k for k, v in c.items() if v == ma]
o.sort()
print('\n'.join(o))

Submission status: Runtime Error

Solution code:
n = int(input())
s = []
ans = []
for i in range(n):
  s.append(input())
s = sorted(s)
max_count = 1
count = 1
for i in range(n):
  if s[i] == s[i+1]:
    count += 1
    if count == max_count:
      ans.append(s[i])
    if count > max_count:
      max_count = count
      ans = [s[i]]
  else:
    count = 1
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i])

Submission status: Runtime Error

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

ans = []
c = max(d.values())
for k,v in d.items():
  if v == c:
    ans += [k]
for x in sorted(ans):
  print(x)

Submission status: Runtime Error

Solution code:
from collections import defaultdict
s = defaultdict()
m = 0
for _ in range(int(input())):
  t = input()
  s[t] += 1
  m = max(m, s[t])
ans = []
for el in s:
  if s[el] == m:
    ans.append(el)
ans.sort()
for a in ans:
  print(a)

Submission status: Runtime Error

Solution code:
a=int(input())
s=[input()for _ in range(a)]
c=Counter(s)
m=0 
m=max(m,v)
ans=[]
for k,v in c.items():
    if m == v:
        ans.append(k)
ans.sort()
print(ans)

Submission status: Runtime Error

Solution code:
mport collections
def main():
    n = int(input())
    S = sorted([input() for s in range(n)])
    c = collections.Counter(S)
    c = c.most_common()
    maxi = c[0][1]
    ans = []
    for i in range(len(c)):
        if (c[i][1]==maxi):
            ans.append(c[i][0])
    ans = '\n'.join(ans)
    print(ans)
main()

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    S = sorted([input() for s in range(n)])
    D = list(set(S))
    count = []*len(D)
    for i in range(len(D)):
        count[i] = S.count(D[i])
    maxi = max(count)
    for i in range(len(D)):
        if(count[i]==maxi):
            print(D[i])
main()

Submission status: Runtime Error

Solution code:
n = int(input())
length = 0
word_list = []
for i in range(n):
  word = input()
  if len(word) > length:
    word_list = [word]
  if len(word) = length:
    word_list.append(word)
word_list.sort()
for k in range(len(word_list)):
  print(word_list[k])

Submission status: Runtime Error

Solution code:
n = int(input())
length = 0
word_list = []
for i in range(n):
  word = input()
  if len(word) > length:
    word_list = [word]
  if len(word) = length:
    word.append(word_list)
word_list.sort()
for k in range(len(word_list)):
  print(word_list[k])

Submission status: Runtime Error

Solution code:
import collections

n=int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)

values, counts = zip(*c.most_common())
print(values)

counts = set(counts)
counts = list(counts)
num = counts[-1]
print(num)


for i in range(num):
  print(values[i])

Submission status: Runtime Error

Solution code:
N = input()
dic = {}
max = 0
for i in range(int(N)):
  word = input()
  if word not in dic.keys():
    
    if max == 0:
      max += 1
    dic['word'] = 1
    
  else:
    
    if max == dic['word']:
      max += 1
    dic['word'] += 1
    
candidates = sorted([word for word in dic.keys() if dic[key] == max])
for word in candidates:
  print(word)

Submission status: Runtime Error

Solution code:
n = input()
words_org = []
for i in range(int(n)):
  words_org.append(input())
print(words_org)

countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1], reverse=True)
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
for word in sorted(candidates):
  print(word)

Submission status: Runtime Error

Solution code:
n = input()
words_org = []
for i in range(int(n)):
  words_org.append(input())

countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1], reverse=True)
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
for word in sorted(candidates):
  print(word)

Submission status: Runtime Error

Solution code:
n = input()
words_org = []
for i in range(int(n)):
  words_org.append(input())

countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1], reverse=True)
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
for word in sorted(candidates):
  print(word)

Submission status: Runtime Error

Solution code:
n = input()
words_org = []
for i in range(n):
  words_org.append(input())
countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1])
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
for word in sorted(candidates):
  print(word)

Submission status: Runtime Error

Solution code:
n=int(input())
newlist=list()
for i in range(0,n):
  x=str(input())
  newlist.append(x)
newlist.sort()
dic=dict()
for i in newlist:
  x=newlist.count(i)
  dic[x]=list()
for i in newlist:
  x=newlist.count(i)
  dic[x].append(i) 
max=len(dic)
s=set(dic[max])

for i in s:
  print(i)

Submission status: Runtime Error

Solution code:
n = int(input())
S = []
for _ in range(n):
    S.append(input())

d = {}
for s in S:
  if s in d:
    d[s] += 1
  else:
    d[s] = 1

ans = 0
for i in d.values():
  if ans < i:
    ans = i

sor = sorted(d.keys())
for k, v in sor.items():
  if ans == v:
    print(k)

Submission status: Runtime Error

Solution code:
m=int(input())
Ss=[input() for _ in range(m)]
s1=set(Ss)
num=[]
voc=[]
for l in s1:
    n=Ss.count(l)
    num.append(n)
res=[]
for i,w in enumerate([n==max(num) for n in num]):
    if w:
        res.append(s1[i])
res.sort()
print(res)

Submission status: Runtime Error

Solution code:
import numpy as np
import pandas as pd
N=int(input())
s=[]
for _ in range(N):
    s.append(input())
S = pd.DataFrame(np.array(s).T, columns = ["V1"])
freqmax = max(S["V1"].value_counts())
ans = S["V1"].value_counts()[S["V1"].value_counts() == freqmax].keys()
C = []
for x in ans:
    C.append(x)
C.sort()
for i in C:
    print(i)

Submission status: Runtime Error

Solution code:
import numpy as np
import pandas as pd
N=int(input())
s=[]
for _ in range(N):
    s.append(input())
S = pd.DataFrame(np.array(s).T, columns = ["V1"])
#print(S)
#print(S["V1"].value_counts())
freqmax = max(S["V1"].value_counts())
#print(freqmax)
#print(S["V1"].value_counts() == freqmax)
#print(S["V1"].value_counts()[S["V1"].value_counts() == freqmax])
#print(S["V1"].value_counts()[S["V1"].value_counts() == freqmax].keys())
ans = S["V1"].value_counts()[S["V1"].value_counts() == freqmax].keys()
C = []
for x in ans:
    C.append(x)
C.sort()
for i in C:
    print(i)

Submission status: Runtime Error

Solution code:
import numpy as np
import pandas as pd
N=int(input())
s=[]
for _ in range(N):
    s.append(input())
S = pd.DataFrame(np.array(s).T, columns = ["V1"])
#print(S)
#print(S["V1"].value_counts())
freqmax = max(S["V1"].value_counts())
#print(freqmax)
#print(S["V1"].value_counts() == freqmax)
#print(S["V1"].value_counts()[S["V1"].value_counts() == freqmax])
#print(S["V1"].value_counts()[S["V1"].value_counts() == freqmax].keys())
ans = S["V1"].value_counts()[S["V1"].value_counts() == freqmax].keys()
for x in ans:
    print(x)

Submission status: Runtime Error

Solution code:
def com_str(A,B,i):
    ans=A
    if(A==B):
        pass
    elif(ord(A[i])>ord(B[i])):
        pass
    elif(ord(B[i])>ord(A[i])):
        ans=B
    else:
        ans=com_str(A,B,i+1)
    return ans

def quick_sort_str(list,N):
    stand=list[0]
    over=[]
    same=[]
    under=[]
    for i in list:
        if(i[N]!=stand[N]):
            if(stand[N]==com_str(i[N],stand[N],0)):
                over.append(i)
            else:
                under.append(i)
        else:
            same.append(i)
    if(len(over)>1):
        over=quick_sort_str(over,N)
    else:
        pass
    if(len(under)>1):
        under=quick_sort_str(under,N)
    else:
        way=[same[0][0],len(same)]
        same.clear()
        same.append(way)
    return over+same+under

def quick_sort_num(list,N):
    stand=list[0]
    over=[]
    same=[]
    under=[]
    for i in list:
        if(i[N]>stand[N]):
            over.append(i)
        elif(i[N]<stand[N]):
            under.append(i)
        else:
            same.append(i)
    if(len(over)>1):
        over=quick_sort_num(over,N)
    else:
        pass
    if(len(under)>1):
        under=quick_sort_num(under,N)
    else:
        pass

    return over+same+under

N=int(input())
S=[[] for i in range(N)]
for i in range(N):
    S[i].append(str(input()))
    S[i].append(1)
S=quick_sort_str(S,0)
S=quick_sort_num(S,1)
count=S[0][1]
for i in range(len(S)):
    if(S[i][1]==count):
        print(S[i][0])
    else:
        break

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
listA = []
for i in range(N):
    listA.append(input())
c = collections.Counter(listA)
c = c.most_common()
max_number = c[0][1]
print(c[0][0])
for i in range(1,N+1):
    if max_number == c[i][1]:
        print(c[i][0])
    else:
        exit()

Submission status: Runtime Error

Solution code:
n=int(input())
words=list(map(str,input().split()))
result=[]
size=0

for i in range(n):
  if words[i] not in result:
    if words.count(words[i])>=size+1:
      size=words.count(words[i])
      result.clear()
      result.append(words[i])
    elif words.count(words[i])==size+1:
      result.append(words[i])
    else:
      countinue

result.sort()
print(result)

Submission status: Runtime Error

Solution code:
n=int(input())
words=list(map(str, input().split()))
result=[]
index=0
size=0

for i in range(n):
    if words.count(words[i]) >=size+1:
        size=words.count(words[i])
        result.clear()
        result.append(words[i])
    elif words.count(words[i])==size and words[i] not in result:
            result.append(words[i])
    else:
        countine
result.sort()
print(result)

Submission status: Runtime Error

Solution code:
n=int(input())
words=list(input().split())
result=[]
index=0
size=0

for i in range(n):
    if words.count(words[i]) >=size+1:
        size=words.count(words[i])
        result.clear()
        result.append(words[i])
    elif words.count(words[i])==size and words[i] not in result:
            result.append(words[i])
    else:
        countine
result.sort()
print(result)

Submission status: Runtime Error

Solution code:
n=int(input())
words=list(input().split())
result=[]
index=0
size=0
 
for i in range(n):
  if words.count(words[i]) >size:
    size=words.count(words[i])
    result.clear()
    result.append(words[i])
  elif words.count(words[i])==size:
    if words[i] not in result:
      result.append(words[i])
 
print(result)

Submission status: Runtime Error

Solution code:
n=int(input())
words=list(input().split())
result=[]
index=0
size=0

for i in range(n):
    if words.count(words[i]) >size:
        size=words.count(words[i])
        result.clear()
        result.append(words[i])
    elif words.count(words[i])==size:
        if words[i] not in result:
            result.append(words[i])
    else:
        countine

print(result)

Submission status: Runtime Error

Solution code:
N=int(input())
S = {}
for i in range(N):
    let = input()
    try:
        S[let] += 1
    except:
        S[let] = 1
max_val = max(S.values())
answers = []
for k,v in S.items():
    if v == max_val:
        answers.append(k)
ansewrs.sort()
for ans in ansewrs:
    print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
S = {}
for i in range(n):
    let = input()
    try:
        S[let] += 1
    except:
        S[let] = 1
max_val = max(S.values())
key for key in d:
    if S[key] == max_val:
        print('\d'.join(S[key]))

Submission status: Runtime Error

Solution code:
N = int(input())
*S = map(int, open(0).read().split())
SS = {}
for i in range(N):
    if S[i] in SS:
        SS[S[i]] +=1
    else:
        SS[S[i]] = 1
SS = ser = ser.sort_values(ascending=False)
for i in range(N+1):
    print(SS[i])
    if SS[i] != SS[i + 1]:
        break

Submission status: Runtime Error

Solution code:
n=int(input())
d=dict()

for i in range(n):
  a=input()
  d.setdefault(s,0)
  d[s] += 1

mx=0
result=[]
for key,value in d.items:
  if mx < value:
    mx = value
    result=[key]
  elif mx == value:
    result.append(key)

result.sort()

for i in range(len(result)):
  print(i)

Submission status: Runtime Error

Solution code:
from sys import stdin, stdout
from collections import defaultdict
n = int(stdin.readline().strip())
word_map = defaultdict(lambda: 0)
maxi = 0
for i in range(n):
  word = stding.readline().strip()
  x = word_map[word]
  word_map[word] = x + 1
  maxi = max(maxi, x+1)
  
word_list = []
for key, value in word_map.items():
  if value == maxi:
    word_list.append(key)
word_list.sort()
for word in word_list:
  stdout.write(word+'\n')

Submission status: Runtime Error

Solution code:
#include                            <iostream>
#include							<list>
#include                            <stdio.h>
#include                            <math.h>
#include                            <string.h>
#include                            <time.h>
#include                            <stdlib.h>
#include                            <string>
#include                            <bitset>
#include                            <vector>
#include                            <set>
#include                            <map>
#include                            <queue>
#include                            <algorithm>
#include                            <sstream>
#include                            <stack>
#include                            <iomanip>
#include                            <numeric>
#include							<unordered_map>
#include <cassert>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace __gnu_pbds;
using namespace std;
typedef
tree <
int,
null_type,
less_equal<int>,
rb_tree_tag,
tree_order_statistics_node_update >
set_t;

using namespace                     std;
#define MOD                         1000000007
#define int                         int64_t
#define baba_shiv                   ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mpii                        map<int,int>
#define pb                          push_back
#define mkp                         make_pair
#define all(x)                      x.begin(),x.end()
#define allr(x)                     x.rbegin(),x.rend()
#define ub(v,x)                     upper_bound(all(v),x)
#define lb(v,x)                     lower_bound(all(v),x)
#define bs(v,x)                     binary_search(all(v),x)
#define gcd(a,b)                    __gcd(a,b)
#define lcm(a,b)                    (((a*b))/__gcd(a,b))
#define vi                          vector<int>
#define pii                         pair<int,int>
#define vpii                        vector<pii>
#define vs                          vector<string>
#define ff                          first
#define ss                          second

#define double						long double
/***********************************************************************************************************************/
template < typename F, typename S >
ostream& operator << ( ostream& os, const pair< F, S > & p ) {
	return os << "(" << p.first << ", " << p.second << ")";
}

template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
	os << "{";
	typename vector< T > :: const_iterator it;
	for ( it = v.begin(); it != v.end(); it++ ) {
		if ( it != v.begin() ) os << ", ";
		os << *it;
	}
	return os << "}";
}

template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
	os << "[";
	typename set< T > :: const_iterator it;
	for ( it = v.begin(); it != v.end(); it++ ) {
		if ( it != v.begin() ) os << ", ";
		os << *it;
	}
	return os << "]";
}

template < typename F, typename S >
ostream &operator << ( ostream & os, const map< F, S > &v ) {
	os << "[";
	typename map< F , S >::const_iterator it;
	for ( it = v.begin(); it != v.end(); it++ ) {
		if ( it != v.begin() ) os << ", ";
		os << it -> first << " = " << it -> second ;
	}
	return os << "]";
}

#define deb(x) cerr<< #x << " = " << x << endl;

/***********************************************************************************************************************/

signed main()
{
	baba_shiv;
	int n;
	cin >> n;
	map<string, int> mp;
	for (int i = 0; i < n; i++)
	{
		string s;
		cin >> s;
		mp[s]++;
	}
	int maxa = 0;
	for (auto it : mp)
	{
		maxa = max(maxa, it.ss);
	}
	for (auto it : mp)
	{
		if (it.ss == maxa)
		{
			cout << it.ff << endl;
		}
	}
}

Submission status: Runtime Error

Solution code:
N = int(input())
S = [input() for x in range(N)]
S.sort()

T = [[S[0]]]
for i in S[1:N]:
  if i == T[-1][-1]:
    T[-1].append(i)
  else:
    T.append([i])
T.sort(key=lambda x: len(x))
U = []

U.append(T[-1][0])
c = -2
while len(T[-1]) == len(T[c]):
  U.append(T[c][0])
  c -= 1
  
U.sort()
for x in U:
  print(x)

Submission status: Runtime Error

Solution code:
from collections import OrderedDict

#入力
N = int(input())
S = [input() for i in range(N)]

#出現回数のカウント
c = OrderedDict(collections.Counter(S))
ln = len(c.values())

#多い順に並べ替えた辞書をつくる
d = OrderedDict(sorted(c.items(), key = lambda x : x[1], reverse=True))
dval = list(d.values())
dkey = list(d.keys())

#回数が多い単語を抜き出したリストの制作
word = list()
word.append(dkey[0])
i=1
if ln>1:
    while dval[i-1]==dval[i]:
        word.append(dkey[i])
        i+=1
        if i==ln:
            break

#辞書順に並べ替える
dic = sorted(word)

#表示
for i in range(len(dic)):
    print(dic[i])

Submission status: Runtime Error

Solution code:
import collections
from collections import OrderedDict

#入力
N = int(input())
S = [input() for i in range(N)]

#出現回数のカウント
c = collections.Counter(S)
c_val = list(c.values())
c_key = list(c.keys())

"""
print(c)
print(c_val)
print(c_key)
"""

#多い順に並べ替えた辞書をつくる
c_sorted = OrderedDict(sorted(c.items(), key = lambda x : x[1], reverse=True))
c_sorted_val = list(c_sorted.values())
c_sorted_key = list(c_sorted.keys())

"""
print(c_sorted)
print(c_sorted_val)
print(c_sorted_key)
"""

#回数が多いものを抜き出したリストの制作
c_max = list(c_sorted_key[0])

i=1
if len(c_val)>1:
    while c_val[i-1]==c_val[i]:
        c_max.append(c_key[i])
        i+=1
        if i==len(c_max):
            break

"""
print(c_max)
"""

#keyを降順に並べ替え
c_max.sort()

"""
print(c_max)
print(c_max[0])
"""

#表示
for i in range(len(c_max)):
    print(c_max[i])

Submission status: Runtime Error

Solution code:
import collections
from collections import OrderedDict

#入力
N = int(input())
S = [input() for i in range(N)]

#出現回数のカウント
c = collections.Counter(S)
c_val = list(c.values())
c_key = list(c.keys())

"""
print(c)
print(c_val)
print(c_key)
"""

#多い順に並べ替えた辞書をつくる
c_sorted = OrderedDict(sorted(c.items(), key = lambda x : x[1], reverse=True))
c_sorted_val = list(c_sorted.values())
c_sorted_key = list(c_sorted.keys())

"""
print(c_sorted)
print(c_sorted_val)
print(c_sorted_key)
"""

#回数が多いものを抜き出したリストの制作
c_max = list(c_sorted_key[0])

i=1
if len(c_val)>1:
    while c_val[i-1]==c_val[i]:
        c_max.append(c_key[i])
        i+=1
        if i==len(c_max):
            break

"""
print(c_max)
"""

#keyを降順に並べ替え
c_max.sort()

"""
print(c_max)
print(c_max[0])
"""

#表示
i=0
while i!=len(c_max):
    print(c_max[i])
    i+=1

Submission status: Runtime Error

Solution code:
N = int(input())
S = {}
 
for i in range(N):
  key = sys.stdin.readline().rstrip()
  if key in S.keys():
    S[key] = S[key] + 1
  else:
    S[key] = 1
 
S_sorted = sorted(S.items(), reverse = True, key = lambda x : x[1])
 
A = [S_sorted[0][0]]
i = 0
l = len(S_sorted)
 
for i in range(l - 1):
  if S_sorted[i][1] == S_sorted[i + 1][1]:
    A = A + [S_sorted[i + 1][0]]
  else:
    break
  
A.sort()
for val in A:
  print(val)

Submission status: Runtime Error

Solution code:
import collections
from collections import OrderedDict

N = int(input())
l = list(map(int,input().split()))

for i in range(len(l)):
  if type(l[i]) == int:
    del l[i]

c = collections.Counter(l)

A = OrderedDict(sorted(c.items(), key=lambda x:x[1],reverse=True))
B = list(A.items())
l2 = [B[0][0]]

for i in range(len(B)-1):
    if B[i][1] == B[i+1][1]:
        l2.append(B[i+1][0])

for i in range(len(l2)):
  print(l[i])

Submission status: Runtime Error

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

for i in range(N):
  key = input()
  if key in S.keys():
    S[key] = S[key] + 1
  else:
    S[key] = 1

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

A = [S_sorted[0][0]]
i = 0

while S_sorted[i][1] == S_sorted[i + 1][1]:
  A = A + [S_sorted[i + 1][0]]
  i = i + 1
  
A.sort()
for val in A:
  print(val)

Submission status: Runtime Error

Solution code:
#C-Poll
import collections
n=int(input())
words = [input() for _ in range(n)]
count = collections.Counter(words)
leng = len(count)
Flg = True
ansallay = []
for num in range(n-1)
    #もし配列が1種類しかなかった場合はそれだけ足してbreakする
    if(leng == 1):
      ansallay.append(count.most_common()[num][0])
      break
    ansallay.append(count.most_common()[num][0])
    if(count.most_common()[0][1] != count.most_common()[num+1][1]):
        break
    num += 1
    if(num == leng-1):
      if(count.most_common()[0][1] == count.most_common()[num][1]):
        ansallay.append(count.most_common()[num][0])
      break
ansallay.sort()
for word in ansallay:
    print(word)