TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
n=int(input())
s1 = []
for i in range(n):
    s1.append(input())
s2=list(set(sorted(s1)))
N=[]
for i in range (len(s2)):
  ni=s1.count(s2[i])
  N.append(ni)
nm=max(N)
for i in range (len(s2)):
  if N[i]==nm:
    print(s2[i])

import collections as c
 
n = int(input())
alist = [input() for i in range(n)]
 
clist = c.Counter(alist)
anlist = clist.most_common()
anslist = []
for i in range(0,len(anlist)):
    if anlist[0][1] == anlist[i][1]:
        anslist.append(anlist[i][0])
anslistt = sorted(anslist)
 
for i in (anslistt):
    print(i)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
dic = {}
for i in range(N):
  s = str(input())
  if not s in dic:
    dic[s] = 1
  else:
    dic[s] += 1
max_k_list = [kv[0] for kv in dic.items() if kv[1] == max(dic.values())]
for i in max_k_list:
  print(i)

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)

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]
mak_k_list = sorted(max_k_list)
for i in max_k_list:
  print(i)

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]
max_k_list = sorted(max_k_list)
for i in max_k_list:
  print(i)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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()))

mfil = list(filter(lambda x:x[1]==m ,itm))
sorted(mfil)

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

import collections as cl
from operator import itemgetter, attrgetter
n = int(input())
s = []
for i in range(n):
    s.append(input())
h = cl.Counter(s)
itm = h.items()

m = max(list(h.values()))

mfil = list(filter(lambda x:x[1]==m ,itm))
mfil = sorted(mfil,key=itemgetter(0))
for j in mfil:
    print(j[0])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# coding: utf-8


def main():
    n = int(input())
    polls_dict = {}
    for _ in range(n):
        poll = input()
        if poll not in polls_dict:
            polls_dict[poll] = 1
        else:
            polls_dict[poll] += 1

    max_poll = max(polls_dict.values())
    
    polls_dict = sorted(polls_dict)

    for key, value in polls_dict.items():
        if value == max_poll:
            print(key)
        else:
            pass

    #for poll in polls_set:
    #    print(poll)
    
    return 0


if __name__ == '__main__':
    main()


# coding: utf-8
from collections import Counter


def main():
    n = int(input())
    polls_list = []
    for _ in range(n):
        polls_list.append(input())
    polls_dict = Counter(polls_list)
    max_poll = max(polls_dict.values())

    polls_set = set()
    for key, value in polls_dict.items():
        if value == max_poll:
            polls_set.add(key)

    polls_set = sorted(polls_set)
    for poll in polls_set:
        print(poll)

    return 0


if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):

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

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


import sys
from collections import Counter
readline = sys.stdin.buffer.readline 

n=int(input())
s=["".join(readline().rstrip()) 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')


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

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


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)

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

#!/usr/bin/env python3
import sys
from collections import Counter
readline = sys.stdin.buffer.readline 

n=int(input())
s=["".join(readline().rstrip()) 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')


from collections import Counter

n=int(input())
s=list(input(i).split() 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')

n=int(input())
arr=[input() for _ in range(n)]
dic={}

for i in range(n): 
    if arr[i] not in dic:
        dic[arr[i]]=1
    else:
        dic[arr[i]]+=1

largest=max(dic.values()) 
ans=[]

for keys in dic.keys():
    if dic[keys]==largest: 
        ans.append(keys)

ans=sorted(ans) 
for words in ans:
    print(words)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
dict={}
for i in range(n):
    s=input()
    if s in dict_keys:
        dict[s]=1
    else:
        dict[s]+=1
items_sorted = sorted(dict.items(), key = lambda x : x[1])
value=items_sorted[0][0]
i=0
while(1):
    if items_sorted[i][0]==value:
        print(items_sorted[i][1])
    else:
        break

import collections

N = int(input())
l = []
 
for _ in range(N):
    s = str(input())
    l.append(s)

c = collections.Counter(l)
c = c.most_common()
 
most_count = c[0][1]
c.sort()
 
for i in range(len(c)):
    if c[i][1] == most_count:
        print(c[i][0])

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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))

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

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(sorted(ans)))

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n= int(input())
s= [input() for i in range(n)]
p1=list(set(s))
N=len(p1)
c=[0]*N
for i in range(N):
	c[i]=s.count(p1[i])
