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 i in range(n)]
s.sort()
cnt=1
ans=0
pri=[]
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        ans=max(cnt,ans)
        cnt=1
ans=max(cnt,ans)
for i in range(n):
    if ans==s.count(s[i]):
        pri.append(s[i])
print(ans)
t=set(pri)
p=list(t)
p.sort()
for i in range(len(p)):
    print(p[i])

n=int(input())
s=[input() for i in range(n)]
s.sort()
cnt=1
ans=0
pri=[]
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        ans=max(cnt,ans)
        cnt=1
ans=max(cnt,ans)
cnt=1
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        if cnt==ans:
            pri.append(s[i])
            cnt=1
        else:
            cnt=1
if cnt==ans:
    pri.append(s[-1])
print(ans)
for i in range(len(pri)):
    print(pri[i])

n=int(input())
s=[input() for i in range(n)]
s.sort()
cnt=1
ans=0
pri=[]
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        ans=max(cnt,ans)
        cnt=1
ans=max(cnt,ans)
for i in range(n):
    if ans==s.count(s[i]):
        pri.append(s[i])
print(ans)
t=set(pri)
p=list(t)
p.sort()
print(p)

n=int(input())
s=[input() for i in range(n)]
s.sort()
cnt=1
ans=0
pri=[]
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        ans=max(cnt,ans)
        cnt=1
ans=max(cnt,ans)
cnt=1
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        if cnt==ans:
            pri.append(s[i])
            cnt=1
        else:
            cnt=1
if cnt==ans:
    pri.append(s[-1])
for i in range(len(pri)):
    print(pri[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
from sys import stdin
N = int(stdin.readline().rstrip())
data = []
for i in range(N):
    s = (stdin.readline().rstrip())
    data.append(s)
c = collections.Counter(data)
maxc = max(c.values())
for j in c.keys():
    if c[j] == maxc:
        print(j)

import collections
from sys import stdin
N = int(stdin.readline().rstrip())
data = []
for i in range(N):
    s = (stdin.readline().rstrip())
    data.append(s)
c = collections.Counter(data)
maxc = max(c.values())
for j in sorted(c.keys()):
    if c[j] == maxc:
        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):
def inverse_lookup(d, x):
    a = []
    for k,v in d.items():
        if x == v:
          a.append(k)
    print(type(a))
    return sorted(a)

n = int(input())
w = {}
for _ in range(n):
  i = input()
  if i in w:
    w[i] += 1
  else:
    w[i] = 1
m = max(w.values())
for j in inverse_lookup(w,m):
  print(j)

def inverse_lookup(d, x):
    a = []
    for k,v in d.items():
        if x == v:
          a.append(k)
    return a

n = int(input())
w = {}
for i in range(n):
  if i in w:
    w[i] += 1
  else:
    w[i] = 1
m = max(w.values())
for i in inverse_lookup(w,m).sort(reverse=True):
  print(i)

def inverse_lookup(d, x):
    a = []
    for k,v in d.items():
        if x == v:
          a.append(k)
    return sorted(a)

n = int(input())
w = {}
for _ in range(n):
  i = input()
  if i in w:
    w[i] += 1
  else:
    w[i] = 1
m = max(w.values())
for j in inverse_lookup(w,m):
  print(j)

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 = []
kaisuu = []
solution = []
index = 0

for i in range(N):
  tmp = input()
  S.append(tmp)
  
c = collections.Counter(S)

d = c.most_common()

max_ = d[0][1]

for i in range(len(d)):
  if d[i][1] == max_:
    solution.append(d[i][0])

for i in solution:
  print(i)

import collections

N = int(input())
S = []
kaisuu = []
solution = []
index = 0

for i in range(N):
  tmp = input()
  S.append(tmp)
  
c = collections.Counter(S)

d = c.most_common()

max_ = d[0][1]

for i in range(len(d)):
  if d[i][1] == max_:
    solution.append(d[i][0])

for i in solution:
  print(i)

import math

N = int(input())
S = []
kaisuu = []
solution = []
index = 0

for i in range(N):
  tmp = input()
  
  if (tmp in S) == False:
    S.append(tmp)
    kaisuu.append(1)
    index += 1
  
  if (tmp in S) == True:
    index_tmp = S.index(tmp)
    kaisuu[index_tmp] += 1
  
max_ = max(kaisuu)

for i in range(N):
  if kaisuu[i] == max_:
    solution.append(S[i])
    
solution.sort()

for i in solution:
  print(i)

import collections

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

for i in range(N):
  tmp = input()
  S.append(tmp)
  
c = collections.Counter(S)

d = c.most_common()

max_ = d[0][1]

for i,k in enumerate(d):
  if d[i][1] == max_:
    solution.append(d[i][0])
    
solution.sort()

for i in solution:
  print(i)

Verdicts: Wrong Answer

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):
from collections import defaultdict
dic = defaultdict(int)

