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:
#C-Poll
import collections
n=int(input())
num=0
words = [input() for _ in range(n)]
count = collections.Counter(words)
Flg = True
ansallay = []
while Flg:
    ansallay.append(count.most_common()[num][0])
    if(count.most_common()[0][1] != count.most_common()[num+1][1]):
        Flg = False
        break
    num += 1
    if(num == n-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)

Submission status: Runtime Error

Solution code:
#C-Poll
import collections
n=int(input())
num=0
words = [input() for _ in range(n)]
count = collections.Counter(words)
Flg = True
ansallay = []
while Flg:
    ansallay.append(count.most_common()[num][0])
    if(count.most_common()[num][1] != count.most_common()[num+1][1]):
        Flg = False
    num += 1
ansallay.sort()
for word in ansallay:
    print(word)

Submission status: Runtime Error

Solution code:
mport collections
N = int(input())
S = [input() for _ in range(N)]
c = collections.Counter(S)
s = c.most_common()
m = []
for i in range(len(s)):
  if s[0][1] == s[i][1]:
    m.append(s[i][0])
for x in range(len(m)):
  print(m[x])

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
S = [input() for _ in range(N)]
c = collections.Counter(S)
s = c.most_common()
m = []
for i in range(len(s)):
  if s[0][1] == s[i][1]:
    m.append(s[i][0])
for x in range:
  print(m[x])

Submission status: Runtime Error

Solution code:
N = int(input())
S = {}
name_list = []
for i in range(N):
  name = input()
  if name not in S:
    S[name] = 1
    name_list.append(name)
  else:
    S[name] += 1
sorted(name_list)
max_vote_name = []
max_vote = -float('inf')
for name in name_list:
  if S[name] > max_vote:
    max_vote = S[name]
    max_vote_list = [name]
  else if S[name] == max_vote:
    max_vote_list.append(name)
for name in max_vote_list:
  print (name)

Submission status: Runtime Error

Solution code:
N = int(input())
S_list = []
for i in range(N):
  S_list.append(input())
 
sorted(S_list)
name_list = []
vote_list = []
i, j = 0, 0
while i < len(S_list):
  name = S_list[i]
  while j < len(S_list) and S_list[j] == name:
    j += 1
  name_list.append(name)
  vote_list.append(j - i)
  i = j
max_vote = max(vote_list)
for k in range(name_list):
  if vote_list[k] == max_vote:
    print (name_list[k])

Submission status: Runtime Error

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

sorted(S_list)
name_list = []
vote_list = []
i, j = 0
while i < len(S_list):
  name = S_list[i]
  while j < len(S_list) and S_list[j] == name:
    j += 1
  name_list.append(name)
  vote_list.append(j - i)
  i = j
max_vote = max(vote_list)
for k in range(name_list):
  if vote_list[k] == max_vote:
    print (name_list[k])

Submission status: Runtime Error

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

sorted(S_list)
name_list = []
vote_list = []
i, j = 0
while i < len(S_list):
  name = S_list[i]
  while j < len(S_list) and S_list[j] == name:
    j += 1
  name_list.append(name)
  vote_list.append(j - i)
  i = j
max_vote = max(vote_list)
for i in range(name_list):
  if vote_list[i] == max_vote:
    print (name_list[i])

Submission status: Runtime Error

Solution code:
import collections
n=int(input())
s=["0"]*n
for i in range(n):
  s[i]=str(input())
x=collections.Counter(s)
x1=x.most_common()
i=1
t=["0"]*n
t[0]=x1[0][0]
while x1[i][1]==x1[i-1][1]:
  t[i]=x1[i][0]
  i=i+1
t=[s for s in t if s != '0']
t.sort()
j=0
m=0
m=len(t)
while j<m:
  print(t[j])
  j=j+1

Submission status: Runtime Error

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

set_key = set(s)
dic = dict(set_key, [0]*len(set_key))

for c in s:
  dic[c] += 1
  
n_max = max(dic.values())
str_argmax = dic.keys()[dic.values() == n_max]
str_argmax.sort()

for i in str_argmax:
  print(i)

Submission status: Runtime Error

Solution code:
from collections import Counter
N=int(input())
lis=list(input() for _ in range(N))
ans=[]
high=0

counter=Counter(lis)
high=counter.most_common()[0][1]

for  j in se:
  if lis.count(j)==high:
    ans.append(j)
