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: Wrong Answer

Solution code:
n=int(input())
N=[]
num=list()
for _ in range(n):
  a=input()
  num.append(len(a))
  N.append(a)
longest=max(num)
ans=list()
for i in range(n):
  if num[i]==longest:
    ans.append(N[i])
ans=list(set(sorted(ans)))
for i in ans:
  print(i)

Submission status: Wrong Answer

Solution code:
import sys

lines = [l for l in sys.stdin]
length = int(lines[0])
words = lines[1:]
counter = {w: 0 for w in words}

for w in words:
  counter[w] += 1
  
max_count = max(counter.values())

ret = [w for w, v in counter.items() if v == max_count]
for w in ret:
  print(w)

Submission status: Wrong Answer

Solution code:
import collections

number = int(input())

array = []

for i in range(number):
    array.append(input())

dic = collections.Counter(array).most_common()

max_dic = [dic[0][0]]

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())

d = {}
for i in range(n):
  t = input()
  if t in d.keys():
    d[t] += 0
  else:
    d[t] = 0

s = sorted(list(set(d.keys())))
m = max(d.values())

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

Submission status: Wrong Answer

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)

print(C[0][0])

for i in range(1,L):
    if C[0][1]==C[i][1]:
        print(C[i][0])

Submission status: Wrong Answer

Solution code:

import collections

N = int(input())
list_1 = [input() for i in range(N)]
list_2 = collections.Counter(list_1)

for i in list_2:
    print(i)

m = max(list_2.values())

ans = [k for k in list_2 if list_2[k] == m]

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

Submission status: Wrong Answer

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

counted = collections.Counter(s)

m = max(counted.values())

chars = []
for key, value in counted.items():
    if value == m:
        chars.append(key)

print(sorted(chars))

Submission status: Wrong Answer

Solution code:
N = int(input())

S=[str(input()) for i in  range(N)]
S=[x for x in set(S) if S.count(x)>1]
S.sort()
for i in range(len(S)):
    print(S[i])

Submission status: Wrong Answer

Solution code:
N = int(input())

S=[str(input()) for i in  range(N)]
S=[x for x in set(S) if S.count(x)>=1]
S.sort()
for i in range(len(S)):
    print(S[i])

Submission status: Wrong Answer

Solution code:
N = int(input())

S=[str(input()) for i in  range(N)]
S=[x for x in set(S) if S.count(x)>=1]
S.sort()
print(S)

Submission status: Wrong Answer

Solution code:
import collections

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

maxn = m[0][1]
ans = []

for i in range(len(m)-1):
    if m[i][1] == maxn:
        ans.append(m[i][0])
    else:
        break
for i in sorted(ans):
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
d = dict()
max_value = 0
for i in range(n):
  x = input()
  if x in d:
    d[x] += 1
  else:
    d[x] = 1
  max_value = max([max_value, d[x]])

for key, value in d.items():
  if value == max_value:
    print(key)

Submission status: Wrong Answer

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

wkmax = wk = m = 0
c = []
b = list(set(si))
m = len(b)

for i in range(m):
    wk = si.count(b[i])
    if wkmax <= wk:
        wkmax = wk
    c.append([b[i],wk])

for i in range(len(c)):
    if c[i][1] == wkmax:
        print(c[i][0])

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s)
for i in range(len(c)):
    if c.most_common()[i][1]==c.most_common()[0][1]:
        print(c.most_common()[i][0])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [input() for i in range(N)]
import collections
s = collections.Counter(S)
M = max(s.values())
s = [e for e in s if s[e] == M]
for e in s:
    print(e)

Submission status: Wrong Answer

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)
x=len(c)
ans=[]
for i in range(x):
    if c.most_common(x)[i][1]==c.most_common(x)[0][1]:
        ans.append(c.most_common(x)[i][0])
    else:
        break
for j in range(len(ans)):
  print(ans[j])

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

import collections
a = int(input())
li1 = []
 