n = int(input())
A = [input() for i in range(n)]
# A = list(map(str, A))
# print(A)

vote = 0

for elem in A:
    dic[elem] += 1
# print(dic)
m = max(dic.values())
# print(m)

for key in dic:
    # print(dic[key])
    if dic[key] == m:
        print(key)


from collections import defaultdict
dic = defaultdict(int)

n = int(input())
A = [input() for i in range(n)]
for elem in A:
    dic[elem] += 1
# print(dic)
m = max(dic.values())
# print(m)

Ans = []
for key in dic:
    # print(dic[key])
    if dic[key] == m:
        Ans.append(key)

Ans = sorted(Ans)
print([i for i in Ans])


from collections import defaultdict
dic = defaultdict(int)

n = int(input())
A = [input() for i in range(n)]
for elem in A:
    dic[elem] += 1
# print(dic)
m = max(dic.values())
# print(m)

Ans = []
for key in dic:
    # print(dic[key])
    if dic[key] == m:
        Ans.append(key)

Ans = sorted(Ans)
for i in Ans:
    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):
N = int(input())
L = [input() for _ in range(N)]

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

max_count = 0
for i in range(N):
    max_count = max(max_count, word[L[i]])
    
ans = []
for i in range(N):
    if word[L[i]] == max_count:
        ans.append(L[i])
        
ans.sort()

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

N = int(input())
L = [input() for _ in range(N)]

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

max_count = 0
for i in range(N):
    max_count = max(max_count, word[L[i]])
    
ans = []
for i in range(N):
    if word[L[i]] == max_count:
        ans.append(L[i])
  
ans = list(set(ans))
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):
n = int(input())

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

from collections import Counter
c = Counter(s)

result = [i for i in c.items() if i[1]==max(c.values())]

for i in range(len(result)):
    print(result[i][0])

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

max_num = max(c.values())

result = [i[0] for i in c.items() if i[1]==max_num]
result.sort()
 
for i in range(len(result)):
    print(result[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 = []
s_uniq = []
max_count = 0
max_s = []

for i in range(n):
  s_n = str(input())
  s.append(s_n)
  if s_n not in s_uniq:
    s_uniq.append(s_n)

for i in s_uniq:
  if s.count(i) > max_count:
    max_count = s.count(i)
    max_s = []
    max_s.append(i)
  elif s.count(i) == max_count:
    max_s.append(i)

for i in max_s:
  print(i)

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

for i in range(n):
  s = str(input())
  if s in d.keys():
    d[s] += 1
  else:
    d[s] = 1

max_count = max(d.values())

for i in sorted(d.keys()):
  if d[i] == max_count:
    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):
# input
N = int( input() )
S = list()
for ii in range(N):
    S.append( input() )
S.sort()

# calc 
import collections
C     = collections.Counter( S )

# output      
for key in C.most_common():
    print(key[0])

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# input
N = int( input() )
S = list()
for ii in range(N):
    S.append( input() )

# calc 
from collections import Counter
 
C       = Counter( S )
max_cnt = max(C.values())

words = list()
for word, cnt in C.items():
    if cnt == max_cnt:
        words.append(word)
words.sort()

print(*words, 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 sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
S = read().split()

S = sorted(S)
ls = [[] for i in range(N + 1)]
max_num = 0
left = 0
right = 0
while right < N:
    while right < N and S[left] == S[right]:
        right += 1
    if (right  - left) >= max_num:
        ls[right - left].append(S[left])
        max_num = right - left
    left = right
    
print('\n'.join(ls[max_num]))

n = input()
s = [input() for i in range(n)]
u = set(s)
dic = dict(zip(u, [0]*len(u)))
for i in range(n):
    dic[s[i]] += 1
m = max(dic.values())
res = []
for k, v in dic.items():
    if v == m:
        res.appned(k)
res.sort()
print(*res, sep="\n")

n = int(input())
s = [input() for i in range(n)]
u = set(s)
dic = dict(zip(u, [0]*len(u)))
for i in range(n):
    dic[s[i]] += 1
m = max(dic.values())
res = []
for k, v in dic.items():
    if v == m:
        res.append(k)
res.sort()
print(*res, sep="\n")

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())
d = {}
for _ in range(n):
    s = input()
    if not s in d:
        d[s] = 1
    else:
        d[s] += 1
d_max = max(d.values())
ans = [k for k, v in d.items() if v == d_max]
for a in ans:
    print (a)

n = int(input())
d = {}
for _ in range(n):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
d_max = max(d.values())
ans = [k for k, v in d.items() if v == d_max]
for a in sorted(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):
from collections import defaultdict
n = int(input())

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

dict = sorted(d.items(), key=lambda x:x[1], reverse=True)
max_v = max(d.values())

dict_li = []
for a in dict:
    if a[1]==max_v:
        dict_li.append(a[0])
    else:
        exit()

dict_li.sort()
for s in dict_li:
    print(s)


from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
cnt = Counter(s)
max_v = max(cnt.values())
ans = [s for s,c in cnt.items() if c==max_v]
ans.sort()
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):