m =max(c)
c1=c.count(m)
ans=[0]
for i in range(N):
	if c[i]==m:
		ans.append(p1[i])
ans1=sorted(ans)
for i in range(c1):
	print(ans1[i])

n= int(input())
s= [input() for i in range(n)]
p=set(s)
p1=list(p)
N=len(s)
c=[0]*N
for i in range(N):
	c[i]=s.count(p1[i])
m =max(c)
c1=c.count(m)
ans =[]
for i in range(N):
	if c[i]==m:
		ans.append(p1[i])
ans1 = sorted(ans)
for i in range(c1):
	print(ans1[i])

n= int(input())
s= sorted([input() for i in range(n)])
s.append("END")
ans=[]
max=-1
past=s[0]
c=1
for i in range(1,n+1):
	if past==s[i]:
		c+=1
	else:
		if c>max:
			max=c
			ans=[]
			ans.append(s[i-1])
		elif c==max:
			ans.append(s[i-1])
		c=1
	past=s[i]
for i in range(len(ans)):
	print(ans[i])

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys

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

#sort by value
counter_sorted = sorted(counter.items(), key=lambda x:x[1], reverse = True)

print
print(counter_sorted)
print

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

#sort by key
output = sorted(output)
for i in output:
    print(i)

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)

import sys

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

#sort by value
counter_sorted = sorted(counter.items(), key=lambda x:x[1], 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

#sort by key
output = sorted(output)
for i in output:
    print(i)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from collections import Counter
N = int(input())
S = [int(input()) for i in range(N)]

count = Counter(S)
maxnum = max(count.values())
maxlist= [i for i,j in count.items() if j==maxnum]

maxlist.sort()
print("/n".join(maxlist))

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

count = Counter(S)
maxnum = max(count.values())
maxlist= [i for i,j in count.items() if j==maxnum]

maxlist.sort()
print("/n".join(maxlist))

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

count = Counter(S)
maxnum = max(count.values())
maxlist= [i for i,j in count.items() if j==maxnum]

maxlist.sort()

for m in maxlist:
	print(m)

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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])


from collections import Counter
N=int(input())
ll=[input() for i in range(N)]
ll=Counter(ll)
ll=ll.most_common()
for i in ll:
    print(i[0])

from collections import Counter
N=int(input())
ll=[input() for i in range(N)]
ll=Counter(ll)
ll=ll.most_common()
ll=sorted(ll,key=lambda x:(x[1]),reverse=True)
ans=[l for l in ll if l[1]==ll[0][1] ]
ans=sorted(ans,key=lambda x:(x[0]),reverse=False)
for i in ans:
    print(i[0])


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def main():
    n = int(input())
    ss = {}
    max_s = -1
    for _ in range(n):
        s = input()
        if s not in ss:
            ss[s] = 0
        else:
            ss[s] += 1
            max_s = max(max_s, ss[s])

    anss = [s for s in ss if ss[s] == max_s]
    for ans in anss:
        print(ans)


if __name__ == "__main__":
    main()


def main():
    n = int(input())
    ss = {}
    max_s = 0
    for _ in range(n):
        s = input()
        if s not in ss:
            ss[s] = 0
        else:
            ss[s] += 1
            max_s = max(max_s, ss[s])

    ss = sorted(ss.items(), key=lambda x: x[0])
    anss = [s for s, i in ss if i == max_s]
    for ans in anss:
        print(ans)


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import itertools
from collections import Counter

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

a = sorted(a)
#print(a)


counter = Counter(a)

mode_v = counter.most_common()[0][-1]

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



for k, v in it:
	print(k)

import itertools
from collections import Counter

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

a = sorted(a)
#print(a)