for i in range(a):
    li1.append(str(input()))
 
c = collections.Counter(li1)

print(c)
 
sorted_items = sorted(
  c.most_common(),
  key = lambda x:(x[1],x[0]), reverse=True)
  
print(sorted_items)
 
key, value = zip(*sorted_items)
li2 = []
li2.append(key[0])
for i in range(1,len(key)):
    if(value[0] == value[i]):
        li2.append(key[i])
    else:
        break;

list.sort(li2)

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

Submission status: Wrong Answer

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

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

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

v = dic[-1][1]
ans = reversed(list(dic))



for a in ans:
    if a[1] == v:
        print(a[0])

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

import collections
a = int(input())
li1 = []
 
for i in range(a):
    li1.append(str(input()))
 
c = collections.Counter(li1)

print(c)
 
sorted_items = sorted(
  c.most_common(),
  key = lambda x:(x[1],x[0]), reverse=True)
  
print(sorted_items)
 
key, value = zip(*sorted_items)
print(key[0])
for i in range(1,len(key)):
    if(value[0] == value[i]):
        print(key[i])
    else:
        break;

Submission status: Wrong Answer

Solution code:
import collections

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

lists = len(S)

for i in range(lists):
    ans.append(S.count(S[i]))

c = collections.Counter(S)

print(c.most_common()[0][0])

Submission status: Wrong Answer

Solution code:
from collections import Counter

N=int(input())
S=Counter([input() for _ in range(N)])
S_sorted = sorted(S.items(), key=lambda x:x[0])

for kv in S_sorted:
  if kv[1] == max(S.values()):
    print(kv[0])
  else:
    break

Submission status: Wrong Answer

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

v = sorted(set(s))
num = []

for i in v:
    num.append(s.count(i))
d = dict(zip(v, num))
d_sort = sorted(d.items(), key=lambda x: x[1], reverse=True)

ma = max(d.values())
for i in range(len(v)):
    if d_sort[i][1]==ma:
        print(d_sort[i][0])
    else:
        break

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())

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

dic = Counter(S)

ans = [key for key, value in dic.items() if value == max(dic.values())]

print(sorted(ans))

Submission status: Wrong Answer

Solution code:
from collections import Counter
import sys
n = int(sys.stdin.readline())
sn = sys.stdin.read().split()
c = Counter(sn)
c = sorted(c.items(), key=lambda x: (x[1], x[0]))
num = c[0][1]
for i, j in c:
  if j == num:
    print(i)
  else:
    quit()

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
import collections as cc
a=[input() for i  in range(n)]
f=cc.Counter(a)
ch=max(f.values())
ans=set()
for i in a:
    if f[i]==ch:
        ans.add(i)
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
import collections as cc
a=[input() for i  in range(n)]
f=cc.Counter(a)
ch=max(f.values())
ans=[]
for i in a:
    if f[i]==ch:
        ans.append(i)
ans.sort()
for i in set(ans):
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
memo = {}
ans = []
w = []
for i in range(n):
    a = input()
    if a in memo:
        memo[a] += 1
        if a in ans:  
            pass
        else:
            ans.append(a)
    else:
        w.append(a)
        memo[a] = 1
max_n = 0
saigo = "a"

for i in range(len(ans)):
    if memo[ans[i]] > max_n:
        max_n = memo[ans[i]]
        saigo = ans[i]
    elif memo[ans[i]] == max_n:
        saigo += " " + ans[i]

if saigo == "a":
    for i in w:
        print(i)
else:   
    for i in saigo.split():
        print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
memo = {}
ans = []

for i in range(n):
  	a = input()
  	if a in memo:
  	    memo[a] += 1
  	    if a in ans:
  	        pass
  	    else:
  	        ans.append(a)
  	else:
  	    memo[a] = 1

max_n = 0
saigo = "a"