ans.sort()

for k in ans:
  print(k)

Submission status: Runtime Error

Solution code:
def main():
  n = int(input())
  ls = []
  ls_count = []
  for i in range(n):
    item = input()
	if not item in ls:
      ls.append('item')
      ls_count.append(1)
    else:
      ls_count[ls.index(item)] += 1
  max_count = max(ls_count)
  max_index = [i for i, n in enumerate(ls_count) if n == max_count]
  ans = []
  for idx in max_index:
    ans.append(ls[idx])
  ans = sorted(ans)
  for itm in ans:
    print(itm)
  

if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
from collections import Counter

i = int(input())

dic = {}
for j in range(i):
    word = input()
    if word in dic:
        dic[word] += 1
    else:
        dic[word] = 1


dic2 = sorted(dic.items(), key=lambda x:x[1])

k = len(dic2)-1
s = 0
while True:
    t = dic2[k][1]
    print(dic2[k][0])
    k -= 1
    if t == dic2[k][1]:
        s = 1
    else:
        break

Submission status: Runtime Error

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

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

dict_sorted = sorted(dict1, key = lambda x: x[0])
dict_sorted.sort(key = lambda x: x[1], reverse = True)

max1 = dict_sorted[0][1]

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

Submission status: Runtime Error

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

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

dict1.sort(key = lambda x: x[0])
dict1.sort(key = lambda x: x[1], reverse = True)

max1 = dict1[0][1]

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

Submission status: Runtime Error

Solution code:
N = int(input())
S =[input() for _ in range(N)]
A = [S.count(S[i]) for i in range (N)]
Max_A = max(A)
ans = []
for i in A:
    if i == Max_A:
        ans.append(S[i])
ans = set(ans)
ans = list(ans)
ans.sort()
print("\n".join(ans))

Submission status: Runtime Error

Solution code:
import collections

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

c = collections.Counter(s)
max_num = list(c.values())[0]
d = []
for key,value in c:
  if value == max_num:
    d.append(key)
  else:
    break
    
for i in sorted(d):
  print(i)

Submission status: Runtime Error

Solution code:
import collections

N = int(input())
s = list(input().split())

c = collections.Counter(s)
max_num = list(c.values())[0]
d = []
for key,value in c:
  if value == max_num:
    d.append(key)
  else:
    break
    
for i in sorted(d):
  print(i)

Submission status: Runtime Error

Solution code:
import collections

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

c = collections.Counter(s)
max_num = list(c.values())[0]
d = []
for key,value in c.items():
  if value == max_num:
    d.append(key)
  else:
    break
    
for i in sorted(d):
  print(i)

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
S_list = [input() for i in range(N)]
c = collections.Counter(S_list)
l = {}
m = c[0][0]
for x, y in zip(*c):
  if x in l.keys():
    l[x] = [y]
  else:
    l[x].append(y)

  
for y in sorted(l[m]):
  print(y)

Submission status: Runtime Error

Solution code:
import collections

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

c = collections.Counter(s)
max_num = list(c.values())[0]
d = []
for key,value in c:
  if value == max_num:
    d.append(key)
  else:
    break
    
for i in sorted(d):
  print(i)

Submission status: Runtime Error

Solution code:
n = int(input())
dict = {}
for i in range(n):
  a = input()
  if (not (a in list)):
    dict[a] = 0
  else:
    dict[a] += 1
b = max(dict.values())
for i in dict.keys():
  if dict[i] == b:
    print(i+"\n")

Submission status: Runtime Error

Solution code:
N, K = [int(x) for x in input().split(' ')]
A = [int(x) for x in input().split(' ')]
r = sorted([A[i] * A[j] for i in range(N) for j in range(i+1, N)])
print(r[K-1])

Submission status: Runtime Error

Solution code:
N = int(input())

strs = []
dicts = {}
for i in range(N):
    s = input()
    if dicts.get(s) is not None:
        dicts[s] += 1
    else:
        dicts[s] = 1

dict_sorted = sorted(dict.items(), key=lambda x:x[1])

i = 0
for s in dict_sorted.key():
    if dicts[s] >= i:
        print(s)
    i = dicts[s]

Submission status: Runtime Error

Solution code:
N = int(input())
A = [input() for _ in range(N)]
d = defaultdict(int)
for a in A:
    d[a] += 1

li = sorted(d.items())
l = sorted(li, key = itemgetter(0), reverse=True)
max_key = l[0][0]