counter = Counter(a)

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


f=list(it)
#print(f)
f = sorted(f)
#print(f)
for k in range(len(f)):
	print(f[k][0])

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import collections
def resolve_c():
    n = input()
    s_l = [input() for i in range(int(n))]
    c = collections.Counter(s_l)
    for k, v in c.items():
        if v == c.most_common()[0][1]:
            results.append(v)
        else:
            break
    results = sorted(results)
    for r in results:
        print(r)
resolve_c()

import collections
def resolve_c():
    n = input()
    s_l = [input() for i in range(int(n))]
    c = collections.Counter(s_l)
    values, counts = zip(*c.most_common())
    results = sorted(list(values[:collections.Counter(counts)[max(counts)]]))
    fin = [print(r) for r in results]
resolve_c()

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
dic = {}
for i in range(n):
  elem = input()
  if not elem in dic:
    dic[elem] = 1
  else:
    dic[elem] += 1
max_ = max(dic.values())

res = []
for k, v in dic.items():
  if v == max_:
    res.append(v)

res = sorted(res)
for elem in res:
  print(res)

n = int(input())
dic = {}
for i in range(n):
  elem = input()
  if not elem in dic:
    dic[elem] = 1
  else:
    dic[elem] += 1
max_ = max(dic.values())

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


n = int(input())
dic = {}
for i in range(n):
  elem = input()
  if not elem in dic:
    dic[elem] = 1
  else:
    dic[elem] += 1
max_ = max(dic.values())

res = []
for k, v in dic.items():
  if v == max_:
    res.append(k)

res = sorted(res)
for elem in res:
  print(elem)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)
    

from collections import Counter
n = int(input())
lst = [(input()) for _ in range(n)]
c = Counter(lst)
d = c.most_common()
e = d[0][1]
lst_new = []
for f in c.keys():
    if c[f] == e:
        lst_new.append(f)
lst_new.sort()
for g in lst_new:
    print(g)        
        

    
    

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
a=[str(input()) for i in range(n)]
b=set(a)
b=[[i,0]for i in b]
lenb=range(len(b))
for i in lenb:
  for j in a:
    if j==b[i][0]:
      b[i][1]+=1
maxb=max(b,key=lambda x:x[1])
maxb=maxb[1]
b=sorted(b,key=lambda x:x[0])
print(b)
for i in lenb:
  if b[i][1]==maxb:
    print(b[i][0])

n=int(input())
a=[str(input()) for i in range(n)]
b=set(a)
b=[[i,0]for i in b]
lenb=range(len(b))
for i in lenb:
  for j in a:
    if j==b[i][0]:
      b[i][1]+=1
maxb=max(b,key=lambda x:x[1])
maxb=maxb[1]
b=sorted(b,key=lambda x:x[1],reverse=True)
print(maxb)
for i in lenb:
  if b[i][1]==maxb:
    print(b[i][0])

n=int(input())
a=[str(input()) for i in range(n)]
b=list(set(a))
c=[[b[i-1],0]for i in range(len(b))]
for i in range(len(c)):
  for j in a:
    if j==c[i-1][0]:
      c[i-1][1]+=1
d=sorted(c,key=lambda x:x[1],reverse=True)
for i in range(len(c)):
  if c[i-1][1]==c[0][1]:
    print(c[i-1][0])

n=int(input())
a=[str(input()) for i in range(n)]
b=list(set(a))
c=[[b[i],0]for i in range(len(b))]
for i in range(len(c)):
  for j in a:
    if j==c[i][0]:
      c[i][1]+=1
d=sorted(c,key=lambda x:x[1],reverse=True)
e=[]
for i in range(len(d)):
  if d[i][1]==d[0][1]:
    e.append(c[i][0])
  else:
    break
for i in sorted(e):
  print(i)


n=int(input())
a=[str(input()) for i in range(n)]
b=list(set(a))
c=[[b[i-1],0]for i in range(len(b))]
for i in range(len(c)):
  for j in a:
    if j==c[i-1][0]:
      c[i-1][1]+=1
