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

N = int(input())
a = []
for i in range(N):
  a.append(str(input()))
a = collections.Counter(a)
b = max(a.values())
max_k_list = [kv[0] for kv in a.items() if kv[1] == b]
for i in max_k_list:
  print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
k = []
maximum = 1
now = 1
ans = []
for i in range(N):
    S = input()
    k.append(S)
k.sort()
for j in range(len(k)-1):
    if k[j] == k[j+1]:
        now += 1
        if j == len(k)-2:
            if now>maximum:
                maximum = now
                ans.clear()
                ans.append(k[j])
            elif now == maximum:
                ans.append(k[j])
            else:
                break
    else:
        if now>maximum:
            maximum = now
            ans.clear()
            ans.append(k[j])
        elif now == maximum:
            ans.append(k[j])
        else:
            continue
        if j == len(k)-2:
            if now == maximum:
                ans.append(k[j+1])
for i in range(len(ans)):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

c = Counter(s)
ans_number = c.most_common()[0][1]

s_max = []
for i in range(len(c)):
  if c.most_common()[i][1] == ans_number:
    s_max.append(c.most_common()[i][0])

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

Submission status: Wrong Answer

Solution code:
import collections

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

print_list = []
count = []
S_max = 0

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

values, counts = zip(*S_common)

#print(counts[0])

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N = int(input())
S = [input() for i in range(N)]
S.sort()
input_dict = defaultdict(int)
for key in S:
    input_dict[key] += 1
for k, v in input_dict.items():
    if v == input_dict[max(input_dict)]:
        print(k)

Submission status: Wrong Answer

Solution code:
N = int(input())
poll = {}
for i in range(N):
    S = input()
    if S in poll:
        poll[S] = poll[S] + 1
    else:
        poll[S] = 1
        
a = [k for k, v in poll.items() if v == max(poll.values())]

for el in a:
    print(el)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
from collections import Counter
def solve(N: int, S: "List[str]"):
    a=Counter(S)
    values,counts=zip(*a.most_common())
    p=max(list(counts))
    o=list(counts).count(p)
    for i in reversed(range(o)):
        print(list(values)[i])
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = [next(tokens) for _ in range(N)]  # type: "List[str]"
    solve(N, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
a=input()
N=int(a)
wlist=[]
nlist=[]
num=1
max=0
now=0
for i in range(N):
    b=input()
    wlist.append(b)
wlist.sort()
for i in range(N-1):
    if wlist[i]==wlist[i+1]:
        num+=1
    else:
        nlist.append(num)
        if num>max:max=num
        num=1
    if i==N-2:
        nlist.append(num)
for i in range(len(nlist)):
    if nlist[i]==max:
        print(wlist[now])
    now+=nlist[i]

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
S = [0]*N
for i in range(N):
  S[i] = input()  
S.sort()
c = Counter(S)
m_num = c.most_common()[0][1]

for s in set(S):
  if c[s] == m_num:
    print(s)

Submission status: Wrong Answer

Solution code:
N=int(input())

D=dict()
for i in range(N): 
    S=input()

    if S not in D:
        D[S]=1
    else:
        D[S]+=1

M=D[max(D)]
ans=[]
for s in D:
    if D[s]==M:
        ans.append(s)

ans.sort()
A=''
for s in ans:
    A+='{}\n'.format(s)

print(A)

Submission status: Wrong Answer

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

S.sort()
a = S[0]
c = 0
moji = []

for i in S:
    if a == i:
        c += 1
        continue
    else:
        moji.append([c,a])
        a = i
        c = 1
if c > 0:
    moji.append([c,a])

moji.sort(reverse=True)
maxc = moji[0][0]
for j in moji:
    if j[0] < maxc: break
    print (j[1])

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
s.sort()
s_cnt = Counter(s)
max_cnt = s_cnt.most_common()[0][1]
s_cnt_common = s_cnt.most_common()
for i in range(len(s_cnt_common)):
    if s_cnt_common[i][1] == max_cnt:
        print(s_cnt_common[i][0])

Submission status: Wrong Answer

Solution code:
from sys import stdin
import collections

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

counted = collections.Counter(s)

m = max(counted.values())

chars = [key for key, value in counted.items()
             if value == m]
moji = '\n'.join(chars)

print(moji)

Submission status: Wrong Answer

Solution code:
n = int(input())
s=[]
for i in range(n):
  s.append(input())
t=set(s)
d={}
for k in t:
  d[k] = s.count(k)
for g,j in d.items():
  if(j==max(d.values())):
    print(g)

Submission status: Wrong Answer

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

for m in range(n):
    s = input()
    if s:
        if not s in sDict:
            sDict[s] = 1
        else:
            sDict[s] += 1
    else:
        break

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

tempValue = ""
for key, value in reversed(sDict):
    if tempValue:
        if tempValue != value:
            break
        
    else:
        tempValue = value

    print(key)

Submission status: Wrong Answer

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

w = []
m = 0
for x in u:
    n = sum([1 for i in s if i == x])
    if n > m:
        m = n
        w.clear()
        w.append(x)
    elif n == m:
        w.append(x)

print(sorted(w))

Submission status: Wrong Answer

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

ls=[]
for i in S:
    if i not in ls:
        ls.append(i)
str_ls =[]
num_ls = []
flag = 0

for i in ls:
    num_ls.append(S.count(i))
    str_ls.append(i)

for i in range(len(str_ls)):
    if num_ls[i] == max(num_ls):
        print(str_ls[i])

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())

