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:
def main():
	n = int(input())
	l = [str(input()) for i in range(n)]
	
	import collections

	c = collections.Counter(l)
	lc = sorted(list(c.items()), key = lambda x:x[1] , reverse = True)
	print(lc)
	ans = []
	checker = 0
	i = 0
	while checker == 0:
		if lc[i][1] == lc[0][1]:
			ans.append(lc[i][0])
		else:
			checker += 1
		i += 1

	ans.sort()
	print('\n'.join(map(str, ans)))

	
	
 
if __name__ == '__main__':
	main()

Submission status: Runtime Error

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

S=sorted(S)
T=[]
m=S.count(S[0])
T.append(S[0])
c=1
for i in range(1,N):
    if i==N-1:
        if S[i]==S[i-1]:
            c+=1
            if c>m:
                T.clear()
                T.append(S[i])
            elif c==m:
                T.append(S[i])
        else:
            if m==1:
                T.appned(S[i])
    
    elif S[i]==S[i-1]:
        c+=1
    else:
        if c>m:
            T.clear()
            T.append(S[i-1])
            m=c
            c=1
        elif c==m:
            T.append(S[i-1])
            m=c
            c=1

for j in range(len(T)):
    print(T[j])

Submission status: Runtime Error

Solution code:
import collections

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

c = collections.Counter(l)

L = c.most_common()

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

A = list(values)
B = list(counts)

b = B.count(B[0])

a = A[0:b + 1]

for i in a[0:]:
print(i)

Submission status: Runtime Error

Solution code:
N = int(input())

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

A = sorted(S)


c_in = 0
index = 0
isFirst = True
old_item_cnt = 0
ans = {}

while True:
    now_item_cnt = A.count(A[0])
    ans[A[0]] = now_item_cnt
    del A[0: now_item_cnt]
    if (len(A) == 0):
        break



ans_list = sorted(ans.items(), key=lambda x:x[1])



h = []
i = 0
while True:
    if i == 0:
        pass
    elif ans_list[-1][1] == ans_list[-1 * i][1]:
        h.append(ans_list[-1 * i][0])
    else:
        h.sort()
        break
    
    i += 1

for i in h:
    print(i)

Submission status: Runtime Error

Solution code:
import collections

N=int(input())
data=[input() for i in range(N)]
c = collections.Counter(data)
score=c
com=c.most_common()

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

val=score_sorted
L=len(val)
count="Yes"
ii=0
ansa=1
while count=="Yes":
    if val[ii][1]==val[ii+1][1]:
        ii+=1

        ansa+=1
        if ii == L-1:
            break
    else:
        count="No"
data2=[]
for i in range(ansa):
    data2.append(val[i][0])

data2.sort()
for i in range(ansa):
    print(data2[i])

Submission status: Runtime Error

Solution code:
import collections
n = int(input())
s = []
for i in range(n):
    s.append(input())
    
dic = collections.Counter(s)
dic = dic.most_common()

ans = [dic[0][0]]

for i in range(n):
    if dic[i][1] == dic[i+1][1]:
        ans.append(dic[i+1][0])
    else:
        break
        
ans = sorted(ans)

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

Submission status: Runtime Error

Solution code:
n = int(input())
wordlist = [input() for i in range(n)]
wordtuple = tuple(set(wordlist))
ans = []
a = len(wordtuple)
for j in range(a) :
    checklist.append(wordlist.count(wordtuple[j]))
anslist = [i for i, v in enumerate(checklist) if v == max(checklist)]
for k in anslist :
    ans.append(wordtuple[k])
ans.sort()
for l in range(len(ans)) :
    print(ans[l])

Submission status: Runtime Error

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

list1 = sorted(b.items(), key=lambda x: x[1])
list1.reverse()

a = 0
list2=[]
while list1[0][1] == list1[a][1]:
    list2.append(list1[a][0])
    list2.sort()
    a += 1

print(list2)

Submission status: Runtime Error

Solution code:
#C - Poll
import collections
N = int(input())
S = [str(input()) for i in range(N)]
S = sorted(S)
count = 1
tmpcount = 1
DP = [S[0]]
for i in range(1,N):
    if S[i] == S[i-1]:
        count += 1
        if tmpcount < count:
            DP.clear()
            DP.append(S[i])
            tmpcount = count
        elif tmpcount == count:
            DP.append(S[i])
        else:
            pass
    else:
        count = 1
        if tmpcount == count:
            DP.append(S[i])
        else:
            pass