d=sorted(c,key=lambda x:x[1],reverse=True)
e=[]
for i in range(len(c)):
  if c[i-1][1]==c[0][1]:
    e.append(c[i-1][0])
for i in sorted(e):
  print(i)


n=int(input())
a=[str(input()) for i in range(n)]
b=list(set(a))
c=[[b[i],0]for i in range(len(b))]
for i in range(len(c)):
  for j in a:
    if j==c[i][0]:
      c[i][1]+=1
d=sorted(c,key=lambda x:x[1],reverse=True)
e=[]
for i in range(len(c)):
  if c[i][1]==c[0][1]:
    e.append(c[i][0])
  else:
    break
for i in sorted(e):
  print(i)

n=int(input())
a=[str(input()) for i in range(n)]
b=set(a)
b=[[i,0]for i in b]
lenb=range(len(b))
for i in lenb:
  for j in a:
    if j==b[i][0]:
      b[i][1]+=1
maxb=max(b,key=lambda x:x[1])
maxb=maxb[1]
b=sorted(b,key=lambda x:x[1],reverse=True)
for i in lenb:
  if b[i][1]==maxb:
    print(b[i][0])

n=int(input())
a=set([str(input()) for i in range(n)])
print(sorted(a))

n=int(input())
a=[str(input()) for i in range(n)]
b=list(set(a))
c=[[b[i-1],0]for i in range(len(b))]
for i in range(len(c)):
  for j in a:
    if j==c[i-1][0]:
      c[i-1][1]+=1
d=sorted(c,key=lambda x:x[1],reverse=True)
print(d)
for i in range(len(c)):
  if c[i-1][1]==c[0][1]:
    print(c[i-1][0])

n=int(input())
a=[str(input()) for i in range(n)]
b={}
for i in a:
  if i in b:
    b[i]+=1
  else:
    b[i]=0
maxb=max(b.values())
b=sorted(b.items(),key=lambda x:x[0])
for i,j in b:
  if maxb==j:
    print(i)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
words = {}

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

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

mx_words.sort()

for mx_word in mx_words :
    print(mx_word)

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

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

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

mx_words.sort()

for mx_word in mx_words :
    print(mx_word)

Verdicts: Runtime Error

Accepted
Problem: 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.

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

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from collections import Counter
N = int(input())
L = [str(input()) for _ in range(N)]
c = Counter(L)
for i, x in enumerate(c.most_common()):
  if i>0 and x[1]!=m:
    break
  print(x[0])
  m = x[1]

from collections import Counter
N = int(input())
L = [str(input()) for _ in range(N)]
c = Counter(L)
ans = []
for i, x in enumerate(c.most_common()):
  if i>0 and x[1]!=m:
    break
  ans.append(x[0])
  m = x[1]
for x in sorted(ans):
  print(x)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)
#print('strs', strs)
c = collections.Counter(strs)
maxv = -1
ans = []
for k , v in c.most_common():
  if v != maxv and maxv != -1:
    break
  ans.append(k)
  maxv = v
for a in sorted(ans, reverse=True):
  print(a)

import sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)
#print('strs', strs)
c = collections.Counter(strs)
maxv = -1
for k , v in c.most_common():
  if v != maxv and maxv != -1:
    break
  print(k)
  maxv = v

import sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)
#print('strs', strs)
c = collections.Counter(strs)
print('\n'.join([ k for k , v in c.most_common()]))

import sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)
#print('strs', strs)
c = collections.Counter(strs)
maxv = -1
ans = []
for k , v in c.most_common():
  if v != maxv and maxv != -1:
    break
  ans.append(k)
  maxv = v
for a in sorted(ans):
  print(a)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def main():
    d = {}
    N = int(input())
    for i in range(N):
        s = input()
        d.setdefault(s, 1)
        d[s] += 1
    
    d = sorted(d.items())
    d = sorted(d, key=lambda x:x[1], reverse=True)
    for i in range(N):
        print(d[i][0])

if __name__ == '__main__':
    main()