N = int(input())

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

ans = {}
for cnt in S:
  if cnt in ans:
    ans[cnt] += 1
  else:
  	ans[cnt] = 1

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


N = int(input())

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

ans = {}
for cnt in S:
  if cnt in ans:
    ans[cnt] += 1
  else:
  	ans[cnt] = 1
max_v = max(ans.values())

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

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())
q={}
for i in range(N):
  S=input()
  if S in q:
    q[S]+=1
  else:
    q[S]=1
max_q_list = [kv[0] for kv in q.items() if kv[1] == max(q.values())]    
for i in max_q_list:
  print(i)

N=int(input())
from collections import Counter
A=[]
for i in range(N):
  s=input()
  A.append(s)
a=Counter(A).most_common()
b=a[0][1]
ans=[]
for i in range(len(a)):
  if a[i][1]==b:
    ans.append(a[i][0])
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())
l = [input() for _ in range(N)]
m = set(l)
d = dict()

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

#!/usr/bin/env python3
from collections import Counter

def solve(l):
    d = Counter(l)
    d_max = max(d.values())
    max_d_list = sorted([k[0] for k in d.items() if k[1] == d_max])
    return max_d_list



def main():
    N = int(input())
    l = [input() for _ in range(N)]
    d = solve(l)
    for a in d:
        print(a)
    return

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=[]
for _ in range(n):
  s.append(input())
import collections
d=collections.Counter(s)
largest=max(list(d.values()))
ans=[]
for key in d.keys():
  if d[key]==largest:
    ans.append(key)
ans.sort()
while len(ans)>0:
  print(ans.popleft(-1))
  
  


n=int(input())
s=[]
for _ in range(n):
  s.append(input())
import collections 
d=collections.Counter(s)
larger=max(list(d.values()))
ans=[]
for key in d.keys():
  if d[key]==larger:
    ans.append(key)
ans.sort()
for _ in range(len(ans)):
  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 as col


n=int(input())
s=[input() for i in range(n)]
c = col.Counter(s)
max = max(c.values())
ans = []

for key,val in c.items():
    if val == max:
       ans.append(key)


for i in ans:
    print(i)

    



import collections as col


n=int(input())
s=[input() for i in range(n)]
c = col.Counter(s)
max = max(c.values())
ans = []

for key,val in c.items():
    if val == max:
       ans.append(key)

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())
d = {}
for _ in range(n) :
    s = input()
    if s in d :
        d[s] += 1
    else :
        d[s] = 1

mx = max(d.values())
for s in sorted(k for k in d if d[k] == m) :
    print(s)


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

mx = max(d.values())
for s in sorted(k for k in d if d[k] == mx) :
    print(s)


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 = []
for _ in range(n):
    S.append(input())

d = {}
for s in S:
  if s in d:
    d[s] += 1
  else:
    d[s] = 1
    
ans = 0
for i in d:
  if ans < d[i]:
    ans = d[i]

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

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

d = {}
for s in S:
  if s in d:
    d[s] += 1
  else:
    d[s] = 1

ans = 0
for i in d.values():
  if ans < i:
    ans = i