for l in range(len(DP)):
     print(DP[l])

Submission status: Runtime Error

Solution code:
from collections import Counter
N = (int)(input())
A = [input() for i in range(N)]

B = Counter(A)


max = [kv for kv in B.items() if kv[1] == max(B.values())]
for i in reversed(max):
    print(i[0])

Submission status: Runtime Error

Solution code:
n = int(input())
wordlist = [input() for i in range(n)]
wordtuple = tuple(set(wordlist))
ans = []
a = len(wordtuple)
for j in range(a) :
    checklist.append(wordlist.count(wordtuple[j]))
anslist = [i for i, v in enumerate(checklist) if v == max(checklist)]
for k in range(len(anslist)) :
    ans.append(wordtuple[k])
ans.sort()
for l in range(len(ans)) :
    print(ans[l])

Submission status: Runtime Error

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

d = {}

for item in s:
    if item in d.keys():
        d[item] += 1
    else:
        d[item] = 1

start = time.time()
m = [k for k, v in d.items() if v == max(d.values())]
m.sort()
for item in m:
    print(item)

Submission status: Runtime Error

Solution code:
n=int(input())

dic=dict()
for i in range(n):
  s=input()
  if s not in dic:
    dic[s]=1
  else:
    dic[s]+=1
a=max(dic)
b=dic[a]
keys = [k for k, v in dic.items() if v == b]
keys.sort()
for i in range(n):
  print(keys[i])

Submission status: Runtime Error

Solution code:
import collections as col
N=int(input())
counts=[]
A=[]
S=[]
T=[]
U=[]
for _ in range(N):
    S.append(input())
T=sorted(S)
s=col.Counter(T)
values, counts = zip(*s.most_common())

print(values[0])
t=1
while counts[t]==counts[t-1]:
    print(values[t])
    t+=1

Submission status: Runtime Error

Solution code:
import collections

N=int(input())
data=[input() for i in range(N)]
c = collections.Counter(data)
score=c
com=c.most_common()

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

val=score_sorted

count="Yes"
ii=0
ansa=1
while count=="Yes":
    if val[ii][1]==val[ii+1][1]:
        ii+=1
        ansa+=1
    else:
        count="No"
data2=[]
for i in range(ansa):
    data2.append(val[i][0])
    
data2.sort()
for i in range(ansa):
    print(data2[i])

Submission status: Runtime Error

Solution code:
N=int(input())
a=[]
for i in range(N):
	a.append(input())
d={}
sor={}
for i in range(N):
    if a[i] in d.keys():
        d[a[i]]+=1
    else:
        d.setdefault(a[i],1)
sod = sorted(d.keys())
#max=sod["a[0]"]
maxval=0
for i in range(N):
    if maxval<=d[a[i]]:
        maxval=d[a[i]]
for i in range(N):
    if maxval==d[sod[i]]:
        print(sod[i])

Submission status: Runtime Error

Solution code:
import collections

N=int(input())
data=[input() for i in range(N)]
c = collections.Counter(data)
score=c
com=c.most_common()
#val=c.values()
#dada=list(val)
#dada.sort()
score_sorted = sorted(score.items(), key=lambda x:x[1], reverse=True)
#print(val)
#val.sort()
#print(dada)
#print(score_sorted)
val=score_sorted
#print("val==",val)
#key=score_sorted.keys()
#dada=list(val)
#dada.sort()
count="Yes"
ii=0
ansa=1
while count=="Yes":
    if val[ii][1]==val[ii+1][1]:
        ii+=1
        ansa+=1
    else:
        count="No"
data2=[]
for i in range(ansa):
    data2.append(val[i][0])
    #print(i,data2)
data2.sort()
for i in range(ansa):
    print(data2[i])

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
str = []
for i in range(N):
    str.append(input())
clist = collections.Counter(str).most_common()
most_num = clist[0][1]
most_str = []
for i in range(N):
    if clist[i][1] == most_num:
        most_str.append(clist[i][0])
    else:
        break
most_str.sort()
for i in range(len(most_str)):
    print(most_str[i])

Submission status: Runtime Error