for i in range(len(ans)):
    if memo[ans[i]] > max_n:
        max_n = memo[ans[i]]
        saigo = ans[i]
    elif memo[ans[i]] == max_n:
        saigo += " " + ans[i]


for i in saigo.split():
    print(i)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
A = [input() for x in range(N)]
cnt = Counter(A)
mx = max(cnt.values())
sorted(cnt.items())
print('\n'.join(s for s, v in cnt.items() if v == mx))

Submission status: Wrong Answer

Solution code:
n = input()
d = dict()
M = 1
for i in range(n):
  w = raw_input()
  if w in d:
    d[w] += 1
    M = max(d[w], M)
  else:
    d[w] = 1
l = []
for k in d:
  if d[k] == M:
    l.append(k)
l = sorted(l, reverse=True)
for one in l:
  print (one)

Submission status: Wrong Answer

Solution code:
n = input()
d = dict()
for i in range(n):
  w = raw_input()
  if w in d:
    d[w] += 1
  else:
    d[w] = 1
di = d.items()
def com(a,b):
  if a[1] > b[1]:
    return True
  elif a[1] == b[1]:
    return a[0]>b[0]
  else:
    return False
di = sorted(di, cmp=com)
print(di[0][0])
if len(di) > 1:
  print(di[1][0])

Submission status: Wrong Answer

Solution code:
n = input()
d = dict()
for i in range(n):
  w = raw_input()
  if w in d:
    d[w] += 1
  else:
    d[w] = 1
di = d.items()
def com(a,b):
  if a[1] > b[1]:
    return True
  elif a[1] == b[1]:
    return a[0]>b[0]
  else:
    return False
di = sorted(di, cmp=com)
print(di[0])
if len(di) > 1:
  print(di[1])

Submission status: Wrong Answer

Solution code:
N = int(input())
L = [input() for i in range(N)]
L = sorted(L)
D = {}

for i in L:
    if i in D:
        V = D.get(i) + 1
    else:
        V = 1
    D[i] = V

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

for i in range(N-1):
    print(D[i][0])
    if len(D)==1:
        exit()
    elif D[i][1] == D[i+1][1]:
        None
    else:
        exit()
print(D[N-1][0])

Submission status: Wrong Answer

Solution code:
N = int(input())
L = [input() for i in range(N)]
L = sorted(L)
D = {}

for i in L:
    if i in D:
        V = D.get(i) + 1
    else:
        V = 1
    D[i] = V

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

for i in range(N-1):
    print(D[i][0])
    if len(D)==1:
        exit()
    elif D[i][1] == D[i+1][1]:
        continue
    else:
        exit()
print(D[N-1][0])

Submission status: Wrong Answer

Solution code:
# coding: utf-8
from collections import Counter
import numpy as np


def main():
    n = int(input())
    polls_list = []
    for _ in range(n):
        polls_list.append(input())
    polls_counter = Counter(polls_list)
    # print(polls_counter)
    max_poll = max(polls_counter.values())
    polls_array = np.array(polls_counter.most_common(max_poll))
    # print(polls_array)
    polls_array = sorted(polls_array[:, 0])
    # print(polls_array)
    for poll in polls_array:
        print(poll)

    return 0


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = int(input())
L = [input() for i in range(N)]
L = sorted(L)
D = {}

for i in L:
    if i in D:
        V = D.get(i) + 1
    else:
        V = 1
    D[i] = V

Ans = [k[0] for k in D.items() if k[1] == max(D.values())]
for i in Ans:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S = list(input() for i in range(N))
S.sort()

common = collections.Counter(S).most_common()
N_common = common[0][1]

for i in range(len(common)):
    if (common[i][1] == N_common):
        print(common[i][0])

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[input() for i in range(n)]
 
from collections import Counter
c = Counter(a).most_common()
d=c[0][1]

keys = [k for k, v in c if v == d]
 
string = "\n".join(keys)
print(string)

Submission status: Wrong Answer