def main():
    d = {}
    N = int(input())
    for i in range(N):
        s = input()
        d.setdefault(s, 1)
        d[s] += 1
    
    d = sorted(d.items())
    d = sorted(d, key=lambda x:x[1], reverse=True)
    n = d[0][1]
    for i in range(len(d)):
        if d[i][1] != n:
            break
        print(d[i][0])

if __name__ == '__main__':
    main()


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
s = [input() for _ in range(n)]
import collections
c = collections.Counter(s)
d = c.most_common()
e = [d[0][0]]
for i in range(len(d)-1): 
   if d[0][1] == d[i+1][1]:
      e.append(d[i+1][0])       
e.sort()
print(repr(e))   

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

n = int(input())
s = [input() for _ in range(n)]
import collections
c = collections.Counter(s)
d = c.most_common()
e = [d[0][0]]
for i in range(len(d)-1): 
   if d[0][1] == d[i+1][1]:
      e.append(d[i+1][0])       
e.sort()
print('\n'.join(e))   

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
s = [input() for _ in range(n)]

from collections import Counter

c = Counter(s)
m = max(c.values())
ans = []
for k,v in c.items():
    if v == m:
        ans.append(k)
for i in ans:
    print(i)

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

from collections import Counter

c = Counter(s)
m = max(c.values())
ans = []
for k,v in c.items():
    if v == m:
        ans.append(k)
ans.sort()
for i in ans:
    print(i)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
s = {}
for i in range(n):
    tmp = input()
    if not tmp in s.keys():
        s[tmp] = 1
    else:
        s[tmp] += 1
m = 0
l = []
for i in sorted(s.items(), key=lambda x:x[1], reverse=True):
    if m < i[1]:
        m = i[1]
        l.append(i[0])
    else:
        break

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

n = int(input())
s = {}
for i in range(n):
    tmp = input()
    if not tmp in s.keys():
        s[tmp] = 1
    else:
        s[tmp] += 1
m = 0
l = []
for i in sorted(s.items(), key=lambda x:x[1], reverse=True):
    if m <= i[1]:
        m = i[1]
        l.append(i[0])
    else:
        break
 
for i in sorted(l):
    print(i)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
a = dict()
for _ in range(n):
    s = input()
    if s in a:
        a[s] += 1
    else:
        a[s] = 1

M = max(a.values())
for s in a:
    if a[s] == M:
        print(s)


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

M = max(a.values())
ans = []
for s in a:
    if a[s] == M:
        ans.append(s)
ans.sort()
for s in ans:
    print(s)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import collections

n = int(input())
l = []*n

for x in range(0, n) :
    l.append(input())

l_sorted = sorted(l)
c = collections.Counter(l_sorted)
mc = c.most_common()

pre_v = 0
ans = []
for m in mc :
    k = m[0]
    v = m[1]
    if v < pre_v :
        break
    pre_v = v
    ans.append(k)

ans_sorted = sorted(ans)
print(ans_sorted)



import collections

n = int(input())
l = []*n

for x in range(0, n) :
    l.append(input())

l_sorted = sorted(l)
c = collections.Counter(l_sorted)
mc = c.most_common()

pre_v = 0
ans = []
for m in mc :
    k = m[0]
    v = m[1]
    if v < pre_v :
        break
    pre_v = v
    ans.append(k)

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



Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())

d_count = {}
for i in range(N):
    S = str(input())
    d_count.setdefault(S, 0)
    d_count[S] = d_count[S] + 1
print(d_count)

max = 0
maxlist = []
for S in d_count:
    if(max < d_count[S] ):
        max = d_count[S]
        maxlist = [S]
    if(max == d_count[S]):
        maxlist.append(S)

maxlist_set = list(set(maxlist))
maxlist_set.sort()
for a in maxlist_set:
    print(a)

N = int(input())

d_count = {}
for i in range(N):
    S = str(input())
    d_count.setdefault(S, 0)
    d_count[S] = d_count[S] + 1