data = []
val = [0]*N

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

data.sort()
c = collections.Counter(data)

mostc = c.most_common()
mostv = mostc[0][1]

for x in mostc:
    if x[1] == mostv:
        print(x[0])

Submission status: Wrong Answer

Solution code:
n = input()
n = int(n)
# strs= input().split()
hashs = {}

for i in range(n):
    s = input()
    if s not in hashs.keys():
        hashs[s] = 1
    else:
        hashs[s] += 1
# sorted(hashs.items(), key=lambda item:item[1])
maxs = 0
for key, value in hashs.items():
    maxs = max(maxs, value)

for key, value in hashs.items():
    if value == maxs:
        print(key)

Submission status: Wrong Answer

Solution code:
import collections

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

count = collections.Counter(lis)

max_c = [kv for kv in count.items() if kv[1] == max(count.values())]

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

Submission status: Wrong Answer

Solution code:
import sys

N = int(sys.stdin.readline())
S = [None]*N
counter = {}
for i in range(N):
    tmp = input()
    if not tmp in counter:
        counter[tmp] = 0
    else:
        counter[tmp] += 1

counter_sorted = sorted(counter.items(), reverse = True)
tmp = counter_sorted[0][1]

output = []
L = len(counter)
for i in range(L):
    if tmp == counter_sorted[i][1]:
        output.append(counter_sorted[i][0])
    else:
        break

output = sorted(output)
for i in output:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
count = [0] * n
count[0] = 1

for i in range(n):
    s_e = str(input())
    s.append(s_e)
s.sort()

last = s[0]
s_max = 0

for i in range(1, n):
    if last == s[i]:
        count[i] = count[i-1] + 1
        s_max = max(s_max, count[i])
    else:
        last = s[i]
        count[i] = 1