Solution code:
def solve():
    N = int(input())
    dict = {}

    for _ in range(N):
        S = input()
        if S in dict:
            dict[S] += 1
        else:
            dict[S] = 1
    sorted_dict = list(sorted(dict.items(), key=lambda x:x[1], reverse=True))
    mx = sorted_dict[0][1]
    cand = []
    for d in sorted_dict:
        if d[1] == mx:
            cand.append(d[0])
        else:
            break
    print(sorted(cand))
    
if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
from collections import *
N = int(input())
count = Counter(input().split())


m = max(count.values())


ans = [a for a,b in count.items() if b == m]
ans.sort()
for S in ans:
    print(S)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n = int(input())
s = defaultdict(lambda: 0)

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

max_s = [kv[0] for kv in s.items() if kv[1] == max(s.values())]

for i in max_s:
    print(i)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    S = [input() for _ in range(N)]
    dict = {}
    for i in range(N):
        if S[i] not in dict:
            dict[S[i]] = 1
        else:
            dict[S[i]] += 1
    ans = {}
    p = 0
    for i ,j in dict.items():
        if p < j : p = j

        if j not in ans:
            ans[j] = [i]
        else:
            ans[j].append(i)
    for i in range(len(ans[p])):
        print(ans[p][i])
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = sorted(list(input() for _ in range(n)))
s2 = dict(Counter(s))
mx = max(s2.values())
vl = list(s2.values())
word = list(s2.keys())
for i in range(len(word)):
    if mx == vl[i] :
        print(word[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
s = sorted(list(input() for _ in range(n)))
w = list(set(s))
c = []
for i in w :
    num = s.count(i)
    c.append(num)

mx = max(c)
for j in range(len(c)) :
    if mx == c[j] :
        print(w[j])

Submission status: Wrong Answer

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(i)
	elif max < v:
		results = [i]
		max = v
        
for i in results:
	print(i)

Submission status: Wrong Answer

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(i)
	elif max < v:
		results = [i]
        
for i in results:
	print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = ["" for i in range(N)]
dict1 = {"key":1}
names =[]
for i in range(N):
    S[i] = input()

for i in range(N):
    if not (S[i] in dict1.keys()):
        names.append(S[i])
        dict1.update({S[i]:1})
    else:
        dict1[S[i]] +=1
maxv = 0
for i in range(len(names)):
    if maxv < dict1[names[i]]:
        maxv = dict1[names[i]]

winners = []

for i in range(len(names)):
    if dict1[names[i]] == maxv:
        winners.append(names[i])

winners.sort()
for i in range(len(winners)):
    print(winners[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
S = ["" for i in range(N)]
dict1 = {"key":-1}
names =[]
for i in range(N):
    S[i] = input()

for i in range(N):
    if not (S[i] in dict1.keys()):
        names.append(S[i])
        dict1.update({S[i]:1})
    else:
        dict1[S[i]] +=1
maxv = 0
for i in range(len(names)):
    if maxv < dict1[names[i]]:
        maxv = dict1[names[i]]

winners = []

for i in range(len(names)):
    if dict1[names[i]] == maxv:
        winners.append(names[i])

winners.sort()
for i in range(len(winners)):
    print(winners[i])

Submission status: Wrong Answer

Solution code:
n=int(input())
d=dict()
for _ in range(n):
    a=input()
    if a in d:
        d[a]+=1
    else:
        d[a]=1
keys = sorted([k for k,v in d.items() if v==max(d.values())])
print(keys,sep="\n")

Submission status: Wrong Answer

Solution code:
n = int(input())

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

_max = 0
for v in dic.values():
  if _max < v:
    _max = v

for k,v in dic.items():
  if v == _max:
    print(k)

Submission status: Wrong Answer

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

c=collections.Counter(S)
most=c.most_common()
m_cnt=most[0][1]
for i in most:
    if i[1]==m_cnt:
        print(i[0])
    else:
        break

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]
ans = sorted([(k,v) for k,v in Counter(S).items() if max(Counter(S).values()) == v], key=lambda x: (-x[1], x[0]))
print("\n".join(dict(ans).keys()))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
S = []
for _ in range(N):
    s = input().replace("\n", "")
    S.append(s)
S.sort()
f = 0
tres = 0
res = [s[0]]
for i in range(1, N):
    if S[i] == S[i-1]:
        f += 1
    else:
        f = 0
    if f == tres:
        res.append(S[i])
    elif f > tres:
        tres = f
        res = [S[i]]

print("\n".join(map(str, res)))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
S = []
for _ in range(N):
    s = input().replace("\n", "")
    S.append(s)
S.sort()
f = 0
tres = 0
res = []
for i in range(1, N):
    if S[i] == S[i-1]:
        f += 1
    else:
        f = 0
    if f == tres:
        res.append(S[i])
    elif f > tres:
        tres = f
        res = [S[i]]

print("\n".join(map(str, res)))

Submission status: Wrong Answer

Solution code:
#標準入力からの値取得(N)
N = int(input())
#標準入力からの値取得(List)
S = []
for i in range(N):
  S.append(input())
#ループで廻しつつ要素数をカウントする
ans = {}
for cnt in S:
  if cnt in ans:
    ans[cnt] += 1
  else:
  	ans[cnt] = 1

max_v = max(ans.values())
for k, v in ans.items():
  if v == max_v:
    print(k)

Submission status: Wrong Answer

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))

Submission status: Wrong Answer

Solution code:
n = int(input())
input_array = []
for i in range(n):
    input_array.append(input())
counter = {}
for i in set(input_array):
    counter[i] = input_array.count(i)
max_key_list = [kv[0] for kv in counter.items() if kv[1]==max(counter.values())]
for i in max_key_list:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
s = [input() for _ 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: Wrong Answer

Solution code:
import collections

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: Wrong Answer

Solution code:
from collections import Counter
n, cnt, mx, arr = int(input()), Counter(), -1, []
for i in range(n):
    s = input()
    arr.append(s)
    cnt[s] += 1
    mx = max(mx,cnt[s])
res = []
for i in arr:
    if cnt[i] == mx:
        res.append(i)
res.sort()
for i in res:
    print(i)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
arr = list(map(str,input().split()))
cnt, mx = Counter(), -1
for i in arr:
    cnt[i] += 1
    mx = max(mx,cnt[i])
res = []
for i in arr:
    if cnt[i] == mx:
        res.append(i)
res.sort()
print(res[0])

Submission status: Wrong Answer

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)
elif len(list(set(vote_list))) == 1:
    print(vote_list[0])
else:
    i = 0
    while count.most_common()[i][1] == max_count:
        print(count.most_common()[i][0])
        i = i + 1

Submission status: Wrong Answer

Solution code:
n=int(input())
poll={}
m=0
for v in range(n):
    s=input()
    if s in poll:
        poll[s]+=1
        if poll[s]>m:
            m=poll[s]
    else:
        poll[s]=0
for s in poll:
    if poll[s]==m:
        print(s)

Submission status: Wrong Answer

Solution code:
from collections import Counter

def main():
    n = int(input())
    s = [input() for _ in range(n)]
    C = Counter(s)
    cl = C.most_common()
    print(cl)
    mx = cl[0][1]
    ans = []
    for c in cl:
        if (c[1] == mx):
            ans.append(c[0])
        else:
            break
    ans.sort()
    for i in ans:
        print(i)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
L=[input() for i in range(N)]
L.sort()
c=1
memo=0
ans=[]
for i in range(1,N):
  if L[i]==L[i-1]:
    c+=1
  else:
    if c==memo:
      ans.append(L[i-1])
    elif c>memo:
      ans.clear()
      ans.append(L[i-1])
      memo=c
    c=1
if c==memo:
  ans.append(L[N-1])
else:
  ans.clear()
  ans.append(L[N-1])
for i in range(len(ans)):
  print(ans[i])

Submission status: Wrong Answer

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

from collections import Counter
c = 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: Wrong Answer

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

c = collections.Counter(a)
naga=len(c)
ma=c.most_common()[0][1]
 
for i in range(naga):
    if c.most_common()[i][1]==ma:
        print(c.most_common()[i][0])

Submission status: Wrong Answer

Solution code:
from operator import itemgetter
import datetime

n = int(input())
sn = dict()

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

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

max_val = max(dict(sn).values())

for si in sn:
    if(int(si[1]) == max_val):
        print(si[0])
    else:
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
dict = {}
mx = 0
for i in range(n):
    s = input()
    if s not in dict:
        dict[s] = 0
    dict[s] += 1
    mx = max(mx, dict[s])
print(dict)
print(mx)
ans = []
for s in dict:
    if dict[s] == mx:
        ans.append(s)
ans.sort()
for s in ans:
    print(s)

Submission status: Wrong Answer

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

wkmax = wk = 0
b = c = []
b = list(set(si))
for i in range(len(b)):
    c.append([b[i],[0]])

for j in range(len(c)):
    wk = si.count(c[j][0])
    c[j][1] = wk
    wkmax = max(wkmax,wk)

for i in range(len(c)):
    if c[i][1] == wkmax:
        print(c[i][0])

Submission status: Wrong Answer

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 j in range(N):
    if S.count(S[j]) == Max_A:
        ans.append(S[j])
ans = set(ans)
ans = list(ans)
ans.sort
for k in ans:
    print(k)

Submission status: Wrong Answer

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 j in range(N):
    if S.count(S[j]) == Max_A:
        ans.append(S[j])
ans = set(ans)
ans = list(ans)
ans.sort
for k in range(len(ans)):
    print(ans[k])

Submission status: Wrong Answer

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

ans=[]
for i in s.keys():
  if s[i]==mx:
    ans.append(i)
for i in ans:
  print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
dic = {}
for _ in range(n):
    s = input()
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 0
top = []
laeger = 0
for v in dic.values():
    if v >= laeger:
        laeger = v

for k, v in dic.items():
    if v == laeger:
        top.append(k)
print(sorted(top))

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())

