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

class abc_155:
    
    def __init__(self):
        pass
    
    def A(self):
       pass
    def B(self):
        pass
        
    def C(self):
        N=int(input())
        S=[input() for i in range(N)]
        c=collections.Counter(S).most_common()
        
        
        ans=[]
        ans.append(c[0][0])
        roop=c[0][1]
        
        for i in range(1,len(c)):
            if roop==c[i][1]:ans.append(c[i][0])
            else:roop=c[i][1]
            
        ans.sort()
        for i in ans:print(i)
                
      
    def D(self):
        pass
        
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_155()
    obj.C()

Submission status: Wrong Answer

Solution code:
import math
import collections

class abc_155:
    
    def __init__(self):
        pass
    
    def A(self):
       pass
    def B(self):
        pass
        
    def C(self):
        N=int(input())
        S=[input() for i in range(N)]
        c=collections.Counter(S).most_common()
        
        
        ans=[]
        ans.append(c[0][0])
        roop=c[0][1]
        
        for i in range(1,len(c)):
            if roop==c[i][1]:
                ans.append(c[i][0])
                break
            else:roop=c[i][1]
            
        ans.sort()
        for i in ans:print(i)
                
      
    def D(self):
        pass
        
    def E(self):
        pass
    
    def F(self):
        pass
    
    
if __name__=='__main__':
    obj=abc_155()
    obj.C()

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S = [input() for _ in range(N)]
S.sort()
c = collections.Counter(S)
a = [c.most_common()[0][0]]
i = 0
if len(c) != 1:
    while c.most_common()[i][1] == c.most_common()[i + 1][1]:
        a.append(c.most_common()[i + 1][0])
        i += 1
        if i == len(c) -1:
            break
for p in a:
    print(p)

Submission status: Wrong Answer

Solution code:
import sys


def main():
    readline = sys.stdin.readline
    N = int(readline())
    li = list(readline().split("\n"))
    se = set(li)
    l = len(se)
    li2 = [None] * l
    for i, s in enumerate(se):
        li2[i] = [s, li.count(s)]
    li2.sort(key=lambda x:x[1])
    maxcount = li2[l - 1][1]
    li3 = [j[0] for j in li2 if j[1] == maxcount]
    li3.sort()
    for k in li3:
        print(k)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N=int(input())
S = [input() for i in range(N)]
dict = {}
for s in sorted(S):
	dict[s]=S.count(s)
for s in dict:
	if dict[s]==max(dict.values()):
		print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
s = []
while True:
    try:
        s.append(input())
    except EOFError:
        break

word_counter = {}
for word in s:
    if word in word_counter:
        word_counter[word] += 1
    else:
        word_counter[word] = 0

results = sorted(word_counter.items(), key=lambda x: x[1], reverse=True)
max_v = results[0][1]

for r in results:
    if r[1] == max_v:
        print(r[0].strip('\n'))
    else:
        break

Submission status: Wrong Answer

Solution code:
n = int(input())
dic = {}
lis = []
lis2 = []

for i in range(n):
  moji = input()
  if moji not in dic:
    dic[moji] = 0
  dic[moji] += 1
  
for i in sorted(dic.items(), key=lambda x:x[1]):
    lis.append(i)
  
lis.reverse()

for j in lis:
  if lis[0][1] == j[1]:
    lis2.append(j[0])
  else:
    break
    
for i in range(len(lis2)):
  print(lis2[i])

Submission status: Wrong Answer

Solution code:
import collections
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
k=s.most_common()
p.append(s.most_common()[0][0])
for i in range(len(collections.Counter(s))-2):
    if k[i+1][1]==k[i+2][1]:
        p.append(k[i+2][0])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])

Submission status: Wrong Answer

Solution code:
import collections
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
k=s.most_common()
p.append(s.most_common()[0][0])
for i in range(len(collections.Counter(s))-2):
    if k[i+1][1]==k[i+2][1]:
        p.append(k[i+2][0])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])

Submission status: Wrong Answer

