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())
s=[input() for _ in range(n)]



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

ans = [k for k,v in count.items() if v == max(count.values())]
for i in range(len(ans)):
    print(ans[i])


n=int(input())
s=[input() for _ in range(n)]
 
 
 
count={}
for i in range(n):
    if s[i] not in count:
        count[s[i]] = 1
    else:
        count[s[i]] += 1
 
max = max(count.values())

#for word in count:
#    if count[word] == max:
#        ans.append(word)
ans = [k for k,v in count.items() if v == max]
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):
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()

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

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

from collections import Counter

N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
c = Counter(S).most_common()
m = c[0][1]
c.sort()
for i in range(len(c)):
    if c[i][1] == m:
        print(c[i][0])

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

def main():
    n = int(input())

    s_list = []

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

    c = collections.Counter(s_list)
    c_list = c.most_common()

    print_count = len(c_list)
    for j in range(len(c_list)-1):
        if c_list[j+1][1] < c_list[j][1]:
            print_count = j+1
            break
    
    for k in range(print_count):
        print(c_list[k][0])
    

if __name__ == '__main__':
    main()



import collections

def main():
    n = int(input())

    s_list = []

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

    c = collections.Counter(s_list)
    c_list = c.most_common()

    print_count = len(c_list)
    new_list = []

    for j in range(len(c_list)):
        new_list.append(c_list[j][0])
        if j != len(c_list)-1:
            if c_list[j+1][1] < c_list[j][1]:
                print_count = j+1
                break
    
    sorted_list = sorted(new_list)
    for k in sorted_list:
        print(k)
    

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())
s=[input() for i in range(n)]
d={}
for i in range(n):
  d[s[i]] = d.get(s[i],0) + 1

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

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]

res = []

for i in range(len(sorted_d)):
    if sorted_d[i][1] == ma:
        res.append(sorted_d[i][0])

res.sort()

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

Verdicts: 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())
s = list(input().split())
dic ={}
for key in s:
    if key not in dic:
        count = 1
    dic[key] = count
    count = count+1
res = sorted(list(filter(lambda key:dic[key]==max(dic.values()),list(dic))))
for key in res:
    print(key)

n = int(input())
dic ={}
for i in range(n):
    key = input()
    if key not in dic:
        dic[key] = 1
    if key in dic:
        dic[key] += 1
max_v = max(dic.values())
res = sorted(list(filter(lambda key:dic[key]==max_v,list(dic))))
for key in res:
    print(key)

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 = {}
s = []
for _ in range(N):
   s.append(input())

for i in s:
    if i in dic.keys():
        dic[i] += 1
    else:
        dic[i] = 1
result = []
num = 0
for i in dic.keys():
    if dic[i] > num:
        result = []
        result.append(i)
        num = dic[i]
    elif dic[i] == num:
        result.append(i)
for i in result:
    print(i)

N = int(input())
dic = {}
s = []
for _ in range(N):
   s.append(input())

for i in s:
    if i in dic.keys():
        dic[i] += 1
    else:
        dic[i] = 1
result = []
num = 0
for i in dic.keys():
    if dic[i] > num:
        result = []
        result.append(i)
        num = dic[i]
    elif dic[i] == num:
        result.append(i)
result.sort()
for i in result:
    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):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
#s = {s():0 for _ in range(n)}

a = {}
for i in range(n):
	s = input()
	try:
		a[s] += 1
	except KeyError:
		a[s] = 1
b = sorted(a.items(),key = lambda x:x[0])
print(a)
memo = max(b)[1]
for i in b:
	"""print(i,"i")
	print(i[0],"i[0]")
	print(i[1],"i[1]")
	print(max(b)[0],"max(b)[0]")"""
	if i[1] == memo:
		print(i[0])

n=int(input())
a=[str() for i in range(n)]
b=[]
for j in range(n):
  for k in range(n):
    if a[j]==a[k]:
      b=a[j]
b.sort()
print(b)

def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
#s = {s():0 for _ in range(n)}

a = {}
for i in range(n):
	s = input()
	try:
		a[s] += 1
	except KeyError:
		a[s] = 1