for i in range(n):
    if s_max == count[i]:
        print(s[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
d = {}
for i in range(N):
  s = input()
  if s in d.keys():
    d[s] += 1
  else:
    d[s] = 1
l = [k for k, v in d.items() if v == max(d.values())]
#print('\n'.join(sorted(l)))
for i in l:
  print(i)

Submission status: Wrong Answer

Solution code:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
import itertools
from functools import reduce
from operator import mul
from collections import Counter


Num = int(stdin.readline().rstrip())
data = []
for el in range(Num):
    data.append(stdin.readline().rstrip())
data.sort()

counter = Counter(data)
count = 0
check = 0
for el in counter.most_common():
    if count == 0:
        print(el[0])
        check = el[1]
        count = 1
        continue
    if check > el[1]:
        break
    print(el[0])

Submission status: Wrong Answer

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

  dic={}
  for string in poll:
    if string not in dic:
      dic[string]=1
    else:
      dic[string]+=1
    
  max_k=[k for k, v in dic.items() if v == max(dic.values())]
  print(*max_k,sep='\n')
  
if __name__=='__main__':
  main()

Submission status: Wrong Answer

Solution code:
import collections
from collections import Counter
n=int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)
max = c.most_common()[0][1]
list = []
for i in c.items():
    if i[1] == max:
        list.append(i[0])
for i in reversed(list):
    print(i)

Submission status: Wrong Answer

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

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

for i in range(len(counts)-1):
    if counts[i] == counts[i+1]:
        index += 1
    else:
        break

for j in range(index+1):
    print(values[j])

Submission status: Wrong Answer

Solution code:
import collections
N=int(input())
L=[]
for i in range(N):
  L.append(input())
S=collections.Counter(L)
MS= max(S.values())
for k,v in S.items():
  if v==MS:
    print(k)

Submission status: Wrong Answer

Solution code:
n = int(input())
counts = {}
best = 0
best_words = []
for idx in range(n):
    string = input()
    if counts.get(string) is None: counts[string] = 1
    else: counts[string] += 1

    score = counts[string]

    if score > best:
        best = score
        best_words = [string]
    
    elif score == best:
        best_words.append(string)

for string in best_words:
    print(string)

Submission status: Wrong Answer

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

import os
import datetime

def main():

    str_dict = {}
    val_1 = int(input())
    for i in range(val_1):
        val_x = input()

        if not val_x in str_dict:
            str_dict[val_x] = 1
        else:
            num = str_dict.get(val_x)
            str_dict[val_x] = num + 1

    for k, v in sorted(str_dict.items(), key=lambda x: -x[1]):
        print(k)




if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import Counter

N = int(input())
S = [str(input()) for i in range(N)]
X = Counter(S)
ans = X.most_common()
p = ans[0][1]

A = [i[0] for i in X.items() if i[1] == p]

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

Submission status: Wrong Answer

Solution code:
import collections
import sys

input = sys.stdin.readline

N = int(input())
candidate = [input().strip("\n") for _ in range(N)]

candidate.sort()
c = collections.Counter(candidate)

for i in range(len(c.most_common())):
    if c.most_common()[i][1] == c.most_common()[0][1]:
        print(c.most_common()[i][0])
        continue
    else:
        break

Submission status: Wrong Answer

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

scount = Counter(s)
scsort = scount.most_common()
x = scsort[0][1]
for i in scsort:
    if i[1] != x:
        break
    print(i[0])

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(input() for i in range(N))
a.sort()
count = 1
max = 0
ls = []
for i in range(N - 1):
  if a[i] == a[i + 1]:
    count += 1
  else:
    if count > max:
      ls = []
      ls.append(a[i])
      max = count
    elif count == max:
      ls.append(a[i])
    count = 1
if max == 1:
  ls.append(a[N - 1])
ls.sort()
for i in range(len(ls)):
  print(ls[i])

Submission status: Wrong Answer

Solution code:
N = int(input())

dic = {}

for i in range(N):
	key = input()
	if key not in dic:
		dic[key] = 1
	else:
		dic[key] +=1

maxnum = max(dic.values())
#print(maxnum)
#print(dic)

keys = list(dic.keys())
for key in reversed(keys):
	if dic[key] == maxnum:
		print(key)

Submission status: Wrong Answer

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

info.sort()

ans = [info[0]]
record = 1
tem_record = 1
for i in range(n-1):
    if info[i] == info[i+1]:
        tem_record += 1
        if tem_record == record:
            ans.append(info[i])
    else:
        if tem_record > record:
            record = tem_record
            ans = [info[i]]
        tem_record = 1

if record == 1 and info[n-1] != info[n-2]:
    ans.append(info[n-1])


ans.sort()
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())