Solution code:
import collections
from collections import Counter
n=int(input())
s=[input() for i in range(n)]
s=Counter(s)
p=[]
p.append(s.most_common()[0][0])
for i in range(len(collections.Counter(s))-2):
    if s.most_common(i+1)[i][1]==s.most_common(i+2)[i+1][1]:
        p.append(s.most_common(i+2)[i+1][0])
    else:
        break
p=sorted(p)
for i in range(len(p)):
    print(p[i])

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [input() for i in range(N)]
B = list(set(A))
C = [0]*len(B)
for i in range(len(B)):
  C[i] = A.count(B[i])
D = max(C)
E = sorted([A[i] for i, x in enumerate(C) if x == D])
for i in range(len(E)):
  print(E[i])

Submission status: Wrong Answer

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

from collections import Counter

C = Counter(sorted(S))

numMax = C.most_common()[0][1]
for key, num in C.most_common():
    if num == numMax:
        print(key)

Submission status: Wrong Answer

Solution code:
n = int(input())
li = []
lia = []
ans = 0
f = 1
for i in range(n):
    li.append(input())
li.sort()
for i in range(n-1):
    if li[i] == li[i+1]:
        f += 1
        if f == ans:
            lia.append(li[i+1])
        if f > ans:
            lia = []
            ans = f
            lia.append(li[i+1])
    else:
        f = 1
for i in range(len(lia)):
    print(lia[i])

Submission status: Wrong Answer

Solution code:
n = int(input())
d = {}
for _ in range(n):
    s = input()
    d[s] = d.get(s, 0) + 1

sorted_d = sorted(d.items(), key=lambda x:x[1], reverse=True)
ma = sorted_d[0][1]

for i in range(len(sorted_d)-1, -1, -1):
    if sorted_d[i][1] == ma:
        print(sorted_d[i][0])

Submission status: Wrong Answer

Solution code:
dict_n = {}
N = int(input())
for i in range(N):
  a = str(input())
  b = dict_n.get(a)
  if b is None:
    dict_n[a] = 1
  else:
    dict_n[a] = b + 1
list_n = [kv[0] for kv in dict_n.items() if kv[1] == max(dict_n.values())]
for i in list_n:
  print(i)

Submission status: Wrong Answer

Solution code:
dict_n = {}
N = int(input())
for i in range(N):
  a = str(input())
  b = dict_n.get(a)
  if b is None:
    dict_n[a] = 1
  else:
    dict_n[a] = b + 1
list_n = [kv[0] for kv in dict_n.items() if kv[1] == max(dict_n.values())]
print(' '.join(list_n))

Submission status: Wrong Answer

Solution code:
dict_n = {}
N = int(input())
for i in range(N):
  a = str(input())
  b = dict_n.get(a)
  if b is None:
    dict_n[a] = 1
  else:
    dict_n[a] = b + 1
print(max(dict_n, key=dict_n.get))

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = []
ans = []

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

c = Counter(s)
c_s = c.most_common()
m = c.most_common()[0][1]
print(c_s)
print(m)

for j in range(len(c_s)):
    if c_s[j][1] != m:
        break
    else:
        ans.append(c_s[j][0])

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
c = Counter(s)
d = c.most_common()
cntmax = d[0][1]
l = [i[0] for i in c.items() if i[1] >= cntmax]
for i in range(len(l)):
    print(l[i])

Submission status: Wrong Answer

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

from collections import Counter
c = Counter(s).most_common()
print(c[0][0])
for i in range(1,len(c)):
    if c[i][1]==c[0][1]:
        print(c[i][0])

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

c = collections.Counter(sorted(S))
keys = [k for k, v in c.items() if v == c.most_common()[0][1]]
print(*keys)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

counter = Counter(s)
count = counter.most_common()
most = count[0][1]

c = []
for i in range(len(count)):
    print(count[i][1])
    if most == count[i][1]:
        c.append(count[i][0])

c.sort()
print(*c, sep='\n')

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

counter = Counter(s)
count = counter.most_common()
print(counter, count)
most = count[0][1]

c = []
for i in range(len(count)):
    print(count[i][1])
    if most == count[i][1]:
        c.append(count[i][0])

c.sort()
print(*c, sep='\n')

Submission status: Wrong Answer