b = sorted(a.items(),key = lambda x:x[0])

memo = max([i[1] for i in a.items()])
for i in b:
	"""print(i,"i")
	print(i[0],"i[0]")
	print(i[1],"i[1]")
	print(max(b)[0],"max(b)[0]")"""
	if i[1] == memo:
		print(i[0])


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

n=int(input())
s = []
max = 0

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

c = collections.Counter(s)

for i in c.items():
    if i[1] > max:
        max = i[1]

s2 = [i[0] for i in c.items() if i[1] == max]

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

import collections

n=int(input())
s = []
max = 0

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

c = collections.Counter(s)

for i in c.items():
    if i[1] > max:
        max = i[1]

s2 = [i[0] for i in c.items() if i[1] == max]

s2.sort()

for j in range(len(s2)):
    print(s2[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):
from collections import Counter
num = int(input())
value = [input() for i in range(num)]
votes = Counter(value)
dict = {}

for value in votes.values():
    dict[value] = []

for (key, value) in votes.iteritems():
    dict[value].append(key)
maxVote = sorted(dict.keys(), reverse=True)[0]
if len(dict[maxVote]) > 1:
    print(sorted(dict[maxVote])[0])
else:
    print(dict[maxVote][0])

from collections import Counter
num = int(input())
value = [input() for i in range(num)]
print(type(value))
votes = Counter(value)
dict = {}

for value in votes.values():
    dict[value] = []

for (key, value) in votes.items():
    dict[value].append(key)
maxVote = sorted(dict.keys(), reverse=True)[0]
if len(dict[maxVote]) > 1:
    print(sorted(dict[maxVote])[0])
else:
    print(dict[maxVote][0])

from collections import Counter
num = int(input())
value = [input() for i in range(num)]
votes = Counter(value)
dict = {}

for value in votes.values():
    dict[value] = []

for (key, value) in votes.items():
    dict[value].append(key)
maxVote = sorted(dict.keys(), reverse=True)[0]
list_data = dict[maxVote]
list_data.sort()
for i in list_data:
    print(i)

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):
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    ret = 0
    di = {}
    mx = 0
    for n in range(N):
        s = iss()
        if s in di:
            di[s] += 1
            mx = max(di[s], mx)
        else:
            di[s] = 0

    for s in di:
        if di[s] == mx: print(s)


if __name__ == '__main__':
    main()


import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    S = [iss() for _ in range(N)]
    S.sort()
    di = {}
    mx = 0
    for s in S:
        if s in di:
            di[s] += 1
            mx = max(di[s], mx)
        else:
            di[s] = 0

    ret = []
    for s in di:
        if di[s] == mx: ret.append(s)
    print(*sorted(ret), sep='\n')


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 collections

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

c = collections.Counter(s)
common = c.most_common()

count = common[0][1]

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


from collections import Counter

n = int(input())
s = [input() for i in range(n)]
c = Counter(s)
c.most_common()
ans = []
m = -1
for i, item in enumerate(c.most_common()):
    if i == 0:
        m = item[1]
        ans.append(item[0])
    elif item[1] == m:
        ans.append(item[0])
    else:
        break
ans.sort()
print(*ans, 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):
N = int(input())
S = []
for _ in range(N):
    S.append(input())
 
S_set = list(set(S))
S_dic = {}
M = 0
for s in S_set:
    S_dic[s] = S.count(s)
    M = max(M, S.count(s))
 
S_dic_sorted = sorted(S_dic.items(), key=lambda x: x[0])
for l in S_dic_sorted:
    if l[1] == M:
        print(l[0])
    else:
      break

import collections

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

C = collections.Counter(S).most_common()
M = C[0][1]

ans = []
for c in C:
    if c[1] == M:
        ans.append(c[0])
    else:
        break

ans.sort()
for a in ans:
    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

def resolve():
    N = int(input())
    S_list = []
    for i in range(N):
        S_list.append(input())
    
    cc = collections.Counter(S_list)
    cc_list = cc.most_common()

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


if __name__ == "__main__":
    resolve()

import collections