max = 0
maxlist = []
for S in d_count:
    if(max < d_count[S] ):
        max = d_count[S]
        maxlist = [S]
    if(max == d_count[S]):
        maxlist.append(S)

maxlist_set = list(set(maxlist))
maxlist_set.sort()
for a in maxlist_set:
    print(a)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import collections

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

m = max(c.values())

ans = [k for k, v in c.items() if m == v]
ans.sort()

print(i for i in ans)

n = int(input())

s = {}
i = 0
while n > i:
    s_tmp = input()
    if s.get(s_tmp):
        s[s_tmp] += 1
    else:
        s.setdefault(s_tmp, 1)
    i += 1
    
max_k_list = [kv[0] for kv in s.items() if kv[1] == max(s.values())]

for i in max_k_list:
    print(i)

n = int(input())

s = {}
i = 0
while n > i:
    s_tmp = input()
    if s.get(s_tmp):
        s[s_tmp] += 1
    else:
        s.setdefault(s_tmp, 1)
    i += 1
    
max_d = max(s.values())

print(max_d)

import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s).most_common()
ans = [k for k, v in c if c[0][1] == v]
ans.sort()
for i in ans:
    print(i)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
from collections import Counter

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

cnt = Counter(S)
val = list(cnt.values())
most = val[-1]

ans = []
for i in cnt:
    if cnt[i] == most:
        ans.append(i)

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


from collections import Counter

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

cnt = Counter(S)

most = 0
for i in cnt.values():
    most = max(most, i)

ans = []
for i in cnt:
    if cnt[i] == most:
        ans.append(i)

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import collections
l=[]
n=int(input())
for i in range(n):
  l.append(input())
c=collections.Counter(l)
max_list=[kv[0] for kv in c.items() if kv[1]==max(c.values())]

for j in max_list:
  print(j)

from collections import Counter

n=int(split())
l=[input() for i in range(n)]
c=Counter(l)
d=max(c.values())
max_list=[k for k,v in c.items() if v==d]
max_list.sort()
for j in max_list:
  print(j)

from collections import Counter

n=int(open(0).readline())
l=open(0).read().split()
c=Counter(l)
max_list=[kv[0] for kv in c.items() if kv[1]==max(c.values())]
max_list.sort()
for j in max_list:
  print(j.strip())

from collections import Counter
a=open(0)
n=int(a.readline())
l=a.read().split()
c=Counter(l)
d=max(c.values())
max_list=[k for k,v in c.items() if v==d]
max_list.sort()
print(*max_list,sep="\n")

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
s = [input() for i in range(n)]
ans = []
out = []
word_list = list(set(s))

for i in word_list:
  ans.append([s.count(i), i])

ans.sort(reverse = True)

for j in ans:
  if j[0] == ans[0][0]:
    out.append(j[1])

out.sort(reverse = True)
for k in out:
  print(k)


n = int(input())
s = [input() for i in range(n)]
ans = []
word_list = list(set(s))

for i in word_list:
  ans.append([s.count(i), i])

ans.sort(reverse = True)

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


from collections import Counter

n = int(input())
s = [input() for i in range(n)]
ans = {}
word_list = list(set(s))

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

import sys
input = sys.stdin.readline

n = int(input())
s = [input() for i in range(n)]
ans = {}
word_list = list(set(s))

for i in word_list:
  ans[i] = s.count(i)

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

from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
ans = []
charctor_count = Counter(s)
max_count = max(charctor_count.values())
for k, v in charctor_count.items():
  if v == max_count:
    ans.append( k)
print("\n".join(sorted(ans)))

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
D = dict()
for _ in range(N):
    cand = input()
    if cand not in D:
        D[cand] = 1
    else:
        D[cand] += 1
mx = max(D.values())
A = sorted(D.items(), key=lambda x: -x[1])

for k, m in A:
    if m == mx:
        print(k)
    else:
        exit()


N = int(input())
D = dict()
for _ in range(N):
    cand = input()
    if cand not in D:
        D[cand] = 1
    else:
        D[cand] += 1