S = []
cnt = []
for i in range(N):
  s = input()
  if s in S:
    cnt[S.index(s)] += 1
  else:
    S.append(s)
    cnt.append(1)

cnt = np.array(cnt)
S = np.array(S)

ans = S[cnt==cnt.max()]
ans.sort()

print(ans)

for s in ans:
  print(s)

Submission status: Wrong Answer

Solution code:
from collections import Counter

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = read().split()
S.sort()

res = []
c = Counter(S)
max_num = c.most_common(1)[0][1]
for i, j in list(c.items()):
    if j == max_num:
        res.append(i.decode())
        
print('\n'.join(res))

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
for i in range(n):
   a.append(input())
a=sorted(a)
d={}
for i in range(n):
    if a[i] not in d:
        d[a[i]]=1
    else:
        d[a[i]]+=1
all_values=d.values()
m=max(all_values)
for i in d:
    if d[i]==m:
        print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[]
for i in range(n):
   a.append(input())
a.sort()
d={}
for i in range(n):
    if a[i] not in d:
        d[a[i]]=1
    else:
        d[a[i]]+=1
all_values=d.values()
m=max(all_values)
for i in d:
    if d[i]==m:
        print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
maxnum = 0
maxyouso = {}
anslist = []
for kai in range (N):
    S.append(input())