Solution code:
N = int(input())
N, *d = map(int, open(0).read().split())
values, counts = zip(*d.most_common())
for i in values:
    print(i)

Submission status: Runtime Error

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

box = []
S_box = []
last = []
sss = set(S)
an = []

for k in sss:
    S_box.append(k)

for i in range(0, len(sss)):
    box.append(S.count(S_box[i]))

num = max(box)

for a in range(0, len(box)):
    if num == box[a]:
        last.append(a)

for iii in last:
    an.append(S_box[iii])
an = sorted(an)
for aaa in an:
    print(aaa)

Submission status: Runtime Error

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

count_dict = collections.Counter(data_list)

max_val = max(count_dict.values())
max_keys = [key for key in count_dict if count_dict[key] == max_val]

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

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
str = []
for i in range(N):
    str.append(input())
clist = collections.Counter(str).most_common()
most_num = clist[0][1]
most_str = []
for i in range(N):
    if clist[i][1] == most_num:
        most_str.append(clist[i][0])
    else:
        break
most_str.sort()
for i in range(len(most_str)):
    print(most_str[i])
    print()

Submission status: Runtime Error

Solution code:
N = int(input())
S = {}
for i in range(N):
    s = input()
    if s in S:
        S[s] += 1
    else:
        S[s] = 1
sorted_S = sorted(S.items(), key=lambda x: x[1], reverse=True)
a = []
count = -1
for s in sorted_S:
    if count == -1:
        a.append(s)
        count = sorted_S[s]
    elif count == sorted_S[s]:
        a.append(s)
    else:
        break
sorted_a = sorted(a)
for s in sorted_a:
    print(s)

Submission status: Runtime Error

Solution code:
N=int(input())
s10=[]*10
S=[s10]*N
Li=[0]*N
Ls=['']*N
Ld=[]
max_id=0
ii=0
ld=0
for i in range(N):
    S[i]=input()
for i in range(N):
    if S[i] in Ls:
        idx=Ls.index(S[i])
        Li[idx]+=1
        a=Li[idx]
    else:
        Li[ii]=1
        Ls[ii]=S[i]
        a=1
        ii+=1
    if max_id<a:
        Ld=[]
        Ld[0]=Ls[ii]
        ld=1
    elif max_id==a:
        Ld[ld]=Ls[ii]
        ld+=1
Ld=sorted(Ld)
for i in range(len(Ld)):
    print(Ld[i])

Submission status: Runtime Error

Solution code:
import collections

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

c = collections.Counter(l)

L = c.most_common()

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

A = list(values)
B = list(counts)

b = B.count(B[0])

a = A[0:b + 1]

for i in a[0:]:
print(i)

Submission status: Runtime Error

Solution code:
N=int(input())
s10=[]*10
S=[s10]*N
Li=[0]*N
Ls=['']*N
Ld=[]
max_id=0
ii=0
ld=0
for i in range(N):
    S[i]=input()
for i in range(N):
    if S[i] in Ls:
        idx=Ls.index(S[i])
        Li[idx]+=1
        a=Li[idx]
    else:
        Li[ii]=1
        Ls[ii]=S[i]
        a=1
        ii+=1
    if max_id<a:
        Ld=[]
        Ld[0]=ls[ii]
        ld=1
    elif max_id==a:
        Ld[ld]=ls[ii]
        ld+=1
Ld=sorted(Ld)
for i in range(len(Ld)):
    print(Ld[i])

Submission status: Runtime Error

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

box = []
S_box = []
last = []
sss = set(S)
an = []

for k in sss:
    S_box.append(k)

for i in range(0, len(sss)):
    box.append(S.count(S_box[i]))

num = max(box)

for a in range(0, len(box)):
    if num == box[a]:
        last.append(a)

for iii in last:
    an.append(S_box[iii])
an = sorted(an)
for aaa in an:
    print(aaa)

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
str = []
for i in range(N):
    str.append(input())
clist = collections.Counter(str).most_common()
most_num = clist[0][1]
most_str = []
for i in range(N):
    if clist[i][1] == most_num:
        most_str.append(clist[i][0])
    else:
        break
sort(most_str)
for i in range(len(most_str)):
    print(most_str[i])
    print()

Submission status: Runtime Error

Solution code:
N=int(input())
S = []
for j in range(N):
    S.append(input())