for k, v in li:
    if k == max_key:
        print(k)
    else:
        continue

Submission status: Runtime Error

Solution code:
N = int(input())
A = [input() for _ in range(N)]
d = defaultdict(int)
for a in A:
  d[a] += 1

  li = sorted(d.items())
  l = sorted(li, key = itemgetter(0), reverse=True)
  max_key = l[0][0]

  for k, v in li:
    if k == max_key:
      print(k)
      else:
        continue

Submission status: Runtime Error

Solution code:
n=int(input())
N=[]
for _ in range(n):
  a=input()
  N.append(a)
ids = sorted(list(set(N)))
ans=dict()
for i in ids:
  ans[i]=0
for i in N:
  ans[N]+=1
  
ma=max(ans.values())
for i in range(len(ans)):
  if ans[i]==ma:
    print(ids[i])

Submission status: Runtime Error

Solution code:
N=int(input())
li=map(string,input().split())
dic={}
for k in li:
  dic[k]+=1
max_dic= max(dic)
print(max_dic)

Submission status: Runtime Error

Solution code:

from collections import Counter


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

C=Counter(S).most_common()
L=len(C)

D=[]

D.append(C[0][0])

for i in range(1,L):
    if C[0][1]==C[i][1]:
        D.append(C[i][0])
D.sort()

for i in range(L):
    print(D[i])

Submission status: Runtime Error

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

l = [s.count(i) for i in s]
d = {i:j for i,j in zip(s, l)}
m = max(l)

d = {i:j for i, j in zip(s, l)}
ans = [i for i in d if d[i] == m]
sorted(ans)

for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
import collections

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

counter = collections.Counter(s)
most = counter.most_common()
ans = []
for i in range(n):
    if most[i][1] == most[0][1]:
        ans.append(most[i][0])
    else:
        break
ans.sort()
for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
import collections

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

counter = collections.Counter(s)
ans = []
for i in range(n):
    if counter.most_common()[i][1] == counter.most_common()[0][1]:
        ans.append(counter.most_common()[i][0])
    else:
        break
ans.sort()
for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
n = int(input())
p = [input() for i in range(n)]

c = collections.Counter(p)
m = c.most_common()
most = m[0][1]

answer = []

answer.append(m[0][0])

for i in range(len(m)-1):
    if m[i+1][1] == most:
        answer.append(m[i+1][0])
    else:
        break

for output in sorted(answer):
    print(output)

Submission status: Runtime Error

Solution code:
import collections

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

c = collections.Counter(p)
m = c.most_common()
most = m[0][1]

answer = []

answer.append(m[0][0])

for i in range(len(m)-1):
    if m[i+1][1] == most:
        answer.append(m[i+1][0])
    else:
        break

for output in sorted(answer):
    print(output)
return

Submission status: Runtime Error

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

n = N
max_num = 0
t = []
while n >= max_num:
    word = s[0]
	count = 0
    for i in s:
      if i == word:
        count += 1
        
    if count > max_num:
      max_num = count
      t = [s[0]]
    elif count == max_num:
      t = t.append(s[0])
      
    s = [i for i in s if i != word]
    n = len(s)

t = sorted(t)
for i in range(t):
  print(i)

Submission status: Runtime Error

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

m = 0
for i in s:
    mae = len(s)
    s = [j for j in s if j != i]
    ato = len(s)
    num = mae - ato

    if num > m:
        ans = [i]
        m = num
    elif num == m:
        ans.append(i)


ans.sort()

#print(*ans,sep='\n')
print('\n'.join(map(str, ans)))
#for i in range(len(ans)):
#    print(ans[i])

Submission status: Runtime Error

Solution code:
from collections import Counter

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

# ansの初期化
ans = []
ans.append(s[0][0])
cnt = s[0][1]

for i in range(1, n):
  if (s[i][1] < cnt):
    break
  else:
    ans.append(s[i][0])

for s in sorted(ans):
  print(s)

Submission status: Runtime Error

Solution code:
import math


n = int(input())
candidates = {}


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


max_votes = -math.inf
for candidate, votes in candidates.items():
    if votes >= max_votes:
        max_votes = votes

for candidate, votes in sorted(candidates.items()):
    if votes == max_votes:
        print(candidate)

Submission status: Runtime Error

Solution code:
import math


n = int(input())
candidates = {}


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