for moji in S:
    if moji not in maxyouso:
        maxyouso[moji] = 1
    else:
        maxyouso[moji] = maxyouso[moji] + 1
print(maxyouso)
for num in maxyouso:
    if maxyouso[num] > maxnum:
        maxnum = maxyouso[num]
for num in maxyouso:
    if maxyouso[num] == maxnum:
        anslist.append(num)
anslist.sort()
for k in anslist:
    print(k)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
maxnum = 0
maxyouso = []
for kai in range (N):
    S.append(input())
for num in S:
    if S.count(num) > maxnum:
        maxnum = S.count(num)
for num in S:
    if S.count(num) == maxnum:
        maxyouso.append(num)
maxyouso = (set(maxyouso))
for j in maxyouso:
    print(j)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
maxnum = 0
maxyouso = []
for kai in range (N):
    S.append(input())
for num in S:
    if S.count(num) > maxnum:
        maxnum = S.count(num)
for num in S:
    if S.count(num) == maxnum:
        maxyouso.append(num)
maxysouso = set(maxyouso)
maxyouso.sort()
for j in maxyouso:
    print(j)

Submission status: Wrong Answer

Solution code:
n = int(input())
l = []
for _ in range(n):
    ll = input()
    l.append(ll)
    
ss = set(l)
s = list(ss)