def resolve():
    N = int(input())
    S_list = []
    for i in range(N):
        S_list.append(input())
    
    cc = collections.Counter(S_list)
    cc_list = cc.most_common()

    most_num = cc_list[0][1]
    tmp_list = []

    for i in cc_list:
        if most_num == i[1]:
            tmp_list.append(i[0])
        else:
            break

    tmp_list_sorted = sorted(tmp_list)
    for tls in tmp_list_sorted:
        print(tls)


if __name__ == "__main__":
    resolve()

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):
if __name__ == '__main__':
    dic = dict()
    n = int(input())
    for i in range(n):
        val = input()
        if val in dic.keys():
            dic[val]+=1
        else:
            dic[val] = 1
    max_keys = max(dic.values())
    values_of_max_key = [val for val in dic if dic[val] == max_keys]
    for s in values_of_max_key:
        print(s)

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

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

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

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
n=int(input())
l=[input() for i in range(n)]
c = collections.Counter(l)
ll=len(c)
for i in range(ll):
  print(c.most_common()[i][0])



n=int(input())
l=[input() for i in range(n)]
l.sort()
ll=list(set(l))
ll.sort()
m=len(ll)
ans=[0]*m
count=0
j=0
for i in range(len(l)-1):
  if l[i]==l[i+1]:
    count+=1
    if i+1==n-1:
      ans[j]+=count
  else:
    ans[j]+=count
    count=0
    j+=1