for k, v in d.items():
  if ans == v:
    print(k)

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

d = {}
for s in S:
  if s in d:
    d[s] += 1
  else:
    d[s] = 1

ans = 0
for i in d.values():
  if ans < i:
    ans = i

sor = sorted(d.keys())
for k, v in sor.items():
  if ans == v:
    print(k)

N = int(input())
dic = {}

for i in range(N):
  S = input()
  if S in dic:
    dic[S] += 1
  else:
    dic[S] = 1
    
max_N = max(list(dic.values()))
keys = sorted([k for k, v in dic.items() if v == max_N])

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

Verdicts: Wrong Answer

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):
from sys import stdin, stdout
from collections import defaultdict
n = int(stdin.readline().strip())
word_map = defaultdict(lambda: 0)
maxi = 0
for i in range(n):
  word = stding.readline().strip()
  x = word_map[word]
  word_map[word] = x + 1
  maxi = max(maxi, x+1)
  
word_list = []
for key, value in word_map.items():
  if value == maxi:
    word_list.append(key)
word_list.sort()
for word in word_list:
  stdout.write(word+'\n')
  

from sys import stdin, stdout
from collections import defaultdict
n = int(stdin.readline().strip())
word_map = defaultdict(lambda: 0)
maxi = 0
for i in range(n):
  word = stdin.readline().strip()
  x = word_map[word]
  word_map[word] = x + 1
  maxi = max(maxi, x+1)
  
word_list = []
for key, value in word_map.items():
  if value == maxi:
    word_list.append(key)
word_list.sort()
for word in word_list:
  stdout.write(word+'\n')

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

for _ in range(N):
    S.append(input())
S_set = set(S)
S_dict = dict()
for s in S_set:
    S_dict[s] = 0

for val in S:
    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)
sorted(ans)
for res in ans:
    for _ in range(max_num):
        print(res)


N = int(input())
S = list()

for _ in range(N):
    S.append(input())
S_set = set(S)
S_dict = dict()
for s in S_set:
    S_dict[s] = 0

for val in S:
    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):
from sys import stdin

n = int(stdin.readline().rstrip())
s = []
d = [0] * 200000 
max = 1

for i in range(n):
    t = stdin.readline().rstrip()
    d[i] = 1
    for ss in s:
        if t == ss:
            d[i] = d[i] + 1
            if max < d[i]:
                max = d[i]
    s.append(t)

result = []        
for cnt in range(len(d)):
    if d[cnt] == max:
        result.append(s[cnt])

print(sorted(result))

from sys import stdin
import math

n = int(stdin.readline().rstrip())

d = {}
max = 0
for i in range(n):
    s = stdin.readline().rstrip()
    if s in d.keys():
        d[s] += 1
    else:
        d[s] = 1
    if max < d[s]:
        max = d[s]

result = []
for key, value in d.items():
    if value == max:
        result.append(key)

result.sort()

for i in range(len(result)):
    print(result[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 numpy as np
def f(n, a):
    index, count = np.unique(a, return_counts=True)
    mx = max(count)
    for s in index[count == mx]:
        print(s)
    print(mx)

n = int(input())
a = [0] * n
for i in range(n):
    a[i] = input()
f(n, a)


import numpy as np
def f(n, a):
    index, count = np.unique(a, return_counts=True)
    mx = max(count)
    for s in index[count == mx]:
        print(s)
    print(mx)

n = int(input())
a = [0] * n
for i in range(n):
    a[i] = input()
f(n, a)


# ABC155C ref. ABC008B

d = {}
max_value = 1
n = int(input())
for i in range(n):
    t = input()
    if t in d.keys():
        d[t] += 1
        if d[t] > max_value:
            max_value = d[t]
    else:
        d.setdefault(t, 1)
#print(f"d = {d}")
#print(f"max_value = {max_value}")
#print(f"d.keys() = {d.keys()}")
#print(f"d.values() = {d.values()}")
d = sorted(d.items())
#print(d)
for k, v in d:
    if v == max_value:
        print(k)


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 = input()
words_org = []
for i in range(int(n)):
  words_org.append(input())
print(words_org)

countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1], reverse=True)
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
  if order > len(ranking)-1:
    break
for word in sorted(candidates):
  print(word)

n = input()
words_org = []
for i in range(n):
  words_org.append(input())
countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1])
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
for word in sorted(candidates):
  print(word)