max_votes = -math.inf
for candidate, votes in candidates.items():
    if votes >= max_votes:
        max_votes = votes

winners = []
for candidate, votes in candidates.items():
    if votes == max_votes:
        winners.append(candidate)

winners.sort()

for winner in winners:
    print(winner)

Submission status: Runtime Error

Solution code:
import collections
n=int(input())
li=[]
for i in range(n):
    s=str(input())
    li.append(s)
li.sort(reverse=True)
c=collections.Counter(li)
print(c.most_common()[0][0])
for i in range(1,n):
    if c.most_common()[i][1]==c.most_common()[0][1]:
        print(c.most_common()[i][0])
    else:
        break

Submission status: Runtime Error

Solution code:
n = int(input())
m = {}
for i in n:
  s = input()
  if s in m:
    m[s] += 1
  else:
    m[s] = 1
    
maxim = max(m.values())
mySet = set(key if value == maxim for key, value in m.items())
for i in mySet:
  print(i)

Submission status: Runtime Error

Solution code:
from collections import defaultdict
def solve():
    N = int(input())
    d = defaultdict(int)

    for _ in range(N):
        S = input()
        d[S] += 1

    items = list(d.items())
    items.sort(key=lambda x:x[1], reverse=True)
    mx = items[0][1]
    cand = []
    for item in items:
        if item[1] == mx:
            cand.append(item[0])
        else:
            break
    
    print(*ans, sep='\n')
    
if __name__ == '__main__':
    solve()

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
S_list = [input() for i in range(N)]
c = collections.Counter(S_list)
l = {}
for x, y in zip(*c):
  if x in l.keys():
    l[x] = [y]
  else:
    l[x].append(y)

for x in sorted(l.keys(), reverse=True):
  for y in sorted(l[x]):
    print(y)

Submission status: Runtime Error

Solution code:
N = int(input())

hash = {}
for i in range(N):
	key = input()
	if key in hash:
		hash[key] += 1
	else:
		hash[key] = 1
        
max = 0
results = []
for i, v in hash.items():
	if max == v:
		results.append(v)
	elif max < v::
		results = [v]
        
for i in results:
	print(v)

Submission status: Runtime Error

Solution code:
n = input()
s = [input() for i in range(n)]
u = set(s)
dic = dict(zip(u, [0]*len(u)))
for i in range(n):
    dic[s[i]] += 1
m = max(dic.values())
res = []
for k, v in dic.items():
    if v == m:
        res.appned(k)
res.sort()
print(*res, sep="\n")

Submission status: Runtime Error

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = read().split()

S = sorted(S)
ls = [[] for i in range(N + 1)]
max_num = 0
left = 0
right = 0
while right < N:
    while right < N and S[left] == S[right]:
        right += 1
    if (right  - left) >= max_num:
        ls[right - left].append(S[left])
        max_num = right - left
    left = right
    
print('\n'.join(ls[max_num]))

Submission status: Runtime Error

Solution code:

N = int(input())
S = [input() for i in range(N)]
C = dict()


for i in range(N):
    a = input()
    if(a not in C.keys()):
        C[a] = 1
    else:
        val = C[a]
        C[a] = val + 1

maxv=0
for i in C.values():
    if(i > maxv):
        maxv=i

ans = sorted(C.items())
for i  in ans:
    if(maxv==i[1]):
        print(i[0])

Submission status: Runtime Error

Solution code:
from collections import Counter

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

c=Counter(s)
m=max(c.values())
ans = sorted(k for k,v in c.items() if v == m)
print("\n".join(ans))

Submission status: Runtime Error

Solution code:
n = int(input())
dic = {}
m = 0
for i in range(n):
  s = input()
  if s in dic:
    dic[s] += 1
    m = max(m, dic[s])
  else:
    dic[s] = 1
    m = max(m, dic[s])
ans = []
for s in dic:
  if dic[s] == m:
    ans.append(s)
print('\n'.join(ans.sort()))

Submission status: Runtime Error

Solution code:
import sys
from collections import Counter

input = sys.stdin.readline

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

c_sort = collections.Counter(s).most_common()
list_most = [c_sort[i][0] for i in range(len(c_sort)) if c_sort[i][1] == c_sort[0][1]]
for i in list_most:
    print(i)

Submission status: Runtime Error

Solution code:
import collections

N = int(input())
vote_list = [input() for i in range(N)]
vote_list.sort()