g=max(ans)
for i in range(m):
  if ans[i]==g:
    print(ll[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())
d = {}
for _ in range(n):
    s = input()
    if s in d:
        d[s] = +1
    else:
        d[s] = 1
max_d = max(d.values())
ans = sorted([a[0] for i in d.items() if a[1] == max_d])
print(ans)

n = int(input())
d = {}
for _ in range(n):
    s = input()
    if s  in d:
        d[s] = +1
    else:
        d[s] = 1
max_d = max(d.values())
ans = [kv[0] for kv in d.items() if kv[1] == max_d]
ans.sort()

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

n = int(input())
d = {}
for _ in range(n):
    s = input()
    if s  in d:
        d[s] = +1
    else:
        d[s] = 1
max_d = max(d.values())
ans = d.sorted([kv[0] for kv in d.items() if kv[1] == max_d])
print(ans)

n = int(input())
s = [input() for _ in range(n)]
dic = {}
for i in range(n):
  if s[i] not in dic:
    dic[s[i]] = 1
    else:
      dic[s[i]] += 1
max_dic_val = max(dic.values()) 
ans = []
for keys in dic.keys():
  if dic[keys] == max_dic_val: 
    ans.append(keys)
ans = sorted(ans)
for words in ans:
  print(words)

n = int(input())
d = {}
for _ in range(n):
    s = input()
    if s  in d:
        d[s] = +1
    else:
        d[s] = 1
max_d = max(d.values())
ans = sorted([kv[0] for kv in d.items() if kv[1] == max_d])
print(ans)


n=int(input())
s=[input() for _ in range(n)]
dic={}
for i in range(n):
  if s[i] not in dic:
    dic[s[i]]=1
  else:
    dic[s[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: Runtime Error

Wrong Answer

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

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

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

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

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

ans = []
counter = 1
memo = 0

for i in range(1, N):
    if S[i] == S[i-1]:
        counter += 1
    else:
        if counter == memo:
            ans.append(S[i-1])
        elif counter > memo:
            ans.clear()
            ans.append(S[i-1])
            memo = counter
        counter = 1
if counter == memo:
    ans.append(S[N-1])
elif counter > memo:
    ans.clear()
    ans.append(S[N-1])
    memo = counter
for a in ans:
    print(a)

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

d = {}

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

hoge = max(d.values)

max_kv_list = [kv[0] for kv in d.items() if kv[1] == hoge]

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

N = int(input())

d = {}

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

hoge = max(d.values())

max_kv_list = [kv[0] for kv in d.items() if kv[1] == hoge]

max_kv_list = sorted(max_kv_list)
for ans in max_kv_list:
    print(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 = [input() for i in range(n)]
c = collections.Counter(s)


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


n = int(input())

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

list = []
maxnum = max(d.values())

for i in d:
    if d[i] == maxnum:
        list.append(i)
list.sort()
for i in list:
    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())
x={}

count=0
for i in range(n):
  s=input()
  if s in x:
    x[s]+=1
  else:
    x[s]=1
a=max(x.values())
answer=sorted(x)
for a in answer:
  print(a)



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

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

a=max(x.values())
keys=[k for k,v in x.items() if v==a]
answer=sorted(keys)
  
for a in answer:
  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())
s = []
for i in range(n):
    s.append(input())
ans = {}
for i in s:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1
print(ans)
ans2 = sorted(ans.items(), key=lambda x:x[1], reverse=True)
print(ans2)
ans_list = {ans2[0][0]}
ans_cnt = ans2[0][1]
for i, j in ans2:
    if ans_cnt == j:
        ans_list.add(i)

ans_list2 = list(ans_list)
ans_list2.sort(reverse=False)
for i in ans_list2:
    print(i)

n = int(input())
s = []
for i in range(n):
    s.append(input())
ans = {}
for i in s:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1
ans2 = sorted(ans.items(), key=lambda x:x[1], reverse=True)
ans_list = {ans2[0][0]}
ans_cnt = ans2[0][1]
for i, j in ans2:
    if ans_cnt == j:
        ans_list.add(i)

ans_list2 = list(ans_list)
ans_list2.sort(reverse=False)
for i in ans_list2:
    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 collections

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

setted_S = set(S)
counted_S = collections.Counter(S)

ans_ls = []
for k, v in counted_S.items():
    if v == max(counted_S.values()):
        ans_ls.append(k)
    else:
        break

ans_ls.sort()

for i in ans_ls:
    print(i)

import collections

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

setted_S = set(S)
counted_S = collections.Counter(S)
sorted_S = sorted(counted_S.items(), key=lambda x: x[1], reverse=True)

ans_ls = []
for s in sorted_S:
    a = sorted_S[0][1]
    if s[1] == a:
        ans_ls.append(s[0])
    else:
        break

ans_ls.sort()

for i in ans_ls:
    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):
  S.append(str(input()))
  
from collections import Counter
N = int(input())
S = []
for i in range(N):
  S.append(str(input()))
ans_list = []
  

c = Counter(S)
keys, values = zip(*c.most_common())

for i in range(len(values)):
  if max(values) == values[i]:
    ans_list.append(keys[i])
    
sorted(ans_list)
for i in range(len(ans_list)):
  print(ans_list[i])



from collections import Counter
N = int(input())
S = []
for i in range(N):
  S.append(str(input()))
ans_list = []
  

c = Counter(S)
keys, values = zip(*c.most_common())

for i in range(len(values)):
  if max(values) == values[i]:
    ans_list.append(keys[i])
    
sorted(ans_list)
for i in range(len(ans_list)):
  print(ans_list[i])



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

c = Counter(S)
max_value = max(list(c.values()))
ans_list = sorted(list(c.items()))

for i in range(len(ans_list)):
  if ans_list[i][1] == max_value:
    print(ans_list[i][0])

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):
n = int(input())
dict = {}
for i in range(n):
  a = input()
  if (not (a in list)):
    dict[a] = 0
  else:
    dict[a] += 1
b = max(dict.values())
for i in dict.keys():
  if dict[i] == b:
    print(i+"\n")
  

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

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
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]
for i in c.items():
    if i[1] == max:
        print(i[0])


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 = []
# print("-------")
for i in c.items():
    if i[1] == max:
        list.append(i[0])

for i in sorted(list):
    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_lst = [str(input()) for i in range(n)]
s_lst.sort()

count_lst = []
count = 1

if n==1:
    count_lst.append(1)
else:
    for i in range(1,n):
        s1 = s_lst[i-1]
        s2 = s_lst[i]

        if s1==s2:
            count += 1
            if i==n-1:
                count_lst.append(count)
        else:
            count_lst.append(count)
            count = 1

    if s_lst[-1]!=s_lst[-2]:
        count_lst.append(1)


new_slst = list(set(s_lst))
max_count = max(count_lst)
answer_lst = []