N = input()
dic = {}
max = 0
for i in range(int(N)):
  word = input()
  if word not in dic.keys():
    
    if max == 0:
      max += 1
    dic['word'] = 1
    
  else:
    
    if max == dic['word']:
      max += 1
    dic['word'] += 1
    
candidates = sorted([word for word in dic.keys() if dic[key] == max])
for word in candidates:
  print(word)

n = input()
words_org = []
for i in range(int(n)):
  words_org.append(input())
print(words_org)

countDic = { k: words_org.count(k) for k in set(words_org) }
ranking = sorted([item for item in countDic.items()], key = lambda x:x[1], reverse=True)
order = 0
top = ranking[0][1]
candidates = []
while ranking[order][1] == top:
  candidates.append(ranking[order][0])
  order += 1
for word in sorted(candidates):
  print(word)

N = input()
dic = {}
max = 0
for i in range(int(N)):
  word = input()
  if word not in dic.keys():
    
    if max == 0:
      max += 1
    dic[word] = 1
    
  else:
    
    if max == dic[word]:
      max += 1
    dic[word] += 1

candidates = sorted([word for word in dic.keys() if dic[word] == max])
for word in candidates:
  print(word)


Verdicts: Wrong Answer

Runtime Error

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 collections
def inverse_lookup(d, x):
    cList = []
    for k,v in d.items():
        if x == v:
            l = k
            cList.append(l) 
    return cList

n = int(input())
List=[input() for i in range(n)]
c = collections.Counter(List)
print(c)
n = max(c.values())
out=sorted(inverse_lookup(c,n))
for word in out:
    print(word)




import collections
def inverse_lookup(d, x):
    cList = []
    for k,v in d.items():
        if x == v:
            l = k
            cList.append(l) 
    return cList

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

n = max(c.values())
out=sorted(inverse_lookup(c,n))
for word in out:
    print(word)




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)]
c=collections.Counter(s)
l=c.most_common()
k=l[0][1]
for i in range(n):
    if l[i][1]==k:print(l[i][0])
    else:exit()

import collections
n=int(input())
s=[input() for _ in range(n)]
c=collections.Counter(s)
l=c.most_common()
k=l[0][1]
l1=[]
for i in range(len(l)):
    if l[i][1]==k:l1.append(l[i][0])
    else:break
l1.sort()
for i in range(len(l1)):
    print(l1[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):
from collections import OrderedDict
N=int(input())
d=dict()
ma=0
for i in range(N):
  s=input()
  if s not in d:
    d[s]=0
  d[s]+=1
d=OrderedDict(sorted(d.items(), key=lambda x:x[1], reverse=True))
for i in d:
  if ma<=i:
    ma=i
  if ma!=i:
    exit()
  print(d[i])

N=int(input())
d=dict()
A=[]
ma=0
for i in range(N):
  s=input()
  if s not in d:
    d[s]=0
  d[s]+=1
ma=max(d.values())
for i in d:
  if d[i]==ma:
    print(i)

N=int(input())
d=dict()
A=[]
ma=0
for i in range(N):
  s=input()
  if s not in d:
    d[s]=0
  d[s]+=1
ma=max(d.values())
for i,j in sorted(d.items()):
  if j==ma:
    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 collections

n = int(input())

ss = []
for _ in range(n):
  ss.append(input())

c = collections.Counter(ss)

l = c.most_common()

print(l[0][1])
for i in range(len(l)-1):
  if l[i][1] == l[i+1]:
    print(l[i+1])
  else:
    break





import collections

n = int(input())

ss = []
for _ in range(n):
  ss.append(input())

c = collections.Counter(ss)

l = c.most_common()

print(l[0][0])
for i in range(len(l)-1):
  if l[i][1] == l[i+1][1]:
    print(l[i+1][0])
  else:
    break





import collections

n = int(input())

ss = []
for _ in range(n):
  ss.append(input())

c = collections.Counter(ss)

l = c.most_common()
ans = []
ans.append(l[0][0])
for i in range(len(l)-1):
  if l[i][1] == l[i+1][1]:
    ans.append(l[i+1][0])
  else:
    break

ans.sort()

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


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())
lis=list(input() for _ in range(N))
ans=[]
high=0

counter=Counter(lis)
high=counter.most_common()[0][1]

for  j in se:
  if lis.count(j)==high:
    ans.append(j)