d = {}
for _ in range(n):
  s = input()
  if s in d.keys():
    d[s] += 1
  else:
    d[s] = 1

r = {}
for k, v in d.items():
  if v in r.keys():
    r[v].append(k)
  else:
    r[v] = [k]  # make list
    
t = list(r.keys())[-1]
for s in r[t]:
  print(s)

Submission status: Wrong Answer

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(), reverse = True, key=lambda x: x[1])  
for word, value in sorted_S:
  if value == sorted_S[0][1]: print(word)

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
s = []
for i in range(n):
    s.append(input())
s.sort()
c = collections.Counter(s)
c_most = c.most_common()

i = 0
while (True):
    print(c_most[i][0])
    i += 1
    if i == len(c_most):
        break
    if c_most[i][1] != c_most[i - 1][1]:
        break

Submission status: Wrong Answer

Solution code:
import collections

count = input()

l = []
ans = []
for i in range(int(count)):
    l.append(input())
c = collections.Counter(l)
#print(l)
#print(c)
#print(c.most_common()[0][1])
print("--")
max_count = c.most_common()[0][1]
for i in c.most_common():
    if i[1] != max_count:
        exit()
    #print(i[0])
    ans.append(i[0])
ans.sort()
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = []
for i in range(N):
    S.append(str(input()))
dict_uni = {x:S.count(x) for x in set(S) if S.count(x)>=1}
dict_sorted = sorted(dict_uni.items(), key=lambda x:x[1], reverse=True)
for i in dict_sorted:
    print(i[0])

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())

    count = dict()
    for i in range(N):
        s = input()
        try:
            count[s] += 1
        except:
            count[s] = 1
    
    sort_ = sorted(count.items(), key=lambda x:x[0], reverse=True)

    max_value = sort_[0][1]
    item = []
    for key,value in sort_:
        print(value)
        if value == max_value:
            item.append(key)
        else:
            break
        
    item.sort()
    for ans in item:
        print(ans)
    

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = int(input())
s = [input() for i in range(n)]
d = {}
for i in s:
    if i in d.keys():
        d[i]=d[i]+1
    else:
        d[i]=1
d_sorted = sorted(d.items(), key=lambda x:x[1])
d_name = [x[0] for x in d_sorted if x[1] == d_sorted[-1][0]]
d_name.sort()
print("\n".join(d_name))

Submission status: Wrong Answer

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

c = collections.Counter(s1)
s2 = c.most_common()

#print(s2)
a = 0
for i in range(len(s2)):
    if s2[0][1] == s2[i][1]:
        a = a + 1

for i in range(a):
    print(str(s2[i][0]))

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
ls = [input() for i in range(n)]    
c = collections.Counter(ls)
count = c.most_common()[0][1]
ans = []
if c.most_common()[0][1] == 1:
    ls.sort()
    for i in ls:
        print(i)
elif c.most_common()[-1][1] == c.most_common()[0][1]:
    ls.sort()
    for i in ls:
        print(i)
else:
    for i in range(len(c)):
        p = c.most_common()
        if p[i][1] == count:
            ans.append(p[i][0])
        else:
            break   
    ans.sort()
    for i in ans:
      print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
L =  list(str(input()) for i in range(N))
c = collections.Counter(L)
# print(c)
max_k_list = [kv[0] for kv in c.items() if kv[1] == max(c.values())]
# print(max_k_list)
for i in max_k_list:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
s=[]
for i in range(n):
  s.append(input())
t=set(s)
d={}
for k in t:
  d[k] = s.count(k)
res=sorted(d.items(),key=lambda x:x[1],reverse=True)
for g,j in res:
  if(j==max(list(d.values()))):
    print(g)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