count = collections.Counter(vote_list)
max_count = count.most_common()[0][1]

if max_count == 1:
    for i in vote_list:
        print(i)
else:
    i = 0
    while count.most_common()[i][1] == max_count:
        print(count.most_common()[i][0])
        i = i + 1

Submission status: Runtime Error

Solution code:
import collections
import sys

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

c = collections.Counter(S)
# print(c.most_common())

outputs = []
for i, (key, value) in enumerate(c.most_common()):
    outputs.append(key)
    if not (i == len(c.most_common())-1 and c.most_common()[i+1][1] == value):
        break
for x in reversed(outputs):
    print(x)

Submission status: Runtime Error

Solution code:
from collections import Counter
 
N = int(input())
S = [input() for x in range(N)]
E = Counter(S)
c = max(E.values())
s = [s for s, g in b.items() if g == c]
s.sort()
print('\n'.join(s))

Submission status: Runtime Error

Solution code:
n=int(input())
a=[input() for i in range(n)]

from collections import Counter
c = collections.Counter(a)

keys = [k for k, v in c.items() if v ==c.most_common()[0][1] ]

string = "\n".join(keys)
print(string)

Submission status: Runtime Error

Solution code:
from collections import Counter
 
n=int(input())
a=[int(input()) for i in range(n)]
  
c = Counter(a)
keys = [k for k, v in c.items() if v ==c.most_common()[0][1] ]
 
keys.sort()
string = "\n".join(keys)
print(string)

Submission status: Runtime Error

Solution code:
from collections import Counter

N = int(input())
S = [input() for x in range(N)]
E = Counter(a)
c = max(E.values())
s = [s for s, g in b.items() if g == c]
s.sort()
print('\n'.join(s))

Submission status: Runtime Error

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

#define all(v)			((v).begin()), ((v).end())
#define SIZE(v)			((int)((v).size()))
#define LOG(x)			log((double)x)
#define TOLOWER(x)          transform(all(x),x.begin(),::tolower)
#define TOUPPER(x)          transform(all(x),x.begin(),::toupper)
#define ROUND(x,m)			(round((double)x/m)*m)
#define DIGITS(x)			(floor(log10((double)x))+1)
#define READSTR(x)			getline(cin,x)
#define sort_g(a,b)              sort(a, b, greater<int>());
#define IOS() ios_base::sync_with_stdio(0);cin.tie(NULL);
#define REP(i, n) for (int i = 0; i < n; ++i)
#define FILE_INPUT() 	freopen( "input.txt", "r", stdin)
#define FILE_OUTPUT()   freopen( "output.txt", "w", stdout)
#define PI 3.14159265


typedef long long ll;

bool myCmp(pair<int,string> &p1 , pair<int,string>&p2)
{
    if(p1.first == p2.first)
        return p1.second<p2.second;
    else return p1.first > p2.first;
}
unsigned long long
choose(unsigned long long n, unsigned long long k) {
    if (k > n) {
        return 0;
    }
    unsigned long long r = 1;
    for (unsigned long long d = 1; d <= k; ++d) {
        r *= n--;
        r /= d;
    }
    return r;
}
int toInt(string str)
{
    int num;
    std::istringstream iss(str); //put string in input stream
    iss >> num; return num; //read from stream as integer
}
ll  OO = 10e9;
const int MAXN = 2*10e5 +1;

map<string,int> m;
vector<pair<int,string>> vsi;
int main() {
    IOS();
    int N;
    cin>>N;
    string s;
    REP(i,N)
    {
        cin>>s;
        m[s]++;
    }
    vsi.resize(m.size());
    int i = 0 ;
    for(auto v : m)
    {
        vsi[i] = make_pair(v.second,v.first);
        ++i;
    }
    sort(vsi.begin(),vsi.end(),myCmp);
    int score = vsi[0].first;
    for(int k = 0; k<vsi.size();++k)
    {
        if(vsi[k].first == score)
            cout<<vsi[k].second<<endl;
        else
            break;
    }
    return 0;
}

Submission status: Runtime Error

Solution code:
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
c=Counter(s)
t=[]
v=c.most_common()[0][1]
t.append(c.most_common()[0][0])
for i in range(1,n):
  a=c.most_common()[i][1]
  if v>a:
    break
  else:
    t.append(c.most_common()[i][0])