Solution code:
import math
import queue
from collections import defaultdict

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):#階乗
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):#コンビネーション
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=qb
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
def dq():
	return queue.deque()
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): # root
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): # much time
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} # 1~n
def bitArr(n):#ビット全探索
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): #j:aの個数
			k = i-a*j
			if k%b==0:
				return i
	return -1


n = readInt()
d = defaultdict(int)
for i in range(n):
	d[readChar()]+=1

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



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

Submission status: Wrong Answer

Solution code:
#155c
import collections
n = int(input())
s = [input() for _ in range(n)]

c = collections.Counter(s)
ret = []
tmp = []
current_v = 0

for k, v in c.most_common():
  if current_v != v:
    current_v = v
    if tmp != []:
      ret.extend(sorted(tmp))
      break
  tmp.append(k)

for r in ret:
  print(r)

Submission status: Wrong Answer

Solution code:
#155c
import collections
n = int(input())
s = [input() for _ in range(n)]

c = collections.Counter(s)
ret = []
tmp = []
current_v = 0

for k, v in c.most_common():
  if current_v != v:
    current_v = v
    if tmp != []:
      ret.extend(sorted(tmp))
      break
  tmp.append(k)

print(ret)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = [input() for i in range(N)]
S_dict = {}
for i in range(N):
    if S[i] not in S_dict:
        S_dict[S[i]] = 1
    else:
        S_dict[S[i]] += 1
        
max_pol = S_dict[max(S_dict)]
ans_list = []
for key, pol in S_dict.items():
    if pol == max_pol:
        ans_list.append(key)
        
for ans in sorted(ans_list):
    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
l = [input() for _ in range(N)]
m = set(l)
d = dict()

for name in m:
  d[name] = l.count(name)
  
  
max_kv_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
for name in max_kv_list:
  print(name)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = [input() for _ in range(N)]
dic = {}

for i in range(N):
  dic[A[i]] = 0
  
for i in range(N):
  dic[A[i]] += 1

k = dic[max(dic)]
dic = sorted(dic.items(), key=lambda x:x[0])
for el in dic:
  if el[1] == k:
    print(el[0])

Submission status: Wrong Answer

Solution code:
import sys
from collections import Counter
input = sys.stdin.readline

N = int(input())
S = [input().strip('\n') for _ in range(N)]
c = Counter(S)
c = sorted(c.items(), key=lambda x:x[1])

mx = c[-1][1]
ans = []
for k, v in c[::-1]:
  if mx == v:
    ans += [k]

for k in ans:
  print(k)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
c = Counter(S)
c = sorted(c.items(), key=lambda x:x[1])

mx = c[-1][1]
for k, v in c[::-1]:
  if mx == v:
    print(k)

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S_list = [None]*N
for i in range(N):
    S_list[i] = input()

sorted_S_list = sorted(S_list)
dict_S = dict(collections.Counter(sorted_S_list))
max_count = max(dict_S.values())

for k, v in dict_S.items():
    if v == max_count:
        print(k)

Submission status: Wrong Answer

Solution code:
import collections

N = int(input())
S_list = [None]*N
for i in range(N):
    S_list[i] = input()

sorted_S_list = sorted(S_list)
dict_S = collections.Counter(sorted_S_list)
max_count = max(dict_S.values())

for k, v in dict_S.items():
    if v == max_count:
        print(k)

Submission status: Wrong Answer

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

from collections import Counter as C

a=C(S).most_common()
b=[]
for i in a:
    b.append(i[0])
c=sorted(b)
for i in c:
    print(i)

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
s = [input() for i in range(n)]
ans = collections.Counter(s)
ans = [j[0] for j in ans.items() if j[1] == max(ans.values())]
print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
l = []

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

l.sort()

c = collections.Counter(l)

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

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

Submission status: Wrong Answer

Solution code:
n=int(input())
list_s=[]
for i in range(n):
  s=input()
  list_s.append(s)
list_cnt=[]  
list_t=list(set(sorted(list_s)))  
for i in list_t:
  cnt=list_s.count(i)
  list_cnt.append(cnt)
  
for i in range(len(list_cnt)):
  if list_cnt[i]==max(list_cnt):
    print(list_t[i])

Submission status: Wrong Answer