c = Counter(S).most_common()
a = c[0][1]
for v in c:
    if v[1] != a: break
    print(v[0])

Submission status: Wrong Answer

Solution code:
N = int(input())

dic = {}

for i in range(N):
	key = input()
	if key not in dic:
		dic[key] = 0
	else:
		dic[key] +=1

maxnum = max(dic.values())

keys = list(dic.keys())
for key in reversed(keys):
	if dic[key] == maxnum:
		print(key)

Submission status: Wrong Answer

Solution code:
def main():
    N = int(input())
    S = []
    for i in range(N):
        s = input()
        S.append(s)
    S.sort()
    tmp = {}
    m = 0
    for s in S:
        if s not in tmp.keys():
            tmp[s]=0
        else:
            tmp[s]+=1
        if m<tmp[s]:
            m = tmp[s]
    for key in tmp:
        val = tmp[key]
        if val == m:
            print(key)
main()

Submission status: Wrong Answer

Solution code:
N = int(input())
cnt_list = {}
for i in range(N):
  S = input()
  if S in cnt_list:
    cnt_list[S] += 1
  else:
    cnt_list[S] = 0

max_cnt = max(cnt_list.values())
res_list = []

for a in cnt_list.items():
  if a[1] == max_cnt:
    res_list.append(a[0])

res_list.sort()
print(res_list)

Submission status: Wrong Answer

Solution code:
n = int(input())
S = []
m = 0
for i in range(n):
    S.append(input())
A = set(S)
A = sorted(A)
al = {}
for i in A:
    al[i] = S.count(i)
    if S.count(i) > m:
        m = S.count(i)
for i in al:
    if S.count(i) == m:
        print(i)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
s.sort()
maxcnt = 0
counter = Counter(s)
for word, cnt in counter.most_common(1):
	maxcnt = cnt
for word, cnt in counter.most_common():
	if maxcnt == cnt:
		print (word)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N=int(input())
ll=[input() for i in range(N)]
ll=Counter(ll)
ll=ll.most_common()
ll.sort(key=lambda x:(x[1],x[0]))
for i in ll:
    print(i[0])

Submission status: Wrong Answer

Solution code:
N = int(input())

ans = []
n = 0
for _ in range(N):
    tmp = input()


    for a in ans:
        if a[0] == tmp:
            a[1] = a[1] + 1
            if a[1] > n:
                n = a[1]
            continue
    
    ans.append([tmp, 1])

last = []
for a in ans:
    if a[1] == n:
        last.append(a[0])
last.sort()
for l in last:
    print(l)

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
s = []
for i in range(n):
    si = input()
    s.append(si)
    
s.sort()
counted = collections.Counter(s)

M = max(counted.values())
ms = [k for k, v in counted.items() if v == M]

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

Submission status: Wrong Answer

Solution code:
import collections
import itertools
s=int(input())
l=[input() for i in range(s)]
counter = collections.Counter(l)

mode_v = counter.most_common()[0][-1]
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, counter.most_common()
)
u=[]
for k, v in it:
  u.append(k)
u.sort
for i in range(len(u)):
  print(u[i])

Submission status: Wrong Answer

Solution code:
N=int(input())
S=[]
c=[]
for i in range(N):
  tmp=input()
  if not (tmp in S):
    S.append(tmp)
    c.append(1)
  else:
    c[S.index(tmp)]+=1