ans.sort()

for k in ans:
  print(k)

from collections import Counter
N=int(input())
lis=list(input() for _ in range(N))
ans=[]

counter=Counter(lis)
high=counter.most_common()[0][1]

for k,v in counter.most_common():
  if v==high:
    ans.append(k)
  else:
    break
ans.sort()
for i in ans:
  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
N = int(input())
S = list(map(str,input().split()))
collections.Counter(S)
print(max(collections.Counter(S)))


from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
CS = Counter(S)
math = 0
ans = []
for i  in CS.values():
  v = max(v,i)
for i,j in CS.items():
  if v == j:
    ans.append(i)
ans.sort
print(ans[i] for i in range(len(ans)))



rom collections import Counter
N = int(input())
S = [input() for _ in range(N)]
CS = Counter(S)
v = 0
ans = []
for i  in CS.values():
  v = max(v,i)
for i,j in CS.items():
  if v == j:
    ans.append(i)
ans.sort()
print(ans[i] for i in range(len(ans)))

rom collections import Counter
N = int(input())
S = [input() for _ in range(N)]
CS = Counter(S)
v = 0
ans = []
for i  in CS.values():
  v = max(v,i)
for i,j in CS.items():
  if v == j:
    ans.append(i)
ans.sort
print(ans[i] for i in range(len(ans)))

from collections import Counter
N = int(input())
S = [input() for _ in range(N)]
CS = Counter(S)
v = 0
ans = []
for i  in CS.values():
  v = max(v,i)
for j,k in CS.items():
  if v == k:
    ans.append(j)
ans.sort()
print(ans)

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

SC = Counter(S)
max_count = max(SC.values())

ans = []

for key,value in SC.items():
  if value == max_count:
    ans.append(key)

ans.sort()

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

Verdicts: Wrong Answer

Runtime Error

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):
from collections import *
_,*a=map(lambda x:x.rstrip(), open(0))
a=Counter(a).most_common()
a=[i[0] for i in a if i[1]==a[0][1]]
print(*a,sep="\n")

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

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

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 = []
for i in range(N):
    S.append(input())

from collections import Counter
ls = Counter(S).most_common()
MAX = ls[0][1]

for s,length in ls:
    if MAX == length:
        print(s)
    else:
        exit()


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

from collections import Counter
ls = Counter(S).most_common()
MAX = ls[0][1]
ans = []
for s,length in ls:
    if MAX == length:
        ans.append(s)
    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())
d = {}
for _ in range(N):
    S = input()
    if S in l :
        d[S] += 1
    else :
        d[S] = 1

m = max(d.values())

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


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

m = max(d.values())

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


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=[input() for i in range(N)]
s=Counter(S)
m=max(s.values())
for key,value in s.items():
    if value==m:
        print(key)

from collections import Counter
N=int(input())
S=[input() for i in range(N)]
s=Counter(S)
m=max(s.values())
s=sorted(s.items() ,key=lambda s:s[0])
for a in s:
    if a[1]==m:
        print(a[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):
x=int(input())
List=[int(input()) for i in range (x)]
sorted(List)
print(List)

x=int(input())
List=[input() for i in range (x)]
List=sorted(List)
sum=-1
count=1
ans=[]
for i in range (x-1):
    if List[i] == List[i+1]:
        count+=1
    elif sum>count:
        count=1
    elif sum==count:
        count=1
        ans+=[List[i]]
    else:
        sum=count
        count=1
        ans=[]
        ans+=[List[i]]
if sum==count:
    ans+=[List[-1]]
elif sum<count:
        sum=count
        count=1
        ans=[]
        ans+=[List[i]]
ans=sorted(ans)
for i in ans:
    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):
n = int(input())
int i = 0
List = [input() for i in range(n)]
print(sorted(List))

n = int(input())
List = [input() for i in range(n)]
print(sorted(List))


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

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

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


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())
s=[]
a=[]
count=1
ans=1
for i in range(n):
  c=input()
  s.append(c)
s=sorted(s)
print(s)
for i in range(n-1):
  if s[i]==s[i+1]:
    count+=1
  else:
    if ans<count:
      a.clear()
      a.append(s[i])
      ans=count
    elif ans==count:
      a.append(s[i])
    count=1
  
print(a)

n=int(input())
s={}
l=[]
for i in range(n):
  a=input()
  if a in s:
    s[a]+=1
  else:
    s[a]=1
    