t.sort()
for i in t:
  print(i)

Submission status: Runtime Error

Solution code:
import sys

input = sys.stdin.readline

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

for i in range(n):
    if s[i] not in dict:
        dict[s[i]], s.count(s[i])]

max_d_list = [d[0] for d in dict.items() if d[1] == max(dict.values())]
sorted_list = sorted(max_d_list)
for i in sorted_list:
    print(i)

Submission status: Runtime Error

Solution code:
rom collections import Counter
N = int(input())
S = [input() for _ in range(N)]
CS = Counter(S)
v = 0
ans = []
for i  in CS.values():
  v = max(v,i)
for i,j in CS.items():
  if v == j:
    ans.append(i)
ans.sort()
print(ans[i] for i in range(len(ans)))

Submission status: Runtime Error

Solution code:
rom collections import Counter
N = int(input())
S = [input() for _ in range(N)]
CS = Counter(S)
v = 0
ans = []
for i  in CS.values():
  v = max(v,i)
for i,j in CS.items():
  if v == j:
    ans.append(i)
ans.sort
print(ans[i] for i in range(len(ans)))

Submission status: Runtime Error

Solution code:
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
CS = Counter(S)
math = 0
ans = []
for i  in CS.values():
  v = max(v,i)
for i,j in CS.items():
  if v == j:
    ans.append(i)
ans.sort
print(ans[i] for i in range(len(ans)))

Submission status: Runtime Error

Solution code:
n = int(input())
d = {}
for i in range(n):
    s = input()
    d[s] = d[s]+1 if (s in d) else 1
d_sorted = sorted(d.items(), key=lambda x:x[1], reverse=True)
m = d_sorted[0][1]
result = []
for i in range(n):
    if d_sorted[i][1]!=m:
        break
    result.append(d_sorted[i][0])
print(*sorted(result), sep='\n')

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from collections import Counter
N = int(input())
S = Counter(input() for _ in range(N))
m = max(S.values())
for v in sorted(s for k, v in S.items() if v == m):
	print(v)

Submission status: Runtime Error

Solution code:

num = input()
l = []
for i in range(0,int(num)):
    l.append(input())

cnt = []
l_t = list(set(l))
for item in l_t:
    cnt.append(l.count(item))

num_dict = dict(zip(l_t),cnt))
max_v = max(num_dict.values())

keys = []

for word, num in num_dict.items():
    if num == max_v:
        keys.append(word)

for i in sorted(keys):
    print(i)

Submission status: Runtime Error

Solution code:
N = int(input())

L = []
S = set()
for i in ragne(N):
  s = input()
  L.appened(s)
  S.insert(s)
L.sorted()

for i in S:
  M = max(M, L.count(i))
  
for i in S:
  if L.count(i) == M:
    print(i)

Submission status: Runtime Error

Solution code:
n=int(input())
d={}
for i in range(n):
	s=input()
    if(s in d):
    	d[s]+=1
    else:
    	d[s]=1
ma=max(d.values())
for i in sorted(d):
	if(d[i]==ma):
    	print(d[i])

Submission status: Runtime Error

Solution code:
N = input().split(' ')
S = [input() for i in range(N)]

ans = {}
for i in S:
  if i in ans:
    ans[i] += 1
  else:
    ans[i] = 1

max_value = max(ans.value())
ANS = []
for key, value in ans.item():
  if ans[key] == max_value:
    ANS.append(key)
    
for i in sorted(ANS):
  print(i)

Submission status: Runtime Error

Solution code:
from collections import Counter
n=int(input())
l=[input() for _ in range(n)]
c=Counter(l)
ll=list(c.values())
m=max(ll)
ans=[]
for i in c:
    if value(i)==m:
        ans.append(key(i))
ans.sort()
for i in ans:
    print(i)

Submission status: Runtime Error

Solution code:
ans = {}
for i in S:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1

max_v = max(ans.values())        
ANS = []
for key, value in ans.items():
    if ans[key] == max_v:
        ANS.append(key)

for i in sorted(ANS):
    print(i)

Submission status: Runtime Error

Solution code:
N=int(input())
ans={}
cnt=0
for i in range():
  t=input()
  if not t in ans.keys():
    ans[i]==1
  else:
    ans[i]+=1
  if cnt<ans[i]:
    cnt=ans[i]
tmp =[]
for i in ans.keys():
  if ans[i]  == cnt:
    tmp.append(i)