for i in range(len(count_lst)):
    cou = count_lst[i]
    s = new_slst[i]
    if cou==max_count:
        answer_lst.append(s)

answer_lst.sort()
for i in range(len(answer_lst)):
    answer = answer_lst[i]
    print(answer)

n = int(input())
s_lst = [str(input()) for i in range(n)]
s_lst.sort()

count_lst = []
count = 1
for i in range(n-1):
    s1 = s_lst[i]
    s2 = s_lst[i+1]

    if s1==s2:
        count += 1
        if i==n-2:
            count_lst.append(count)
    else:
        count_lst.append(count)
        count = 1

if n>1:
    if s_lst[-1]!=s_lst[-2]:
        count_lst.append(1)
if n==1:
    count_lst.append(1)

new_slst = list(set(s_lst))
max_count = max(count_lst)
answer_lst = []

for i in range(len(count_lst)):
    cou = count_lst[i]
    s = new_slst[i]
    if cou==max_count:
        answer_lst.append(s)

answer_lst.sort()
for i in range(len(answer_lst)):
    answer = answer_lst[i]
    print(answer)

n = int(input())
s_lst = [str(input()) for i in range(n)]
s_lst.sort()

count_lst = []
count = 1

if n==1:
    count_lst.append(1)
else:
    for i in range(1,n):
        s1 = s_lst[i-1]
        s2 = s_lst[i]

        if s1==s2:
            count += 1
            if i==n-1:
                count_lst.append(count)
        else:
            count_lst.append(count)
            count = 1

    if s_lst[-1]!=s_lst[-2]:
        count_lst.append(1)


new_slst = list(set(s_lst))
new_slst.sort()
max_count = max(count_lst)
answer_lst = []

for i in range(len(count_lst)):
    cou = count_lst[i]
    s = new_slst[i]
    if cou==max_count:
        answer_lst.append(s)

answer_lst.sort()
for i in range(len(answer_lst)):
    answer = answer_lst[i]
    print(answer)

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):
import itertools
n=int(input())
s = []
for _ in range(n):
    s.append(input())
#print(s)
#s = list(itertools.chain.from_iterable(s))
#print(s)
s_u = list(set(s))
box = []
box.append([s_u[0],s.count(s_u[0])])
for i in range(1,len(s_u)):
    if max(box) < s.count(s_u[i]):
        box.remove(max(box))
        box.append([s_u[i],s.count(s_u[i])])
    elif max(box) == s.count(s_u[i]):
        box.append([s_u[i],s.count(s_u[i])])
            
ans_box = sorted(box)
for i in range(len(ans_box)):
    print(ans_box[i])

n=int(input())
dic = dict()

a = 0
for i in range(n):
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
    if dic[s] > a:
        a = dic[s]
box= []
for i in dic:
    if dic[i] == a:
        box.append(i)

ans = sorted(box)
for in in range(len(ans)):
    print(ans)

n=int(input())
dic = dict()

a = 0
for i in range(n):
    s = str(input())
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
    if dic[s] > a:
        a = dic[s]
box= []
for i in dic:
    if dic[i] == a:
        box.append(i)

ans = sorted(box)
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):
N = int(input())
cnt_s = {}
for _ in range(N):
  s = input()
  if s in cnt_s:
    cnt_s[s] += 1
  else:
    cnt_s[s] - 1
  
max_cnt = max(cnt_s.values())

ans = []
for key, value in cnt_s.items():
  if value == max_cnt:
    ans.append(key)
  
[print(s) for s in sorted(ans)]

N = int(input())
cnt_s = {}
for _ in range(N):
  s = input()
  if s in cnt_s:
    cnt_s[s] += 1
  else:
    cnt_s[s] = 1
  
max_cnt = max(cnt_s.values())

ans = []
for key, value in cnt_s.items():
  if value == max_cnt:
    ans.append(key)
  