from collections import Counter
S2=collections.Counter(S)
S1=S2.most_common()

S3=[]
S3.append(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[0][1]:
        S3.append(S1[i][0])
    else:
        break
S3=sorted(S3)
[print(i) for i in S3]

Submission status: Runtime Error

Solution code:
import collections
 
N = int(input())
l = [input() for _ in range(H)]
 
c = collections.Counter(l)
 
L = c.most_common()
 
values, counts = zip(*c.most_common())
 
A = list(values)
B = list(counts)
 
b = B.count(B[0])
 
a = A[0:b + 1]
 
for i in a[0:]:
print(i)

Submission status: Runtime Error

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

box = []
S_box = []
last = []
sss = set(S)
an = []

for k in sss:
    S_box.append(k)

for i in range(0, len(sss)):
    box.append(S.count(S_box[i]))

num = max(box)

for a in range(0, len(box)):
    if num == box[a]:
        last.append(a)

for iii in last:
    an.append(S_box[iii])
an = sorted(an)
for aaa in an:
    print(aaa)

Submission status: Runtime Error

Solution code:
N=int(input())
s10=[]*10
S=[s10]*N
Li=[0]*N
Ls=['']*N
Ld=[]
max_id=0
ii=0
for i in range(N):
    S[i]=input()
for i in range(N):
    if S[i] in Ls:
        idx=Ls.index(S[i])
        Li[idx]+=1
        a=Li[idx]
    else:
        Li[ii]=1
        Ls[ii]=S[i]
        a=1
        ii+=1
    if max_id<a:
        Ld=[]
        Ld.append(ls[i])
    elif max_id==a:
        Ld.append(ls[i])
Ld=sorted(Ld)
for i in range(len(Ld)):
    print(Ld[i])

Submission status: Runtime Error

Solution code:
from collections import defaultdict
from collections import OrderedDict
N = int(input())
answer = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(l)

Submission status: Runtime Error

Solution code:
N = int(input())

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

cnt_ar = list(set(S))
cnt_ar.sort()

length = len(cnt_ar)

ar = [0]*length

for i in range(length):
  ar[i] = S.count(cnt_ar[i])

max_num = max(ar)

for i in range(length):
  if ar[i] == max_num:
    print(cnt_ar[i])

Submission status: Runtime Error

Solution code:
n = int(input())
vote = dict()
for i in range(n):
  s = input()
  if s not in vote.keys():
    vote[s] = 0
  else:
    vote[s] += 1
vote.sort()
res = sorted(vote.values(), reverse = True)
for i in res.keys():
  print(i)

Submission status: Runtime Error

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

for i in range(N):
    arg = input()
    if (arg in S):
        S[arg] = S[arg] + 1
    else:
        S[arg] = 1
# valSorted = sorted(S.items(), key=lambda x:(-x[1], x[0]))
breakKey = None
for key, value in valSorted:
    if breakKey is None:
        breakKey = value
    if breakKey != value:
        break
    print(str(key))

Submission status: Runtime Error

Solution code:
sz = int(input(''))
ary = []
for i in range(0,sz):
  s = input()
  ary.append(s)

map = {}
for w in ary:
  if not w in map:
    map[w] = 1
  else:
    map[w] +=1

max = 0
maxes = []
for k,v in map.items():
  if v > max:
    max = v

for k,v in map.items():
  if v == max:
    maxes.append(k)

for m in maxes.sort():
  print(m)

Submission status: Runtime Error

Solution code:
##C
N = int(input())
S = list(input() for i in range(N))

import collections

c = collections.Counter(S)
ans = 0
for j in range(N):
    if c.most_common()[0][1] == c.most_common()[j][1]:
        ans += 1
    else:
        break
ansl = list()
for k in range(ans):
    ansl.append((c.most_common()[k][0]))
ansl.sort()
for l in ansl:
    print(l)

Submission status: Runtime Error

Solution code:
import collections

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

c = collections.Counter(l)

L = c.most_common()

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

A = list(values)
B = list(counts)

b = B.count(B[0])

a = A[0:b + 1]

[print(i) for i in a]

Submission status: Runtime Error

Solution code:
N=int(input())
List=[str(input()) for i in range(N)]
SetList=list(set(List))
nc=[]
for i in range(len(SetList)):
    n=List.count(SetList[i])
    nc.append(n)

indexmax=np.where(np.array(nc) == np.array(nc).max())[0]
MaxList=[]
for i in range(len(indexmax)):
    index=indexmax[i]
    MaxList.append(SetList[index])

MaxListS=sorted(MaxList)
for i in MaxListS:
    print(i)

Submission status: Runtime Error

Solution code:
import collections
a = int(input())
line = [input() for k in range(a)]
c = collections.Counter(line)
common = c.most_common()
max_number = common[0][1]
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:
from collections import Counter

n =int(input())
slist = []
for _ in range(n):
  s = input()
  slist.appemd(s)

Counter(slist)

Submission status: Runtime Error

Solution code:
N = int(input())

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

cnt_ar = list(set(S))
cnt_ar.sort()

length = len(cnt_ar)

ar = [0 for i in range(length)]

for i in range(length):
  ar[i] = S.count(cnt_ar[i])

max_num = max(ar)

for i in range(len(ar)):
  if ar[i] == max_num:
    print(cnt_ar[i])

Submission status: Runtime Error

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

#n=7
#s.append("beat")
#s.append("vet")
#s.append("beet")
#s.append("bed")
#s.append("vet")
#s.append("bet")
#s.append("beet")

s.sort()

t=[]
icnt=0
t.append([1,s[0]])
for i in range(1,len(s)):
    if s[i-1]==s[i]:
        t[icnt][0]=t[icnt][0]+1
    else:
        icnt=icnt+1
        t.append([1,s[i]])
        
#print(t)
t.sort(reverse=True)
#print(t)

u=[]
u.append(t[0][1])
for i in range(len(t)):
    if t[i][0]==t[i+1][0]:
        u.append(t[i+1][1])
    else:
        break
    
u.sort()

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

Submission status: Runtime Error

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

if len(c) == 1:
    ;
elif len(c) == len(s_list):
    c_list = sorted(c)
    print(c_list[0])
else:
    print(c.most_common()[0][0])
    for i in range(len(c)+1):
        if c.most_common()[0][1] == c.most_common()[i+1][1]:
            print(c.most_common()[i+1][0])
        else:
            break

Submission status: Runtime Error

Solution code:
import sys
N = int(input())
N, *d = map(int, open(0).read().split())
values, counts = zip(*d.most_common())
for i in values:
    print(i)

Submission status: Runtime Error

Solution code:
import numpy as np

N = int(input())
a = 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:
import collections
N=int(input())
S=[input() for i in range(N)]
c=collections.Counter(S)
for i in range(len(c.most_common())):
  print(c.most_common()[i][0])
  if c.most_common()[i][1] !=c.most_common()[i+1][1]:
    break

Submission status: Runtime Error

Solution code:
N = int(input())
S_list = []
for i in range(N):
    x = input()
    S_list.append(x)
another_list = [S_list[0]]
cnt_list = [1]
for i in range(1, N):
    for j in range(len(another_list)):
        if another_list[j] == S_list[i]:
            cnt_list[j] += 1
            break
    if j == len(another_list)-1:
        another_list.append(S_list[i])
        cnt_list.append(1)
max_v = max(cnt_list)
cnt = []
for i in range(len(cnt_list)):
    if max_v == cnt_list[i]:
        cnt.append(i)
cnt1 = []
for i in range(len(cnt)):
    cnt1.append(another_list[cnt[i]])
if len(cnt1) > 2:
    for _ in range(len(cnt1)-1):
        for i in range(len(cnt1)-1):
            tmp = "s"
            if ord(cnt1[i][0]) > ord(cnt1[i+1][0]):
                tmp = cnt1[i+1][0] 
                cnt1[i+1][0] = cnt1[i][0]
                cnt1[i][0] = tmp
print(cnt1)

Submission status: Runtime Error

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

for i in range(N):
    arg = input()
    if (arg in S):
        S[arg] = S[arg] + 1
    else:
        S[arg] = 1
valSorted = sorted(S.items(), key=lambda x:(-x[1], x[0]))
breakKey = None
for key, value in valSorted:
    if breakKey is None:
        breakKey = value
    if breakKey != value:
        break
    print(str(key)

Submission status: Runtime Error

Solution code:
import sys
N = int(input())
data = [sys.stdin.readline().rstrip().split() for _ in range(N)]
values, counts = zip(*data.most_common())
for i in values:
    print(i)

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 collections
N= int(input())
S = []
for _ in range(N):
    S.append(input())
    
c = collections.Counter(S)
print(c.most_common()[0][0])
i=0
while True:
  if c.most_common()[i+1][1]==c.most_common()[i][1]:
    print(c.most_common()[i+1][0])
    i+=1
  else:
    break

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
str = []
for i in range(N):
    str.append(input())
clist = collections.Counter(str).most_common()
most_num = clist[0][1]
most_str = []
for i in range(N):
    if clist[i][1] == most_num:
        most_str.append(clist[i][0])
    else:
        break
sorted(most_str)
for i in range(len(most_str)):
    print(most_str[i])
    print()

Submission status: Runtime Error

Solution code:
N = int(input())

S = [input() for i in range(N)]
 
for i in range(N):
    S.append(input())
 
no_ol = list(set(S))
max_s = 0
ans_list = []
 
for i in range(len(no_ol)):
    tmp = S.count(no_ol[i])
    if max_s >tmp
        continue
    elif max_s == tmp:
        ans_list.append(no_ol[i])
    elif tmp>max_s:
        ans_list = []
        max_s = tmp
        ans_list.append(no_ol[i])
 
 
ans_list.sort()
[print(i) for i in ans_list]

Submission status: Runtime Error

Solution code:
import collections
n=int(input())
s = []
sort=[]
for i in range(n):
    s.append(input())
ans=collections.Counter(s).most_common()
oldnum=ans[0][1]
for i in range(n):
    if oldnum == ans[i][1]:
        sort.append(ans[i][0])
        oldnum=ans[i][1]
    else:
        break
sort.sort()
for i in range(len(sort)):
    print(sort[i])

Submission status: Runtime Error

Solution code:
import collections
n=int(input())
s=[input() for k in range(n)]
if(len(set(s))==len(s)):
    for u in range(len(s)):
        print(s[u])
    exit()
else:
    s1=[q for q in sorted(list(set(s))) if s.count(q) > 1]
c=collections.Counter(s)
p=[]                                                                                                  for i in s1:
    p.append(c[i])
max=max(p)
print(max)
for j, x in enumerate(p):
    if(x == max):
        print(s1[j])

Submission status: Runtime Error

Solution code:
N=int(input())
S = []
for j in range(N):
    S.append(input())
from collections import Counter
S2=collections.Counter(S)
S1=S2.most_common()

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

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:
N = int(input())
l = []
for _ in range(N):
    l.append(input())

from collections import Counter

co = Counter(l).most_common()
l = [co[0][0]]

for n in range(N):
    if co[n+1][1] == co[n][1]:
        l.append(co[n+1][0])
    else:
        break
l.sort()

for n in range(len(l)):
    print(l[n])

Submission status: Runtime Error

Solution code:
import numpy as np

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:
import sys

N = int(input())
S = [None]*N
for i in range(N):#N
    S[i] =sys.stdin.readline
S = sorted(S)#NlogN
num = 0
temp = 1
lis_num=[None]*N
lis_name = [None]*N
for i in range(N):#N
    if i !=N-1:
        if S [i] == S[i+1]:
            temp+=1
        else :
            lis_num[num] = temp
            temp=1
            lis_name[num] = S[i]
            num+=1
    else:
        lis_num[num] = temp
        temp=1
        lis_name[num] = S[i]
        num+=1

for i in range(num):
    if lis_num[i] == max(lis_num[0:num]):
        print(lis_name[i])

Submission status: Runtime Error

Solution code:
N = int(input())
S = []
for _ in range(N):
    S.append(str(input()))
S_ = [x for x in set(S) if S.count(x) > 1] #重複している要素を取り出す
chofuku_number=[]
for x in S_:
    chofuku_number.append(S.count(x))
max_chofuku = max(chofuku_number)
answer=[]
for i in range(len(chofuku_number)):
    if chofuku_number[i]==max_chofuku:
        answer.append(S_[i])
answer.sort()
for i in range(len(answer)):
    print(answer[i])

Submission status: Runtime Error

Solution code:
from collections import defaultdict
from collections import OrderedDict
n = int(input())
answer = dict()
for _ in range(n):
    z = str(input())
    if z in answer:
        ans[z]+=1
    else:
        answer.update({z:1})
groupedByValue = defaultdict(list)
for key, value in sorted(answer.items()):
    groupedByValue[value].append(key)
M = groupedByValue[max(groupedByValue)]
for i in M:
    print(i)

Submission status: Runtime Error

Solution code:
n= int(input())
s= [input() for i in range(n)]
p1=list(set(s))
N=len(p1)
c=[0]*N
for i in range(N):
	c[i]=s.count(p1[i])
m =max(c)
c1=c.count(m)
ans=[0]
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:
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)

Submission status: Runtime Error

Solution code:
from collections import defaultdict
from collections import OrderedDict
n = int(input())
ans = dict()
for _ in range(n):
    z = str(input())
    if z in answer:
        ans[z]+=1
    else:
        answer.update({z:1})
groupedByValue = defaultdict(list)
for key, value in sorted(answer.items()):
    groupedByValue[value].append(key)
M = groupedByValue[max(groupedByValue)]
for i in M:
    print(i)

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    s = {}
    for _ in range(n):
        string = input()
        if string in s:
            s[string] += 1
        else:
            s[string] = 1
    s = sorted(list(s.items()), key=lambda x: (x[1], x[0]), reverse=True)
    lst = []
    max_num = s[0][1]
    if n == len(s):
        print(s.items()[0])
        return
    for string, num in s:
        if num != max_num:
            break
        lst.append(string)
    for l in reversed(lst):
        print(l)


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import collections

num = int(input())
word_list = []
for i in range(num):
    word_list.append(input())
word_dict = collections.Counter(word_list)
word_list = [k for k,v in word_dict.items() if v == word_dict.most_common()[1][1]]
word_list.sort()
for word in word_list:
    print(word)

Submission status: Runtime Error

Solution code:
def inverse_lookup(d, x):
    a = []
    for k,v in d.items():
        if x == v:
          a.append(k)
    return a

n = int(input())
w = {}
for i in range(n):
  if i in w:
    w[i] += 1
  else:
    w[i] = 1
m = max(w.values())
for i in inverse_lookup(w,m).sort(reverse=True):
  print(i)

Submission status: Runtime Error

Solution code:
N = int(input())
words = [[]]*N
for i in range(N):
  words[i] = str(input())
for j in set(words):
  maximum = max(maximum, words.count(j))
wlist = []
for k in set(words):
  if words.count(k) == maximum:
    wlist.append(k)
wlist.sort()
for l in range(len(wlist)):
  print(wlist[l])

Submission status: Runtime Error

Solution code:
N=int(input())
S = []
for _ in range(N):
    S.append(input())
from collections import Counter
S2=collections.Counter(S)
S1=(list(S2.items()))
print(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[i-1][1]:
        print(S1[i][0])
    else:
        break

Submission status: Runtime Error

Solution code:
n = int(input())
s = list(open(0))
    
dic = {}
for i in range(len(s)):
    if s[i] not in dic:
        dic[s[i]]=s.count(s[i])
    
ans = sorted([k for k, v in dic.items() if v == max(dic.values())])

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

Submission status: Runtime Error

Solution code:
from collections import defaultdict
import collections
N=int(input())
ss = []
for i in range(N):
  ss.append(input())
ss.sort()
#d = defaultdict(lambda: 0)
c = collections.Counter(ss)
d_=c.most_common()
mx = d_[0][1]
for i in range(N):
  if d_[i][1] == mx:
    print(d_[i][0])
  else:
    break

Submission status: Runtime Error

Solution code:
N = int(input())
S = [input() for i in range(N)]
count = collections.Counter(S)
ans = []
for i in range(len(c)):
  print(count.most_common()[i][0])

Submission status: Runtime Error

Solution code:
n = int(input())
S = []
for i in range(n):
    s = input()
    S.append(s)
S.sort()
A = list(set(S))
A.sort()
#print(A)
#print(S)
NUM =[0]*len(A)
for j in range(len(A)):
    for i in range(len(S)):
        if (A[int(j)] == S[int(i)]):
            NUM[j] = NUM[j]+ 1
import numpy as np
b = np.argmax(NUM)
#print(NUM,b)
for e,i in enumerate(NUM):
    #print(NUM[b])
    if (i == NUM[b]):
        print(A[e])