for i in sort(tmp):
  print(i)

Submission status: Runtime Error

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

for i in range(n) :
    new_word = input()
    if new_word in words.keys() :
        words[new_word] += 1
    else :
        words[new_word] = 1

mx_freq = max(words.values())
mx_words = [k for k in words.items() if words[k] == mx_freq]

mx_words.sort()

for mx_word in mx_words :
    print(mx_word)

Submission status: Runtime Error

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

list_val = list(set(L))
list_size = []
for i in list_val:
    list_size.append(L.count(i))

max_size = max(list_size)

ans = []
while max(list_size) == max_size:
    max_idx = list_size.index(max_size)
    ans.append(list_val[max_idx])
    list_size[max_idx] = 0
print("\n".join(sorted(ans))

Submission status: Runtime Error

Solution code:
import sys
from collections import Counter

read = sys.stdin.read

N, *S = map(str, read().split())
s = Counter(S)
n = max(s.values())
answer = [i for i, j in s if j == n]
answer.sort()
print('\n'.join(answer))

Submission status: Runtime Error

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

import numpy as np
t = np.unique(np.array(s), return_counts=True)
m = max(t[1])
ans = []
for i in range(len(t[1])):
    if t[1][i] == m:
        ans += [t[0][i]]

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

Submission status: Runtime Error

Solution code:
from collections import Counter
n=int(input())
a=[input() for _ in range(n)]
c=Counter(s)
sort(c.items())
max_cnt=max(c.values())
names=[name for k,v in c if v==max_cnt]
print(names)

Submission status: Runtime Error

Solution code:
from itertools import groupby
from itertools import itemgetter

a = groupby(sorted(input() for _ in range(int(input()))))
a = [(len(tuple(g)), s) for s, g in a]
m = max(a, key=itemgetter(0))[0]
for k, s in a:
  if k == m:
    print(s)

Submission status: Runtime Error

Solution code:
from itertools import groupby
from iterator import itemgetter

a = groupby(sorted(input() for _ in range(int(input()))))
a = [(len(tuple(g)), s) for s, g in a]
m = max(a, key=itemgetter(0))[0]
for k, s in a:
  if k == m:
    print(s)

Submission status: Runtime Error

Solution code:
from collections import Counter

c = Counter(input() for _ in range(int(input())))
m = max(c.values())
for s in sorted(s for s, k in c.items() if k == m) 
  print(s)

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    words = {}
    for _ in range(n):
        a = input()
        if a in words:
            words[a] += 1
        else:
            words[a] = 1

    max_val = max(words.values())
    # words_sorted = sorted(words.items(), key=lambda x: x[0])
    for key, value in sorted(words):
        if value != max_val:
            continue
        else:
            print(key)
            # key valueを両方printするとき
            # print('{}:{}'.format(key, value))


if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import collections

N = int(input())
S = [input() for _ in range(N)]
c = collections.Counter(S)
c.sort()
values, counts = zip(*c.most_common())
if len(values) == 1:
    print(values[0])
else:
    for i in range(N):
        if counts[i] == counts[0]:
            print(values[i])
        else:
            exit()

Submission status: Runtime Error

Solution code:
import collections
import sys

N = int(input())
S = [input() for _ in range(N)]
S.sort()
c = collections.Counter(S)
values, counts = zip(c.most_common())
if len(values) == 1:
    print(values[0])
else:
    for i in range(N):
        if counts[i] == counts[0]:
            print(values[i])
        else:
            sys.exit()

Submission status: Runtime Error

Solution code:
#コメントの作法が分かりません><
n=int(input())
s=[input() for i in range(n)]
#入力を受け取る



l=list(set(s))
#sの重複している要素を除く

l.sort()
#辞書順に出力しないといけないので並べ替える

a=[]
#空のリストを作る

for i in range(len(l)):
    a.append(s.count(l[i]))
    #s中の各要素の登場回数を数えてリストaに入れる

r j in range(len(a)):
    while a[j]==max(a):
        print(l[j])
        j+=1

#aの各要素について、最大値を取っているならば
#そのaに対応する文字列を出力する

Submission status: Runtime Error

Solution code:
import collections
n = input()
s = [input() for _ in range(n)]
s = collections.Counter(s)
m = max(s.values())

a = []
for d in s.items():
    if d[1] == m:
        a.append(d[0])
for s in a:
    print(s)