Solution code:
import collections
n = int(raw_input())
cc = collections.Counter()
m = 0
for _ in range(n):
	w=  raw_input()
	cc[w] +=1
	m = max(0,cc[w])
elems = []
for el in cc:
	if cc[el] == m:
		elems.append(el)


#elems.sort(cmp = lambda a,b: len(a)<=len(b))
elems.sort()
for el in elems:print el

Submission status: Wrong Answer

Solution code:
import collections
n = int(raw_input())
cc = collections.Counter()
m = 0
for _ in range(n):
	w=  raw_input()
	cc[w] +=1
	m = max(0,cc[w])
elems = [el for el in cc if cc[el] == m]
elems.sort()
for el in elems:print el

Submission status: Wrong Answer

Solution code:
import collections
n= int(raw_input())
cc = collections.Counter()
m = 0
for _ in range(n):
	w=  raw_input()
	cc[w]+=1
	m = max(0,cc[w])
elems = [el for el in cc if cc[el] == m]
elems.sort()
for el in elems:
	print el

Submission status: Wrong Answer

Solution code:

import sys
from collections import Counter
readline = sys.stdin.buffer.readline # 一行読み込み

n=int(input())
s=["".join(readline().rstrip().decode()) for _ in range(n)]
print(s)

counter = Counter(s)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')

Submission status: Wrong Answer

Solution code:
from collections import Counter

n=int(input())
s=list(input(i) for i in range(n))

counter = Counter(s)
max_cnt = max(counter.values())
names = [name for name, cnt in counter.items() if cnt == max_cnt]
names.sort()

print(*names, sep='\n')

Submission status: Wrong Answer

Solution code:

n=int(input())
s=list(input(i) for i in range(n))

# print(s)
import collections
c = collections.Counter(s)
c_srt=c.most_common()
# print(c_srt)

moji=[i[0] for i in c.items() if i[1]==c.most_common()[0][1]]
moji_srt=sorted(moji)
L="\n".join(moji_srt)
print(L)

Submission status: Wrong Answer

Solution code:

n=int(input())
s=list(input(i) for i in range(n))

# print(s)
import collections
c = collections.Counter(s)

max_num=max(list(c.values()))
for i in range(len(c)):
    if c.most_common()[i][1]==max_num:
        print(c.most_common()[i][0])

    else:
        continue

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
s=[]
for _ in range(n):
    s.append(str(input()))
ans=collections.Counter(s)
values,count=zip(*ans.items())
for l in range(len(count)):
    if max(count)==count[l]:
        print(values[l])

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
s=[]
for _ in range(n):
    s.append(str(input()))
ans=collections.Counter(s)
values,count=zip(*ans.most_common())
for l in range(len(count)):
    if max(count)==count[l]:
        print(values[l])

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
S = []
for _ in range(n):
    s = input()
    S.append(s)
cnt = Counter(S)
l = max(cnt.values())

ans = []
for k,v in cnt.items():
  if v == l:
    ans.append(k)
print(ans)
ans.sort()
for i in ans:
  print(i)

Submission status: Wrong Answer

Solution code:
n = int(input())
L = sorted(input() for _ in range(n))
s = list(set(L))
c = [0] * len(s)
for i in range(len(s)):
    c[i] = L.count(s[i])
m = max(c)
for j in range(len(c)):
    if c[j] == m:
        print(s[j])

Submission status: Wrong Answer

Solution code:
n = int(input())
L = sorted(input() for _ in range(n))
s = list(set(L))
c = [0] * len(s)
m = 0
for i in range(len(s)):
    c[i] = L.count(s[i])
    m = max(m, c[i])
for j in range(len(c)):
    if c[j] == m:
        print(s[j])

Submission status: Wrong Answer

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

c = Counter(s)
ma = max(c.values())
for k,v in c.items():
  if ma == v:
    print(k)

Submission status: Wrong Answer

Solution code:
n = int(input())

d = {}

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

m = max(d[i] for i in d)
print(m, d)

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

Submission status: Wrong Answer

Solution code:
N=int(input())
cnt = {}
for _ in range(N):
  s = input()
  if s not in cnt:cnt[s]=0
  cnt[s]+=1