cou=max(s.values())

for k,v in s.items():
  if v==cou:
    l.append(k)
    
ans=sorted(l)

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

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: 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):
# -*- coding: utf-8 -*-

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

d = {}
for s in S:
    d.setdefault(s, 0)
    d[s] += 1

dmax = max(d.values())

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


# -*- coding: utf-8 -*-

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

d = {}
for s in S:
    d.setdefault(s, 0)
    d[s] += 1

dmax = max(d.values())

dmax_list = [k for k, v in d.items() if v == dmax]
for d in sorted(dmax_list):
    print(d)

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 range(n):
  s = input()
  if s not in d:d[s] = 0
  d[s] += 1
max_cnt = sorted(d.items(), key=lambda tp:tp[1])[-1][1]
a1 = filter(lambda tp:tp[1] == max_cnt, d.items())
a2 = map(lambda tp:tp[0], a1)
for s in sorted(a2):
  print(s)

n = int(input())
d = {}
for i in range(n):
  s = input()
  if s not in d:d[s] = 1
  d[s] += 1
max_cnt = sorted(d.items(), key=lambda x:x[1])[-1][1]
s = [x for x, y in d.items() if y == max_cnt]
s.sort()
for name in s:
    print(name)

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 sys
sys.setrecursionlimit(10 ** 6)
MOD = 10**9+7
 

def input():
    return sys.stdin.readline()[:-1]
 

def main():
    n = int(input())
    d = dict()
    for _ in range(n):
        s = input()
        d.setdefault(s, 0)
        d[s] += 1
    d = sorted(d.items(), key=lambda x: -x[1])
    maxc = d[0][1]
    for row in d:
        if row[1]<maxc:
            break
        print(row[0])
 
if __name__ == "__main__":
    main()

import sys
sys.setrecursionlimit(10 ** 6)
MOD = 10**9+7
 

def main():
    n = int(input())
    d = dict()
    for _ in range(n):
        s = input()
        d.setdefault(s, 0)
        d[s] += 1
    d = sorted(d.items(), key=lambda x: (-x[1], x[0]))
    maxc = d[0][1]
    for row in d:
        if row[1]<maxc:
            exit()
        print(row[0])
 
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())
vote = dict()
for i in range(n):
  s = input()
  if s not in vote.keys():
    vote[s] = 0
  else:
    vote[s] += 1
vote.sort()
res = sorted(vote.values(), reverse = True)
for i in res.keys():
  print(i)

n = int(input())
vote = dict()
for i in range(n):
  s = input()
  if s not in vote.keys():
    vote[s] = 0
  else:
    vote[s] += 1

res = []
mx = max(vote.values())
for key, value in vote.items():
    if value== mx:
        res.append(key)

res = sorted(res)
for i in res:
  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):
from collections import defaultdict
n=int(input())
dic=defaultdict(int)
for _ in range(n):
    s = input()
    dic[s]+=1
L=list(dic.items())
L.sort(key=lambda x:x[0])
c=L[0][1]
for a,b in L:
    c=max(c,b)
for p in L:
    if p[1] == c:
        print(p[0])
    else:
        break


from collections import defaultdict
n=int(input())
dic=defaultdict(int)
for _ in range(n):
    s = input()
    dic[s]+=1
L=list(dic.items())
L.sort(key=lambda x:-x[1])
c = L[0][1]
for p in L:
    if p[1] == c:
        print(p[0])
    else:
        break
    

from collections import defaultdict
n=int(input())
dic=defaultdict(int)
for _ in range(n):
    s = input()
    dic[s]+=1
L=list(dic.items())
L.sort(key=lambda x:x[0])
c=L[0][1]
for a,b in L:
    c=max(c,b)
for a,b in L:
    if b == c:
        print(a)

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

A=[]
B=[]
for i in range(n):
  s=input()
  if s not in A:
    A.append(s)
    B.append(1)
  else:
    B[A.index(s)] += 1

C=[]
for i in range(len(B)):
  C.append([B[i],A[i]])

C = sorted(C,reverse=True)

for i in range(len(C)-1):
  print(str(C[i][1]))
  if C[i][0] != C[i+1][0]:
    exit()



n=int(input())
l=[]
L=[]
for _ in range(n):
  s=input()
  l.append(s)
import collections
c = collections.Counter(l)