mx = max(D.values())
A = sorted(D.items(), key=lambda x:-x[1],)

for k, m in A:
    if m == mx:
        print(k)
    if m != mx:
        exit()

N = int(input())
D = dict()
for _ in range(N):
    cand = input()
    if cand not in D:
        D[cand] = 1
    else:
        D[cand] += 1
mx = max(D.values())
A = sorted(D.items(), key=lambda x: -x[1])
ans = []
for k, m in A:
    if m == mx:
        ans.append(k)
    else:
        break

B = sorted(ans)
for b in B:
    print(b)


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
words = {}
for i in range(N):
  name = input()
  if name not in words:
    words[name] = 1
  elif name in words:
    words[name] += 1
    
res_name = []
for i in res_dict.keys():
  if res_dict[i] == max(res_dict.values()):
    res_name.append(i)
res_name = sorted(res_name)
for i in res_name:
  print(i)

N = int(input())
words = {}
for i in range(N):
  name = input()
  if name not in words:
    words[name] = 1
  else:
    words[name] += 1
    
res_name = []
for i in res_dict.keys():
  if res_dict[i] == max(res_dict.values()):
    res_name.append(i)
res_name = sorted(res_name)
for i in res_name:
  print(i)

N = int(input())
names = []
words = {}
for i in range(N):
    name = input()
    if name not in names:
        words[name] = 1
        names.append(name)
    elif name in names:
        words[name] += 1
        
max_name_list = []
for nm in words.items():
    if nm[1] == max(words.values()):
        max_name_list.append(nm[0])
max_name_list = sorted(max_name_list)
print('-')
for i in range(len(max_name_list)):
    print(max_name_list[i])

N = int(input())
words = {}
for i in range(N):
  name = input()
  if name not in words:
    words[name] = 1
  elif name in words:
    words[name] += 1
    
res_name = []
Max = max(words.values())
for i in words.keys():
  if words[i] == Max:
    res_name.append(i)
res_name = sorted(res_name)
for i in res_name:
  print(i)

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
s = []
for i in range(0, n):
    s.append(input())
my_dict = {i:s.count(i) for i in s}
answer = []
itemMaxValue = max(my_dict.items(), key=lambda x: x[1])
for key, value in my_dict.items():
    if value == itemMaxValue[1]:
        answer.append(key)

for x in answer:
    print(x)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
dic = {}

for i in range(n):
  temp = input()
  try:
    dic[temp] += 1
  except:
    dic[temp] = 0

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

for i in dic.keys():
  print(i)

from collections import Counter

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

counter = Counter(s)
max_cnt = max(counter.values())

names = [name for name,val in counter.items() if val==max_cnt]
names.sort()

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
# C - Poll
from collections import Counter


def main():
    _, *S = open(0).read().split()
    cnt = Counter(S)
    max_votes = max(cnt)
    ans = [k for k, v in cnt.items() if v == max_votes]
    ans.sort()
    print("\n".join(ans))


if __name__ == "__main__":
    main()


# C - Poll
from collections import Counter


def main():
    _, *S = open(0).read().split()
    cnt = Counter(S)
    max_votes = max(cnt.values())
    ans = [k for k, v in cnt.items() if v == max_votes]
    ans.sort()
    print("\n".join(ans))


if __name__ == "__main__":
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
name = [input() for i in range(N)]
import collections

c = collections.Counter(name)
values, counts = zip(*c.most_common(N))
maxim = counts[0]
answer = []
for val, cnt in zip(values,counts):
  if ( cnt == maxim):
    answer.append(val)
  else:
    break
sorted(answer)
for i in answer:
  print(i)

N = int(input())
name = [input() for i in range(N)]
import collections

c = collections.Counter(name)
values, counts = zip(*c.most_common(N))
maxim = counts[0]
answer = []
for val, cnt in zip(values,counts):
  if ( cnt == maxim):
    answer.append(val)
  else:
    break
answer = sorted(answer)
for i in answer:
  print(i)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