[print(s) for s in sorted(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):
from collections import Counter

N=int(input())
S=[]

for _ in range(N):
    s=input()
    S.append(s)

c=Counter(S)

max_s_list= [kv[0] for kv in c.items() if kv[1]==max(c.values())]

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

from collections import OrderedDict

N=int(input())
S=[]

for _ in range(N):
    s=input()
    S.append(s)

c=OrderedDict(sorted(S))

max_s_list= [kv[0] for kv in c.items() if kv[1]==max(c.values())]

for a in max_s_list:
    print(a)

N=int(input())
Sarr1=[]
Sarr2=[]
for _ in range(N):
    s=input()
    if Sarr1.count(s)==0:
        Sarr1.append(s)
        Sarr2.append(0)
    if Sarr1.count(s)>0:
        i =Sarr1.index(s)
        Sarr2[i]+=1
ans=[]
for i in range(len(Sarr2)):
    if Sarr2[i]==max(Sarr2):
        ans.append(Sarr1[i])
    else:
        pass
FA=sorted(ans)
print(FA)

import collections

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

c=collections.Counter(S)

max_s_list= [kv[0] for kv in c.items() if kv[1]==max(c.values())]

for l in max_s_list:
    print(l)

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

_Sset1=set(Sarr)
_Sset2=list(_Sset1)
Sset=sorted(_Sset2)

Ssetcount=[]
for i in range(len(Sset)):
    c=Sarr.count(Sset[i])
    Ssetcount.append(c)

maxnum=max(Ssetcount)
ansindex=[]
for j in range(len(Ssetcount)):
    if Ssetcount[j]==maxnum:
        ansindex.append(j)
    else:
        pass
ans=[]
for k in range(len(ansindex)):
    x=Sset[k]
    ans.append(x)

print(ans)

from collections import Counter

N=int(input())
S=[]

for _ in range(N):
    s=input()
    S.append(s)

c=Counter(S)
arr=c.most_common()

maxnum=arr[0][1]
ans=[]

for i in range(len(arr)):
    if arr[i][1]==maxnum:
        ans.append(arr[i][0])        
    else:
        break
FA=sorted(ans)
for j in FA:
    print(j)

Verdicts: Wrong Answer

Runtime Error

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 _ in range(n)]
c = Counter(s)
m = max(c.values())
ans = sorted(k for k,v in c.items() if v == m)
print(ans)

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

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
from collections import Counter

N = int(input())
Ss = Counter([input().rstrip() for _ in range(N)])
m = max(Ss.values())
for k, v in Ss.items():
    if v == m:
        print(k)

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

N = int(input())
Ss = Counter([input().rstrip() for _ in range(N)])
m = max(Ss.values())
ans = []
for k, v in Ss.items():
    if v == m:
        ans.append(k)
ans.sort()
print(*ans, 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):
N = int(input())
s_list = {}
for i in range(N):
  S = input()
  if S in s_list:
    s_list[S] += 1
  else:
    s_list[S] = 0
max = 0
maxs = []
for s,c in s_list.items():
  if c > max:
    maxs = [s]
    max = c
  elif c == max:
    maxs.append(s)
for m in maxs:
  print(m)

from collections import Counter
def solve():
  N = int(input())
  S = [input() for _ in range(N)]
  c = Counter(S)
  M = max(c.values())
  ans = []
  for k,v in c.items():
    if v==M:
      ans.append(k)
  ans.sort()
  return ans
print(*solve(),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):
import collections

n = int(input())
l = [input() for _ in [0] * n]

counted = collections.Counter(l)
print(counted)


m = max(counted.values())
print(m)


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

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

print(*sorted(chars),sep='\n')


import collections

n = int(input())
l = [input() for _ in [0] * n]

counted = collections.Counter(l)
#print(counted)

m = max(counted.values()) 

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

print(*sorted(ans),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):
import collections
import itertools

a = int(input())

s = [input() for i in range(a)]

counter = collections.Counter(s)

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

l = []

for k, v in it:
  l.append(k)

l = ' '.join(l)
print(l)

import collections
import itertools

a = int(input())

s = [input() for i in range(a)]

counter = collections.Counter(s)

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

print(*(k for k, v in it))


import collections
import itertools

a = int(input())

s = [input() for i in range(a)]

counter = collections.Counter(s)

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

l = []