S.sort()
m=max(c)
for i in range(len(S)):
  if c[i]==m:
    print(S[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
S = [input() for _ in range(n)]
d = {}
m = 0
for s in S:
    if s in d:
        d[s] += 1
        m = max(m, d[s])
    else:
        d[s] = 1
        m = 1
sd = sorted(d.items(), key=lambda x: x[1], reverse=True)
ans = []
for k, v in sd:
    if v != m:
        break
    ans.append(k)
for a in sorted(ans):
    print(a)

Submission status: Wrong Answer

Solution code:
N = int(input())

dic = {}
for i in range(N):
    if i not in dic:
        dic[i] = 1
    else:
        dic[i] = dic[i]+1

l = dic.items()
max = 0
for i in l:
    if i[1] > max:
        max = i[1]

result = []
for i in l:
    if i[1] == max:
        result.append(i[0])

result.sort()

for i in result:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())

letter = []
num_letter = []
letter.append(input())
num_letter.append(1)
max_num_letter = 1

for i in range(1,N):
  S = input()
  flag = 0
  for j in range(len(letter)):
    if letter[j] == S:
      num_letter[j]+=1
      flag = 1
      break
  if flag == 0:
    letter.append(S)
    num_letter.append(1)

    max_num_letter = max(num_letter)
max_letter = []
for i in range(len(letter)):
  if num_letter[i] == max_num_letter:
    max_letter.append(letter[i])
max_letter = sorted(max_letter)
for i in range(len(max_letter)):
  print(max_letter[i])

Submission status: Wrong Answer

Solution code:
from collections import Counter
N=int(input()) #1行目のNを取得する
S=[input() for i in range(N)] #複数行の数値の入力を取得

most_common_list=Counter(S).most_common()

common_s=[]

for i in range(len(most_common_list)):
    if most_common_list[i][1]==most_common_list[0][1]:
        common_s.append(most_common_list[i][0])
    else:
        break

for s in reversed(common_s):
    print(s)

Submission status: Wrong Answer

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

set_list = set(S)
str_ls =[]
num_ls = []
flag = 0

for i in set_list:
    num_ls.append(S.count(i))
    str_ls.append(i)

for i in range(len(str_ls)):
    if num_ls[i] == max(num_ls):
        print(str_ls[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

info.sort()

ans = []
record = 1
tem_record = 1
for i in range(n-1):
    if info[i] == info[i+1]:
        tem_record += 1
        if tem_record == record:
            ans.append(info[i])
    else:
        if tem_record > record:
            record = tem_record
            ans = [info[i]]
        tem_record = 1

if record == 1 and  info[n-1] != info[n-2]:
    ans.append(info[n-1])


ans.sort()
for i in ans:
    print(i)

Submission status: Wrong Answer

Solution code:
a=input()
N=int(a)
wlist=[]
nlist=[]
num=1
max=0
now=0
for i in range(N):
    b=input()
    wlist.append(b)
wlist.sort()
print(wlist)
for i in range(N-1):
    if wlist[i]==wlist[i+1]:
        num+=1
    else:
        nlist.append(num)
        if num>max:max=num
        num=1
    print(i)
    if i==N-2:
        nlist.append(num)
print(nlist)
for i in range(len(nlist)):
    if nlist[i]==max:
        print(wlist[now])
    now+=nlist[i]

Submission status: Wrong Answer

Solution code:
import collections

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

#print(N,S)
c = collections.Counter(S)
#print(c.most_common())
max_count = c.most_common()[0][1]

T = []
for i in range(N):
    if len(c.most_common()) > 1:
        if c.most_common()[i][1] == max_count:
            T.append(c.most_common()[i][0])
        else:
            break
    else:
        break

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

Submission status: Wrong Answer

Solution code:
import collections as cl
n = int(input())
s = []
for i in range(n):
    s.append(input())
h = cl.Counter(s)
itm = h.items()

m = max(list(h.values()))
#mlist = [i[0] for i in itm if lambda x:x[1] == m]
mfil = list(filter(lambda x:x[1]==m ,itm))
sorted(mfil)

for j in mfil:
    print(j[0])

Submission status: Wrong Answer

Solution code:
n = int(input())

s_dic = dict()

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

# s_dic_sk = sorted(s_dic.items())
s_dic_s = sorted(s_dic.items(), key= lambda x:x[1], reverse=True)

# print(len(s_dic_s))

m_count = max(s_dic_s)[1]
# print(m_count)

for i in range(len(s_dic_s)):
  if s_dic_s[i][1] == m_count:
    print(s_dic_s[i][0])

Submission status: Wrong Answer

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

for i in b:
    print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
t = [0]*n
for i in range(n):
  t[i] = input()
t.sort()
m = 1
max = 1
st = []
for i in range(n-1):
  if ( t[i] == t[i+1]):
    m +=1
    if max == m:
      st.append(t[i])
    elif max < m:
      max = m
      st = []
      st.append(t[i])
  else:
    m = 1
    
for i in range(len(st)):
  print(st[i])

Submission status: Wrong Answer

Solution code:
print()

N = int(input())

dic = {}

for i in range(N):
	key = input()
	if key not in dic:
		dic[key] = 0
	else:
		dic[key] +=1

maxnum = max(dic.values())

keys = list(dic.keys())
for key in reversed(keys):
	if dic[key] == maxnum:
		print(key)

Submission status: Wrong Answer

Solution code:
N = int(input())

for_dict = {}
for _ in range(N):
    n = input()
    if n in for_dict:
        for_dict[n] += 1
    else:
        for_dict.setdefault(n, 1)

max_kv_list = [kv for kv in for_dict.items() if kv[1] == max(for_dict.values())]
print(max_kv_list)

slist = sorted(max_kv_list, key=lambda x: x[0])

for ele in slist:
    print(ele[0])

Submission status: Wrong Answer

Solution code:
N=int(input())

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

A.sort()

import collections
import itertools

counter = collections.Counter(A)

mode_v = counter.most_common()[0][-1]
it = itertools.takewhile(lambda kv: kv[-1] == mode_v, counter.most_common())

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

Submission status: Wrong Answer

Solution code:
import collections

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

c = collections.Counter(sorted(S_list))

for i in range(len(list(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())
dic = {}
maxim = 0
for i in range(n):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
        if dic[s] > maxim:
            maxim = dic[s]
        
dic2 = sorted(dic.items(), key=lambda x:x[1], reverse=True)
dic3 = sorted(dic2, key=lambda x:x[0])

for i in dic3:
    if i[1] == maxim:
        print(i[0])

Submission status: Wrong Answer

Solution code:
N = int(input().rstrip())
d = {}
for _ in range(N):
    string = input().rstrip()
    if string in d.keys():
        d[string] += 1
    else:
        d[string] = 1
d = sorted(d.items(), key=lambda x:x[1], reverse=True)
rets = []
max = -1
for string, val in d:
    if max == -1:
        max = val
    elif max != val:
        break
    rets.append(string)

for a in rets[::-1]:
    print(a)

Submission status: Wrong Answer

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

D = {}
for p in paper:
    if p not in D:
        D[p] = 1
    else:
        D[p] += 1

key = 0
max_value = 0
k = []
# 辞書の値を取り出す
for i in D:
    if D[i] > max_value:
        max_value = D[i]
        key = i
    elif D[i] == max_value:
        k.append(i)

if len(k) == 0:
    print(key)
else:
    k.append(key)
    for j in sorted(k):
        print(j)

Submission status: Wrong Answer

Solution code:
import collections

count = input()

l = []
for i in range(int(count)):
    l.append(input())
c = collections.Counter(l)
#print(l)
#print(c)
#print(c.most_common()[0][1])
max_count = c.most_common()[0][1]
for i in c.most_common():
    if i[1] != max_count:
        exit()
    print(i[0])

Submission status: Wrong Answer

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

d = dict()
m = 0

for i in range(N):
    if A[i] in d:
        d[A[i]] = d[A[i]] + 1
        if m < d[A[i]]:
            m = d[A[i]]
    else:
        d[A[i]] = 1

ans = []
keys = list(d.keys())

for i in range(len(keys)):
    if m == d[keys[i]]:
        ans.append(keys[i])

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