for i in range(n):
  L.append(c.most_common()[i][0])
  if i!=n-1:
    if c.most_common()[i][1] != c.most_common()[i+1][1]:
      break
L.sort()
L=' '.join(L)
print(L)

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

c = collections.Counter(s)
m = c.most_common()[0]

ans = []
for _c in c.items():
    if _c[1] == m[1]:
        ans.append(_c[0])

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


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):
def main():
    N = int(input())
    str_dict = dict()
    for n in range(N):
        s = input()
        if s in str_dict:
            str_dict[s] += 1
        else:
            str_dict[s] = 1
    max_s = max(str_dict.values())
    for a, b in str_dict.items():
        if b == max_s:
            print(a)


if __name__ == '__main__':
    main()

def main():
    N = int(input())
    str_dict = dict()
    for n in range(N):
        s = input()
        if s in str_dict:
            str_dict[s] += 1
        else:
            str_dict[s] = 1
    max_s = max(str_dict.values())
    result_list = list()
    for a, b in str_dict.items():
        if b == max_s:
            result_list.append(a)
    result_list.sort()
    for r in result_list:
        print(r)


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())
dic = {}
for i in range(n):
  s = input()
  if s not in dic: dic[s] = 1
  else: dic[s] += 1
v = dic.values()
v = sorted(v)
max_num = v[n-1]
ans = []
for s in dic:
  if dic[s]==max_num:
    ans.append(s)
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i])


n = int(input())
dic = {}
for i in range(n):
  s = input()
  if s not in dic: dic[s] = 1
  else: dic[s] += 1
v = dic.values()
v = sorted(v)
max_num = v[len(v)-1]
ans = []
for s in dic:
  if dic[s]==max_num:
    ans.append(s)
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[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):
from collections import Counter
n=int(input())

lst=[input() for _ in range(n)]
p=Counter(lst)
pp=list(Counter(p).values()).count(max(p.values()))
for i in range(pp):
    print(p.most_common()[i][0])
                                

n=int(input())

dic={}
for i in range(n):
    s=input()
    if s not in dic:
        dic[s]=1
    else:
        dic[s]+=1
dic2=sorted(dic.items(), key=lambda x:x[1],reverse=True)
ma=dic2[0][1]

keys=sorted([k for k,v in dic.items() if v==ma])
for i in keys:
    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):
from collections import defaultdict
N = int(input())
S = [input() for _ in range(N)]
d = defaultdict(int)
maxn = 0

for i in range(N):
    d[S[i]] += 1
    maxn = max(maxn, d[S[i]])

for k, v in d.items():
    if v == maxn:
        print(k)


from collections import defaultdict
N = int(input())
S = [input() for _ in range(N)]
d = defaultdict(int)
maxn = 0

for i in range(N):
    d[S[i]] += 1
    maxn = max(maxn, d[S[i]])

ans = []
for k, v in d.items():
    if v == maxn:
        ans.append(k)
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):
n = int(input())
s = [input() for i in range(n)]
import collections

counted = collections.Counter(s)

m = max(counted.values())

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

print(sorted(chars))


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

counted = collections.Counter(s)

m = max(counted.values())

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

for i in range(len(chars)):
    print(chars[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):
# -*- coding: utf-8 -*-

n = int(input())
sl = list(input() for _ in range(n))
sl.sort()
sl_set = set(sl)

m = 0
l = []
for s in sl_set:
    a = sl.count(s)
    m = max(m, a)
    l.append(a)

for i, s in enumerate(sl_set):
    if l[i] == m:
        print(s)

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

n = int(input())
sl = list(input() for _ in range(n))
sl_dct = Counter(sl)
m = 0
for i in sl_dct.values():
    m = max(m,i)

sl_s =  list(set(sl))
sl_s.sort()
for i in sl_s:
    if sl_dct[i] == m:
        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 = [int(input()) for i in range(n)]

l = [s.count(i) for i in s]
d = {i:j for i,j in zip(s, l)}
m = max(l)

d = {i:j for i, j in zip(s, l)}
ans = [i for i in d if d[i] == m]
sorted(ans)

for i in ans:
    print(i)

from collections import Counter

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

d = Counter(s)
m = max(d.values())
ans = [i for i in d if d[i] == m]
ans = sorted(ans)

for i in ans:
    print(i)

Verdicts: Runtime Error

Accepted