import sys
input=sys.stdin.readline
def main():
    N=int(input())
    S=[""]*N
    result={}
    for i in range(N):
        S[i]=input().strip()
        if S[i] not in result:
            result[S[i]]=1
        else:
            result[S[i]]+=1

    result=sorted(result.items())
    print(result)
    result=sorted(result,key=lambda x:-x[1])

    max_num=result[0][1]
    for i in range(len(result)):
        if result[i][1]==max_num:
            print(result[i][0])
        else:
            break
    
if __name__=="__main__":
    main()

import collections
import sys
N = int(input())
S = [input() for _ in range(N)]

c = collections.Counter(S)
ans = []
li=c.most_common()
for i in range(len(li)):
    if i == 0:
        ans.append(((li[0][0])))
    
    if i != 0:
        if (li[i-1][1]) == (li[i][1]):
            
            ans.append(((li[i][0])))
        else:
            break

ans.sort()

for i in ans:
    print(i)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
sl_s = sorted(list(set(sl)))

if len(sl_s) == 1:
    print(sl[0])
else:
    ans = []
    count = 1
    for s in sl_s:
        if sl.count(s) == count and ans.count(s) == 0:
            ans.append(s)
        elif sl.count(s) > count and ans.count(s) == 0:
            ans.clear()
            ans.append(s)
            count = sl.count(s)
    print('\n'.join(ans))

from collections import Counter

n = int(input())
sl = list(input() for _ in range(n))

cnt = Counter(sl)
# print('cnt:', cnt)
maxNum = max(cnt.values())
# print('maxNum:', maxNum)

ans = []
for k, v in cnt.items():
    if v == maxNum:
        ans.append(k)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import collections
N = int(input())
S_lis = []
for i in range(N):
    S_lis.append(input())

unique_S_lis = list(set(S_lis))
haha = collections.Counter(S_lis)
maxind = [i for i, x in enumerate(list(haha.values())) if x == max(list(haha.values()))]
lis_ans = sorted([unique_S_lis[i] for i in maxind])

for ans in lis_ans:
    print(ans)



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


S_set = set(S_lis)
S_dict = dict()

for s in S_set:
    S_dict[s] = 0

for val in S_lis:
    S_dict[val] += 1
max_num = max(S_dict.values())
ans = list()
for k, v in S_dict.items():
    if v == max_num:
        ans.append(k)
ans = sorted(ans)
for res in ans:
    print(res)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
#!/usr/bin/env python
# coding: utf-8

# In[12]:


import collections


# In[13]:


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


# In[14]:


mylist = collections.Counter(S).most_common()
cnt_tmp = mylist[0][1]
for word, cnt in mylist:
    if cnt != cnt_tmp:
        break
    print(word)
    cnt_tmp = cnt


# In[ ]:






#!/usr/bin/env python
# coding: utf-8

# In[12]:


import collections


# In[22]:


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


# In[26]:


mylist = collections.Counter(sorted(S)).most_common()
cnt_tmp = mylist[0][1]
for word, cnt in mylist:
    if cnt != cnt_tmp:
        break
    print(word)
    cnt_tmp = cnt


# In[ ]:






Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N=int(input())
A = [input() for x in range(N)]
max=-1
for a in set(A):
  if A.count(a)>max:
    max=A.count(a)

for b in set(A):
  if A.count(b)==max:
    print(b)

N=int(input())
d={}
for i in range(N):
  tmp = input()
  if tmp in d:
    d[tmp] += 1
  else:
    d[tmp] = 1

max_v=max(d.values())
ans=list(filter(lambda x: x[1] == max_v, d.items()))
[print(i[0]) for i in sorted(ans)]

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
l = [input() for _ in range(N)]
l.sort()
l2 = []
for i in range(0,N-1):
    if (l[i]==l[i+1]):
        l2.append(l[i])
ans=list(set(l2))
if len(l2)==0:
    for k in range(0,N):
        print(l[k])
for j in range(0,len(l2)):
    print(ans[j])

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

Verdicts: Runtime Error

Accepted