ans = []
for i in range(len(s)):
    cnt = l.count(s[i])
    ans.append(cnt)
    
m = max(ans)
res = []
for j in range(len(ans)):
    if ans[j] == m:
        res.append(l[j])
        
res.sort()
for k in range(len(res)):
    print(res[k])

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
l=[input() for x in range(n)]
p=Counter(l)
l=sorted(l)
s=list(set(l))
s=sorted(s)
for i in range(len(s)):
    if l.count(s[i])==p[max(p)]:
        print(s[i])

Submission status: Wrong Answer

Solution code:
from collections import Counter

n = int(input())
a = [s for s in input().split()]

c = Counter(a)
list = c.most_common()
max = list[0][1]

ans = []
for i, j in list:
    if j == max:
        ans.append(i)
    else:
        break

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

Submission status: Wrong Answer

Solution code:
n = int(input())
l =[]
for i in range(n):
    t = input()
    l.append(t)
s = list(set(l))
d={}
for p in s:
    c = l.count(p)
    d[p] = c

m = max(d.values())
for k,v in d.items():
    if v == m:
        print(k)

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
l =[]
for i in range(n):
    t = input()
    l.append(t)
d = collections.Counter(l)
m = max(d.values())
for k,v in d.items():
    if v == m:
        print(k)

Submission status: Wrong Answer

Solution code:
from 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 j,k in CS.items():
  if v == k:
    ans.append(j)
ans.sort()
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
if __name__ == '__main__':
    dic = dict()
    n = int(input())
    for i in range(n):
        val = input()
        if val in dic.keys():
            dic[val]+=1
        else:
            dic[val]=1
    max_keys = max(dic.values())
    values_of_max_key = [val for val in dic if dic[val] == max_keys]
    for s in values_of_max_key:
        print(s)

Submission status: Wrong Answer

Solution code:
if __name__ == '__main__':
    dic = dict()
    n = int(input())
    for i in range(n):
        val = input()
        if val in dic.keys():
            dic[val]+=1
        else:
            dic[val] = 1
    max_keys = max(dic.values())
    values_of_max_key = [val for val in dic if dic[val] == max_keys]
    for s in values_of_max_key:
        print(s)

Submission status: Wrong Answer

Solution code:
N = int(input())
d = {}
for i in range(N):
  s = input()
  if s not in d.keys():
    d[s] = 1
  else:
    d[s] += 1
d = sorted(d.items(), key=lambda x: x[1])[::-1]
a = max(d)[1]
l = []
for i, j in d:
  if j == a:
    l.append(i)
l = sorted(l)
for i in range(len(l)):
  print(l[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
d = {}
for i in range(N):
  s = input()
  if s not in d.keys():
    d[s] = 1
  else:
    d[s] += 1
d = sorted(d.items(), key=lambda x: x[1])[::-1]
a = max(d)[1]
l = []
for i, j in d:
  if j == a:
    l.append(i)
  else:
    break
l = sorted(l)
for i in range(len(l)):
  print(l[i])