for k, v in it:
  l.append(k)

print(sorted(l))  
  

import collections
import itertools

a = int(input())

s = [input() for i in range(a)]

counter = collections.Counter(s)

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

l = []

for k, v in it:
  l.append(k)

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

n = int(input())

s_dic = dict()
a_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_s = sorted(s_dic.items(), key= lambda x:x[1], reverse=True)

# print(len(s_dic_s))
#print(s_dic_s)

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

max_n = True
j = 0

while max_n:
  if s_dic_s[j][1] == m_count:
    a_dic[s_dic_s[j][0]] = s_dic_s[j][1]
    j += 1
    if j == len(s_dic_s):
      max_n = False
  else:
    max_n = False

# print(a_dic)
a_dic_s = sorted(a_dic.items())
    
# print(a_dic_s)

for i in range(len(a_dic_s)):
  print(a_dic_s[i][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):
n=int(input())
string_list=[input() for i in range(n)]
import collections
import numpy as np
c = collections.Counter(string_list)
d=c.most_common()
x=int(d[0][1])
z=[]
for i in range(len(d)):
  y=int(d[i][1])
  if x==y:
    z.append(str(d[i][0]))
    
z.sort(reverse=True)
for i in range(len(z)):
  print(z[i])

n=int(input())
string_list=[input() for i in range(n)]
import collections
import numpy as np
c = collections.Counter(string_list)
d=c.most_common()
x=int(d[0][1])
for i in range(len(d)):
  y=int(d[i][1])
  if x==y:
    print(d[i][0])
    

n=int(input())
string_list=[input() for i in range(n)]
import collections
import numpy as np
c = collections.Counter(string_list)
d=c.most_common()
x=int(d[0][1])
z=[]
for i in range(len(d)):
  y=int(d[i][1])
  if x==y:
    z.append(str(d[i][0]))
    
z.sort()
for i in range(len(z)):
  print(z[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):
n = int(input())
from collections import defaultdict
d=defaultdict(int)
for _ in range(n):
    d[input()]+=1

L=[(v,k) for (k,v) in d.items()]
L.sort(reverse=True)
max_cnt=L[0][0]
#print('*'*30)
ans=[]
for l in L:
    if l[0]==max_cnt:
        ans.append(l[1])
    else :
        break

for a in ans:
    print(ans)

n = int(input())
from collections import defaultdict
d=defaultdict(int)
for _ in range(n):
    d[input()]+=1

L=[(v,k) for (k,v) in d.items()]
L.sort(reverse=True)
max_cnt=L[0][0]
#print('*'*30)
ans=[]
for l in L:
    if l[0]==max_cnt:
        ans.append(l[1])
    else :
        break

for a in ans:
    print(a)

n = int(input())
from collections import defaultdict
d=defaultdict(int)

max_cnt=-1
for _ in range(n):
    s=input()
    d[s]+=1
    max_cnt=max(max_cnt, d[s])


ans=sorted([k for (k,v) in d.items() if v==max_cnt])
    
for a in ans:
    print(a)

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())
s = [input() for _ in range(n)]

counter = Counter(s)
index = 0
ans = []
for k, v in counter.most_common():
    if index == 0:
        max_v = v
        ans.append(k)
    else:
        if v == max_v:
            ans.append(k)
        else:
            exit()
    index += 1
ans = sorted(ans)
for i in range(len(ans)):
    print(ans[i])


from collections import Counter

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

counter = Counter(s)
index = 0
ans = []
for k, v in counter.most_common():
    if index == 0:
        max_v = v
        ans.append(k)
    else:
        if v == max_v:
            ans.append(k)
        else:
            break
    index += 1
ans = sorted(ans)
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 math
import collections

def main():
  N = int(input())
  S = list()
  S = [input() for _ in range(N)]
  
  s = collections.counter(S)
  
  MaxCount = max(s.values())
  
  ans = []
  
  for key, value in s.items():
    if value == MaxCount:
      ans.append(key)
                 
  ans.sort()
  
  for i in ans:
    print(ans[i])
  
  
  
  
main()


import math
import collections

def main():
  N = int(input())
  S = list()
  S = [input() for _ in range(N)]
  
  s = collections.Counter(S)
  
  MaxCount = max(s.values())
  
  ans = []
  
  for key, value in s.items():
    if value == MaxCount:
      ans.append(key)
                 
  ans.sort()
  
  for i in ans:
    print(i)
  
  
  
  
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())
dic = {}
for _ in range(n):
  k = input()
  dic[k] = 1 if k not in dic else dic[k] + 1