max_val = max([cnt[v] for v in cnt])
l = [v for v in cnt if cnt[v]==max_val]
sorted(l)
print('\n'.join(l))

Submission status: Wrong Answer

Solution code:
N=int(input())
cnt = {}
for _ in range(N):
  s = input()
  if s not in cnt:cnt[s]=0
  cnt[s]+=1
max_val = max([cnt[v] for v in cnt])
l = [v for v in cnt if cnt[v]==max_val]
print('\n'.join(l))

Submission status: Wrong Answer

Solution code:
count = int(input())

ls = []

for i in range(count):
    ls.append(input())

max = 0
ans = []
ls = sorted(ls)

for s in set(ls):
    i = ls.count(s)
    if i > max:
        ans = []
        ans.append(s)
        max = i
    elif i == max:
        ans.append(s)

print('\n'.join(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cnt=Counter(name)
l=max(cnt.values())
ans=[s for s,c in cnt.items() if c==1]
ans.sort()
print('\n'.join(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())

words = {}

for i in range(n):
    key = input()
    if key not in words:
        words[key] = 0
    words[key] += 1
print(words)

Submission status: Wrong Answer

Solution code:
from collections import *
_,*a=map(lambda x:x.rstrip(), open(0))
a=Counter(a).most_common()
a=[i[0] for i in a if i[1]==a[0][1]]
print(*a,sep="\n")

Submission status: Wrong Answer

Solution code:
import sys,collections
s=collections.Counter(map(lambda x: x.rstrip(),sys.stdin.readlines()[1:])).most_common()
print(*[i[0] for i in s if i[1]==s[0][1]],sep="\n")

Submission status: Wrong Answer

Solution code:
from sys import stdin, setrecursionlimit


def main():
    n = int(stdin.readline())
    s = [stdin.readline()[:-1] for _ in range(n)]
    s.sort()
    s_set = set(s)
    summary = {}

    for key in s_set:
        summary[key] = 0

    m = 0
    for si in s:
        summary[si] += 1
        m = max(summary[si], m)

    for key in s_set:
        if summary[key] == m:
            print(key)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Wrong Answer

Solution code:
n=int(input())
s=[input() for x in range(n)]
l=list(set(s))
l.sort()
cnt=[0]*len(l)
for ss in s:
  cnt[l.index(ss)]+=1
m=max(cnt)
ans=[]
for cc in cnt:
  if cc==m:
    ans.append(cnt.index(cc))
for aa in ans:
  print(l[aa])

Submission status: Wrong Answer

Solution code:
n=int(input())
s=[input() for x in range(n)]
l=list(set(s))
l.sort()
cnt=[0]*len(l)
for ss in s:
  cnt[l.index(ss)]+=1
m=max(cnt)
ans=[]
for cc in cnt:
  if cc==m:
    ans.append(cnt.index(cc))
for aa in ans:
  print(l[aa])
print(ans)
print(cnt)
print(l)

Submission status: Wrong Answer

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

set_s = set(s)
cnt_s = collections.Counter(s)
m=0
for i in set_s:
    m = max(m,cnt_s[i])
    
for i in set_s:
    if cnt_s[i]==m:
        print(i)

Submission status: Wrong Answer

Solution code:
n=int(input())
s=[input() for x in range(n)]
l=list(set(s))
cnt=[0]*len(l)
for ss in l:
  for sss in s:
    if sss==ss:
      cnt[l.index(ss)]+=1
m=max(cnt)
ans=[]
for cc in cnt:
  if cc==m:
    ans.append(cnt.index(cc))
for aa in ans:
  print(l[aa])

Submission status: Wrong Answer

Solution code:
n = int(input())
d = dict()
s = [input() for i in range(n)]
l = []
for i in set(s):
    d[i] = 0
for i in s:
    d[i] += 1
print(d.items())
l = [k for k, v in d.items() if v == max(d.values())]
l.sort()
print(*l, sep="\n")

Submission status: Wrong Answer

Solution code:
# C - Poll

N = int(input())
D = {}
for _ in range(N):
    s = str(input())
    if s not in D:
        D[s] = 0
    D[s] += 1

ans = []
mx = D[max(D)]
for d in D:
    if D[d] == mx:
        ans.append(d)

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

Submission status: Wrong Answer

Solution code:
# C - Poll

N = int(input())
D = {}
for _ in range(N):
    s = str(input())
    if s not in D:
        D[s] = 1
    else:
        D[s] += 1

ans = []
mx = D[max(D)]
for d in D:
    if D[d] == mx:
        ans.append(d)

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

Submission status: Wrong Answer

Solution code:
# C - Poll

N = int(input())
D = {}
for _ in range(N):
    s = input()
    if s not in D:
        D[s] = 1
    else:
        D[s] += 1

ans = []
mx = D[max(D)]
for d in D:
    if D[d] == mx:
        ans.append(d)

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

Submission status: Wrong Answer

Solution code:
# C - Poll

N = int(input())
D = {}
for _ in range(N):
    s = input()
    if s not in D:
        D[s] = 1
    else:
        D[s] += 1

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
s = [input() for _ in range(n)]
word = collections.Counter(s)
word = word.most_common()
max_num = word[0][1]
word.sort()
for i in range(len(word)):
    if word[i][1] == max_num:
        print(word[i][0])
    else:
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

n = int(input())
dict1 = defaultdict(int)

for i in range(n):
    s = str(input())
    dict1[s] += 1
dict1 = dict(sorted(dict1.items()))
dict1 = sorted(dict1.items(), key=lambda x:x[1], reverse=True)
max = dict1[0][1]

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict

n = int(input())
dict = defaultdict(int)

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

ans_list = [k for k,v in dict.items() if v == max(dict.values())]

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
lst = [(input()) for _ in range(n)]
lst.sort()
c = Counter(lst)
d = c.most_common(1)
e = d[0]
i,j = e
for a in c.keys():
  if c[a] == j:
    print(a)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
lst = [(input()) for _ in range(n)]
lst.sort()
c = Counter(lst)
d = c.most_common(1)
e = d[0]
i,j = e
for a in c.keys():
    if c[a] == j:
        print(a)

Submission status: Wrong Answer

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

s = collections.Counter(s).most_common()
mx = s[0][1]

for k, v in s:
    if mx == v:
        print(k)

Submission status: Wrong Answer

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

s = collections.Counter(s)

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

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

Submission status: Wrong Answer

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

s = collections.Counter(s)

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

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

Submission status: Wrong Answer

Solution code:
from collections import *
n,*s=map(str,open(0).read().split())
s=Counter(s).most_common()
for a,i in s:
  if i==s[0][1]:
    print(a)
  else:
    break

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
lst = [(input()) for _ in range(n)]
lst.sort()
c = Counter(lst)
d = c.most_common()
for i,j in d:
    print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input() for i in range(N))  #スペース抜きの単語を複数行
S = sorted(S)

import collections
A = collections.Counter(S)

B = max(A.values())
for i in A.keys():
    if A[i] == B:
        print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input() for i in range(N))  #スペース抜きの単語を複数行

S = sorted(S)

A = {}
for i in S:
    A.setdefault(i, 1)
    A[i] += 1

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

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input() for i in range(N))  #スペース抜きの単語を複数行
S = sorted(S)

import collections
A = collections.Counter(S)

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

Submission status: Wrong Answer

Solution code:
N = int(input())
S = list(input() for i in range(N))  #スペース抜きの単語を複数行
S = sorted(S)

import collections
A = collections.Counter(S)

max_k_list = [kv[0] for kv in A.items() if kv[1] == max(A.values())]
print(max_k_list)

Submission status: Wrong Answer

Solution code:
n = int(input())

words = {}

for i in range(n):
    key = input()
    if key not in words:
        words[key] = 0
    words[key] += 1

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

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

Submission status: Wrong Answer

Solution code:
n = int(input())

words = {}

for i in range(n):
    key = input()
    if key not in words:
        words[key] = 0
    words[key] += 1

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

for i in ans:
    if ans[0][1] == i[1]:
        print(i[0])
    else:
        break

Submission status: Wrong Answer

Solution code:
n = int(input())

words = {}

for i in range(n):
    key = input()
    if key not in words:
        words[key] = 0
    words[key] += 1

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

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