result = []
for i,j in dic.items():
  result.append((j,i))
  result.sort()
  maxi = result[-1][0]
  reresult=[]
  for i in result:
    if maxi == i[0]:
      reresult.append(i[1])
      for i in sorted(reresult):
        print(i)

n = int(input())
dic = {}
maxi = 0
for _ in range(n):
  k = input()
  dic[k] = 1 if k not in dic else dic[k] + 1
  if dic[k] > maxi: maxi = dic[k]
result = []
for i,j in dic.items():
  if j == maxi:
    result.append(i)
result.sort()
for r in result:
  print(r)

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):
from collections import defaultdict

N = int(input())
S_dic = defaultdict(int)

for i in range(N):
  S = input()
  S_dic[S] += 1

m = max(S_dic.values())
max_S = [i[0] for i in S_dic.items() if i[1] == m ]
print("\n".join(max_S))

from collections import defaultdict

N = int(input())
S_dic = defaultdict(int)

for i in range(N):
  S = input()
  S_dic[S] += 1

m = max(S_dic.values())
max_S = [i[0] for i in S_dic.items() if i[1] == m ]
max_S.sort()
print("\n".join(max_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())
C=collections.Counter([input() for _ in range(N)])
v,c=zip(*C.most_common())
print(v[0])
for i in range(1,len(v)):
  if c[0]!=c[i]:
    break
  print(v[i])


import collections

N=int(input())
C=collections.Counter([input() for _ in range(N)])
v,c=zip(*C.most_common())
[print(x) for x in sorted([v[i] for i in range(len(c)) if c[i]==c[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):
for _ in range(n):
    s += input()+" "
ls = s.split()
counter = 0
res = []
for x in ls:
    if ls.count(x) > counter:
        counter = ls.count(x)
for x in set(ls):
    if ls.count(x) == counter:
        res.append(x)
r = sorted(res)
print("\n".join(r))

from collections import Counter
n = int(input())
ls = []
for _ in range(n):
    ls.append(input())
res = []
counter = Counter(ls).most_common()
for x in counter:
    if x[1] == counter[0][1]:
        res.append(x[0])
print("\n".join(sorted(res)))

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 i in range(n)]

vote = {}
for i in range(n):
    if s[i] in vote:
        vote[s[i]] +=1
    else:
        vote[s[i]] = 1
max_kv_list = [kv[0] for kv in vote.items() if kv[1] == max(vote.values())]
max_kv_list.sort()

print('¥n'.join(max_kv_list))

from collections import defaultdict
n = int(input())

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

mx=0
for i,j in d.items():
    if j>mx:
        mx=j

ans=[]
for i, j in d.items():
    if j==mx:
        ans.append(i)

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

n = int(input())

l = []

for i in range(n):
    l.append(input())
c = collections.Counter(l)
cx = c.most_common()
nm = cx[0][1]
print(cx[0][0])
for i in range(1, len(cx)):
    if (nm == cx[i][1]):
        print(cx[i][0])
    else:
        break

import collections

n = int(input())

l = []

for i in range(n):
    l.append(input())
c = collections.Counter(l)
cx = c.most_common()
nm = cx[0][1]
for i in range(n):
    if (nm == cx[i][1]):
        print(cx[i][0])
    else:
        break

import collections

n = int(input())

l = []

for i in range(n):
    l.append(input())
c = collections.Counter(l)
cx = c.most_common()
nm = cx[0][1]
ans = []
ans.append(cx[0][0])
for i in range(1, len(cx)):
    if (nm == cx[i][1]):
        ans.append(cx[i][0])
    else:
        break

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

Verdicts: Wrong Answer

Runtime Error

Accepted