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):
box={}
n=int(input())
for i in range(n):
    v=input()
    if v in box:
        box[v]+=1
    else:
        box[v]=1
m=max(box.values())
f=[k for k,v in box.items() if v==m]
print('\n'.join(f))

box={}
n=int(input())
for i in range(n):
    v=input()
    if v in box:
        box[v]+=1
    else:
        box[v]=1
m=max(box.values())
f=[k for k,v in box.items() if v==m]
f.sort()
print('\n'.join(f))

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
n=int(input())
s=Counter([input()for _ in[0]*n])
m=s.most_common(1)[0][1]
r=(k for k,v in s.items() if v==m)
for a in r:print(a)

from collections import Counter
n=int(input())
s=Counter([input()for _ in[0]*n])
m=s.most_common(1)[0][1]
r=sorted((k for k,v in s.items() if v==m))
for a in r: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
import itertools
n = int(input())
s = list(input() for i in range(n))
s.sort()
counter = collections.Counter(s)

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

import collections
n = int(input())
s = list(input() for i in range(n))
counted = collections.Counter(s)

m = max(counted.values())
chars = [key for key, value in counted.items()
             if value == m]
chars.sort()
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):
from collections import Counter


def words_sort_ordered(words_list):
    cnt = Counter()
    for word in words_list:
        cnt[word] += 1

    written_words_number = []
    for x in cnt.values():
        written_words_number.append(x)

    answer_words_list = []

    for word, number in dict(cnt).items():
        if number == max(written_words_number):
            answer_words_list.append(word)

    return sorted(answer_words_list)


if __name__ == '__main__':
    words_num = int(input())
    words_list = [input() for i in range(words_num)]
    print(words_sort_ordered(words_list))

from collections import Counter


def words_sort_ordered(words_list):
    word_cnt = Counter()
    for word in words_list:
        word_cnt[word] += 1

    word_written_max_time = 0
    for each_word_ct in word_cnt.values():
        if each_word_ct > word_written_max_time:
            word_written_max_time = each_word_ct

    answer_words_list = []
    for word, number in dict(word_cnt).items():
        if number == word_written_max_time:
            answer_words_list.append(word)

    return sorted(answer_words_list)


if __name__ == '__main__':
    words_num = int(input())
    words_list = [input() for i in range(words_num)]
    for w in words_sort_ordered(words_list):
        print(w)


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 _ in range(n)]
count = 0
for i in range(n-1):
  for j in range(n-1-i):
    if S[i] == S[j]:
      count += 1
print(count)

from collections import Counter
N = int(input())
A = [None for i in range(N)]
for i in range(N):
  A[i] = input()
A = Counter(A)
keyA = list(A.keys())
valuesA = list(A.values())
most = max(valuesA)

ans = [None for _ in range(N)]
for i in range(len(valuesA)):
  if valuesA[i] == most:
    ans[i] = keyA[i]
ans = [a for a in ans if type(a) == str]
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 collections
N = int(input())
S = [input() for n in range(N)]

cnt = collections.Counter(S)
m = max(cnt.values())

for k, v in dict(sorted(cnt.items())):
    if v == m:
        print(k)

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

cnt = collections.Counter(S)
m = max(cnt.values())

ans = []
for k, v in cnt.items():
    if v == m:
        ans.append(k)
        
ans.sort()
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())
S = []
for _ in range(n):
    S.append(input())

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

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

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


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

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

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

moji.sort(reverse=True)
maxc = moji[0][0]
x = []
for j in moji:
    if j[0] < maxc: break
    x.append(j[1])
x.sort()
for j in x:
    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):
import collections
N = int(input())
S_list = []
for i in range(N):
  S_list.append(input())

c = collections.Counter(S_list)

words = []
counter = 0


while(True):
  words.append(c.most_common()[counter][0])
  try:
    if c.most_common()[counter][1] == c.most_common()[counter+1][1]:
      counter += 1
    else:
      break
  except:
    break

words = sorted(words)
print("--")
for j in range(len(words)):
  print(words[j])

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

c = collections.Counter(S_list)

d = c.most_common() 

keys = [k for k, v in c.items() if v == d[0][1]]

keys = sorted(keys)

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):
n = int(input())
counts = {}
best = 0
best_words = []
for idx in range(n):
    string = input()
    if counts.get(string) is None: counts[string] = 1
    else: counts[string] += 1

    score = counts[string]

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

for string in best_words:
    print(string)

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

    score = counts[string]

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

for string in sorted(best_words):
    print(string)

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 _ in range(n)]
s.sort()

count = {}
for s_i in s:
    if not s_i in count:
        count[s_i] = 0
    count[s_i] += 1
res = sorted(zip(count.keys(), count.values()),
             key=lambda x: x[1], reverse=True)

num = res[0][1]
res2 = []
for res_i in res:
    if res_i[1] != num:
        exit(0)
    res2.append(res_i[0])

res2.sort()
for res2_i in res2:
    print(res2_i)


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

count = {}
for s_i in s:
    if not s_i in count:
        count[s_i] = 0
    count[s_i] += 1
res = sorted(zip(count.keys(), count.values()),
             key=lambda x: x[1], reverse=True)

num = res[0][1]
res2 = []
for res_i in res:
    if res_i[1] != num:
        break
    res2.append(res_i[0])

res2.sort()
for res2_i in res2:
    print(res2_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=[]
c=[]
for i in range(N):
  tmp=input()
  if not (tmp in S):
    S.append(tmp)
    c.append(1)
  else:
    c[S.index(tmp)]+=1
m=max(c)
for i in range(len(S)):
  if c[i]==m:
    print(S[i])

import collections
N=int(input())
S=[input() for i in range(N)]
c=collections.Counter(S)
if len(c.most_common())==1:
  print(c.most_common()[0][0])
else:
  for i in range(len(c.most_common())):
    print(c.most_common()[i][0])
    if c.most_common()[i][1] !=c.most_common()[i+1][1]:
      break

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

import collections
N=int(input())
S=[input() for i in range(N)]
c=collections.Counter(S)
most=c.most_common()[0][1]
if len(c)==1:
  print(c.most_common()[0][0])
else:
  for i in range(len(c)):
    print(c.most_common()[i][0])
    if c.most_common()[i+1][1] !=most:
      break


import collections
N=int(input())
S=[input() for i in range(N)]
c=collections.Counter(S)
most=c.most_comon()[0][1]
if len(c)==1:
  print(c.most_common()[0][0])
else:
  for i in range(len(c)):
    print(c.most_common()[i][0])
    if c.most_common()[i+1][1] !=most:
      break


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

import collections
N=int(input())
S=[input() for i in range(N)]
c=collections.Counter(S)
for i in range(len(c.most_common())):
  print(c.most_common()[i][0])
  if c.most_common()[i][1] !=c.most_common()[i+1][1]:
    break

import collections
N = int(input())
s = [input() for i in range(N)]
 
counter = collections.Counter(s)
count = counter.most_common()
 
most = count[0][1]
 
c =[]
for i in range(len(counter)):
    if count[i][1] == most:
        c.append(count[i][0])
 
c.sort()
 
for i in range(len(c)):
    print(c[i])

Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

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

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


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

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

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

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

ans = sorted(ans)

for a in ans:
  print(a)

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

c = collections.Counter(s)
values, counts = zip(*c.most_common())

for i in range(counts.count(max(counts))):
	print(values[i])

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

c = collections.Counter(s)
values, counts = zip(*c.most_common())

ss = []
for i in range(counts.count(max(counts))):
	ss.append(values[i])

ss.sort()

for sss in ss:
	print(sss)

Verdicts: Wrong Answer

Accepted
Problem: We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it.  Print all strings that are written on the most number of votes, in lexicographical order.

Submission attempts (in order):
N = int(input())
A = []
for n in range(N):
    A.append(input())
A.sort()
B = []
for n in range(N):
    C = 0
    for i in range(N):
        if A[n] == A[i]:
            C += 1
    B.append(C)
m = max(B)
D = []
for i in range(N):
    if m <= B[i]:
        D.append(A[i])
D = list(set(D))
for i in range(len(D)):
    print(D[i])

N = int(input())
A = {}
B = []
for n in range(N):
    a = input()
    B.append(a)
    A[a] = 0
for n in range(N):
    A[B[n]] += 1
res = 0
C = []
for key, value in A.items():
    if res < value:
        res = value
for key, value, in A.items():
    if res <= value:
        C.append(key)
C.sort()
for c in C:
    print(c)

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())
l = []
for _ in range(n):
    ll = input()
    l.append(ll)
    
ss = set(l)
s = list(ss)

ans = []
for i in range(len(s)):
    cnt = l.count(s[i])
    ans.append(cnt)
    
m = max(ans)
res = []
for j in range(len(ans)):
    if ans[j] == m:
        res.append(l[j])
        
res.sort()
for k in range(len(res)):
    print(res[k])

n = int(input())
l = []
for _ in range(n):
    ll = input()
    l.append(ll)
    
ss = set(l)
s = list(ss)

ans = []
for i in range(len(s)):
    cnt = l.count(s[i])
    ans.append(cnt)
    
m = max(ans)
res = []
for j in range(len(ans)):
    if ans[j] == m:
        res.append(l[j])
        
res.sort()
for k in range(len(res)):
    print(res[k])

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

Verdicts: 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):
[print(n) for n in max_name] [print(n) for n in max_name] n = int(input())
name = {}
for _ in range(n):
    st = str(input())
    if st in name:
        tmp = name[st] + 1
        name[st] = tmp
    else:
        name[st] = 1

max_val = max(name.values())
max_name = [k for k, v in name.items() if v==max_val]
max_name.sort
for n in max_name:
    print(n)

n = int(input())
name = {}
for i in range(n):
    st = str(input())
    if st in name:
        tmp = name[st] + 1
        name[st] = tmp
    else:
        name[st] = 1

max_val = max(name.values())
max_name = [k for k, v in name.items() if v==max_val]
max_name.sort

for n in max_name:
    print(n)

n = int(input())
name = {}
for _ in range(n):
    st = str(input())
    if st in name:
        tmp = name[st] + 1
        name[st] = tmp
    else:
        name[st] = 1

max_val = max(name.values())
max_name = [k for k, v in name.items() if v==max_val]
max_name.sort

[print(n) for n in max_name] 

n = int(input())
name = {}
for i in range(n):
    st = str(input())
    if st in name:
        tmp = name[st] + 1
        name[st] = tmp
    else:
        name[st] = 1

max_val = max(name.values())
max_name = [k for k, v in name.items() if v==max_val]
max_name.sort

for n in max_name:
    print(n)

n = int(input())
name = {}
for i in range(n):
    st = str(input())
    if st in name:
        tmp = name[st] + 1
        name[st] = tmp
    else:
        name[st] = 1

max_val = max(name.values())
max_name = [k for k, v in name.items() if v==max_val]
max_name = sorted(max_name)

for n in max_name:
    print(n)

Verdicts: 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 = collections.Counter(s).most_common() 


#[('vet', 2), ('beet', 2), ('beat', 1), ('bed', 1), ('bet', 1)]
 
ans = []
max = c[0][1] 
for item,count in c:
	if count==max:
		ans.append(item)
	else:
		break 
 
ans.sort() 
 
for i in range(len(ans)):
	print(ans[i])

from collections import Counter


n = int(input())
s = [input() for _ in range(n)]
c = Counter(s).most_common()  


# [('vet', 2), ('beet', 2), ('beat', 1), ('bed', 1), ('bet', 1)]

ans = []
max = c[0][1]  
for item, count in c:
	if count == max:
		ans.append(item)
	else:
		break  

ans.sort()  

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):
n = int(input())
S = []
for i in range(n):
  S.append(input())
T = list(set(S))
for i in range(len(T)):
  count.append(S.count(T[i]))
best = max(count)
ans = []
for i in range(len(T)):
  if count[i] == best:
    ans.append( T[i])
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i]) 

from collections import Counter
n = int(input())
S = []
for i in range(n):
  S.append(input())
S = sorted(S)
c = Counter(S)
X = c.most_common()
A = []
for i in range(len(X)):
  if X[0][1] == X[i][1]:
    A.append(X[i][0])
  else:
    break
A = sorted(A)
for i in range(len(A)):
  print(A[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())

S = {}

A = [""]*N
for i in range(0, N):
    A[i] = A[i] + input()

for i in range(0, N):
    if not (A[i] in S.keys()):
        S[A[i]] = 1
    else:
        S[A[i]] = S[A[i]] + 1

max = 0
for value in S.values():
    if value > max:
        max = value

S0 = {}
for key, value in S.items():
    if value == max:
        S0[key] = 0

for key in S0.keys():
    print(key)

from collections import Counter
N = int(input())
S = [input() for i in range(N)]
C = Counter(S)
dekai = max(C.values())
M = [kv[0] for kv in C.items() if kv[1] == dekai]
M.sort()
A = '\n'.join(M)
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_list = list(input() for i in range(1,n+1))

from collections import Counter

c = Counter(s_list)
max = max(list(c.values()))

list = []
for kv in c.items():
    if kv[1]== max:
        list.append(kv[0])

list_new = '\n'.join(list)

print(list_new)
        

        




n =int(input())
s_list = list(input() for i in range(1,n+1))

from collections import Counter

c = Counter(s_list)
max = max(list(c.values()))

list = []
for kv in c.items():
    if kv[1]== max:
        list.append(kv[0])


list.sort()
list_new = '\n'.join(list)

print(list_new)
        

        




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 itertools import Counter
n = int(input())
lst = [0]*n
for i in range(n):
    s = input()
    lst[i] = s

c = Counter(lst)
max_num = max(c.values())
most_lst = sorted([k for k, v in c.items() if v == max_num])
for x in most_lst:
    print(x)

from collections import Counter
n = int(input())
lst = [0]*n
for i in range(n):
    s = input()
    lst[i] = s

c = Counter(lst)
max_num = max(c.values())
most_lst = sorted([k for k, v in c.items() if v == max_num])
for x in most_lst:
    print(x)

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 numpy as np
N = int(input())
S = [input() for __ in range(N)]

S = np.array(S)
keys = set(S)
ans = {}
cnt = 0
ls = []
for key in keys:
    ans[key] = len(np.where(S == key)[0])

max_v = max(ans.values())
keys = [k for k, v in d.items() if v == max_v]
keys.sort()
for key in keys:
    print(key)

N = int(input())
d = {}
for i in range(N):
    S = input()
    if S in d.keys():
        d[S] = d[S] + 1
    else:
        d[S] = 1
max_val = max(d.values())
max_k_ls = [kv[0] for kv in d.items() if kv[1]==max_val]
max_k_ls = sorted(max_k_ls)

print(*max_k_ls, sep="\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):
import collections
N=int(input())
S=[]
for i in range(N):
  s=str(input())
  S +=[s]
T=collections.Counter(S)
P=list(T.keys())
Q=list(T.values())
for i in range(len(P)):
  if Q[i]==max(Q):
    print(P[i])

import collections
N=int(input())
S=[]
for i in range(N):
  s=str(input())
  S +=[s]
T=collections.Counter(S)
answer=T.most_common()
for i in range(len(T)):
  if answer[i][1]==answer[0][1]:
    print(answer[i][0])
  else:
    break

import collections
N=int(input())
S=[]
for i in range(N):
  s=str(input())
  S +=[s]
T=collections.Counter(S)
answer=T.most_common()
A=[]
for i in range(len(T)):
  if answer[i][1]==answer[0][1]:
    A +=[answer[i][0]]
  else:
    break
A=sorted(A)
for a in A:
  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):
import collections
n = int(input())
s = collections.Counter([input() for i in range(n)])

values, counts = zip(*s.most_common())

len = counts.count(max(counts))

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


n = int(input())
s = sorted([input() for i in range(n)])
c = [1]*n

for i in range(n-1):
    if s[i] == s[i+1]:
        c[i+1] += c[i]
m = max(c)

for i in range(n):
    if c[i] == m:
        print(s[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 i in range(0,n):
  c = input()
  if c in d:
    d[c] +=1
  else:
    d[c] = 1
max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
for i in range(0,len(max_k_list)):
  print(max_k_list[i])

q=int(input())
dic={}
for i in range(q):
    s=input()
    if not s in dic:
        dic[s]=1
    else:
        dic[s]+=1
max_val=max(dic.values())
a=sorted([i for i, k in dic.items() if k == max_val])
for i in a:
    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 i in range(N):
  S = input()
  if S in D:
    D[S] += 1
  else:
    D[S] = 1

D_sorted = sorted(D.items(), key=lambda x:x[0])
D_sorted = sorted(D_sorted, key=lambda x:x[1], reverse=True)
for k in D_sorted:
  print(k[0])


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

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

top = D_sorted[0][1]
for k in D_sorted:
  if top == k[1]:
    print(k[0])
  else:
    exit()


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)
c.sort()
values, counts = zip(*c.most_common())
if len(values) == 1:
    print(values[0])
else:
    for i in range(N):
        if counts[i] == counts[0]:
            print(values[i])
        else:
            exit()

import collections
import sys

N = int(input())
S = [input() for _ in range(N)]
S.sort()
c = collections.Counter(S)
values, counts = zip(c.most_common())
if len(values) == 1:
    print(values[0])
else:
    for i in range(N):
        if counts[i] == counts[0]:
            print(values[i])
        else:
            sys.exit()

import collections

N = int(input())
S = [input() for _ in range(N)]
c = collections.Counter(S)
c.most_common().sort()
values, counts = zip(*c.most_common())
if len(values) == 1:
    print(values[0])
else:
    for i in range(N):
        if counts[i] == counts[0]:
            print(values[i])
        else:
            exit()

import collections

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

c = collections.Counter(S)
value_and_counts = c.most_common()

max_number = value_and_counts[0][1]

value_and_counts.sort()

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

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it.  Print all strings that are written on the most number of votes, in lexicographical order.

Submission attempts (in order):
N = int(input())
S = {}
for i in range(N):
    s = input()
    if s in S:
        S[s] += 1
    else:
        S[s] = 1
sorted_S = sorted(S.items(), key=lambda x: x[1], reverse=True)
a = []
count = -1
for s in sorted_S:
    if count == -1:
        a.append(s)
        count = sorted_S[s]
    elif count == sorted_S[s]:
        a.append(s)
    else:
        break
sorted_a = sorted(a)
for s in sorted_a:
    print(s)

N = int(input())
S = {}
for i in range(N):
    s = input()
    if s in S:
        S[s] += 1
    else:
        S[s] = 1
sorted_S = sorted(S.items(), key=lambda x: x[1], reverse=True)
a = []
count = -1
for s in sorted_S:
    if count == -1:
        a.append(s[0])
        count = s[1]
    elif count == s[1]:
        a.append(s[0])
    else:
        break
sorted_a = sorted(a)
for s in sorted_a:
    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 = [input() for i in range(n)]
s.sort()
from collections import Counter
s1 = collections.Counter(s)
s2 = list(set(s))
s2.sort()
for i in range(len(s2)):
    if s1[s2[i]] == max(s1.values()):
        print(s2[i])

n = int(input())
s = [input() for i in range(n)]
from collections import Counter
s1 = Counter(s)
max_s = max(s1.values())
ans = []
for k,v in s1.items(): 
    if v == max_s:
        ans.append(k)
ans.sort()
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):
from collections import Counter

n =int(input())
slist = []
for _ in range(n):
  s = input()
  slist.appemd(s)

Counter(slist)

from collections import defaultdict

n =int(input())

d = defaultdict(int)

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

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

max_val = 0
maxes = []
for r in result:
    if max_val > r[1]:
        break
    else:
        max_val = r[1]
        maxes.append(r[0])

print(sorted(maxes))


from collections import defaultdict

n =int(input())

d = defaultdict(int)

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

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

max_val = 0
maxes = []
for r in result:
    if max_val > r[1]:
        break
    else:
        max_val = r[1]
        maxes.append(r[0])

print("\n".join(sorted(maxes)))


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

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

dic = {}

for i in A:
        if i not in dic:
                dic[i] = 1
        else:
                dic[i] += 1

de = 0

ans_list = []


for k, v in sorted(dic.items(), key=lambda x: x[1], reverse = True):
        if v != de and de !=0:
                exit()
        else:
                ans_list.append(k)
        de = v

ans_list_n = sorted(ans_list)

for i in ans_list_n:
        print(i)

N = int(input())

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

dic = {}

for i in A:
        if i not in dic:
                dic[i] = 1
        else:
                dic[i] += 1

de = 0



for k, v in sorted(dic.items(), key=lambda x: x[1], reverse = True):
        if v != de and de !=0:
                exit()
        else:
                print(k)
        de = v

import sys
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]

from collections import defaultdict 
'''
N = ii()
A = li()
 
right = 1
cnt = 0
'''
'''
mae = A[0]
for left in range(N):
    if left==right:
        right += 1
    mae = A[right-1]
    while right < N and A[right] > mae:
        mae = A[right]
        right += 1
    
    #print(left, right, mae)
    cnt += right-left
'''
'''
for left in range(N):
    while right < N and A[right] > A[right-1]:
        right += 1
 
    cnt += right-left
    if left+1 == right:
        right += 1
 
print(cnt)
'''

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

for word in S:
    d[word] += 1


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

num = d2[0][1]
ans = []
for i in range(len(d2)):
    if num != d2[i][1]:
        break
    ans.append(d2[i][0])

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

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())
m = max(S.count(S[i]), for i in range(N))
S_new = set(S)
for s in S_new:
  if m == S.count(s):
    print(s)
  

import collections
N = int(input())
S = []
for i in range(N):
  S.append(str(input()))
A = collections.Counter(S)
m = max(A.values())
for s in sorted(set(S)):
  if A[s] == 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):
N = int(input())
s = [0] * N
time = [1] * N
j = 0
for i in range(N):
  inp = str(input())
  if inp in s:
    x = s.index(inp)
    time[x] += 1
  else:
    s[j] = inp
    j += 1
    
ans = max(time)
#print(s, time)
for i in range(N):
  if time[i] == ans:
    if s[i] != 0:
      print(s[i])

import collections
N = int(input())
s = [0] * N
for i in range(N):
  s[i] = str(input())
  
t = collections.Counter(s)
u = list(t.items())
x = u[0][1]
ans = []
for i in range(len(u)):
  if u[i][1] == x:
    ans.append(u[i][0])
  else:
    quit()
ans = sorted(ans)

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

import collections
N = int(input())
s = [0] * N
for i in range(N):
  s[i] = str(input())
  
#print(s)
t = collections.Counter(s)
#print(t)
u = list(t.items())
#print(u)
x = u[0][1]
ans = []
for i in range(len(u)):
  if u[i][1] == x:
    ans.append(u[i][0])
    
ans = sorted(ans)

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

import collections
N = int(input())
s = [0] * N
for i in range(N):
  s[i] = str(input())
  
#print(s)
t = collections.Counter(s)
u = list(t.items())
#print(u)
x = max(list(t.values()))
ans = []
#print(x)
#print(u)
for i in range(len(u)):
  #print(u[i][1], x)
  if u[i][1] == x:
    ans.append(u[i][0])
    
    
ans = sorted(ans)

for i in range(len(ans)):
  print(ans[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())
KnL=[]
VnL=[]

for _ in range(N):
  inp=str(input())
  if not inp in KnL:
    KnL.append(inp)
    VnL.append([0,inp])
  VnL[KnL.index(inp)][0]+=1

VnL.sort()
VnL.reverse()

for i in range(len(VnL)):
  if VnL[0][0]>VnL[i][0]:
    exit()
  print(VnL[i][1])

import collections
N=int(input())
L=[]
NL=[]
cL={}
for _ in range(N):
  L.append(str(input()))

cL=collections.Counter(L)
v,c=zip(*cL.most_common())

for i in range(len(v)):
           if c[0]==c[i]:
           	NL.append(v[i])
NL.sort()
for j in range(len(NL)):
           print(NL[j])

Verdicts: Wrong Answer

Accepted
Problem: We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it.  Print all strings that are written on the most number of votes, in lexicographical order.

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

dic = {}
ma = 1

for i in range(n):
    wo = input()
    if(wo in dic):
        dic[wo] += 1
        if(dic[wo] > ma):
            ma = dic[wo]
    else:
        dic.update({wo:1})


for i in dic.keys():
    if(dic[i] == ma):
        print(i)


n = int(input())

dic = {}
ma = 1

for i in range(n):
    wo = input()
    if(wo in dic):
        dic[wo] += 1
        if(dic[wo] > ma):
            ma = dic[wo]
    else:
        dic.update({wo:1})

print(dic)

for i in dic.keys():
    if(dic[i] == ma):
        print(i)


n = int(input())

dic = {}
ma = 1

for i in range(n):
    wo = input()
    if(wo in dic):
        dic[wo] += 1
        if(dic[wo] > ma):
            ma = dic[wo]
    else:
        dic.update({wo:1})


ans = []
for i in dic.keys():
    if(dic[i] == ma):
        ans.append(i)
ans.sort()
for j in ans:
    print(j)


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 collections

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

c = collections.Counter(s)

b, most = c.most_common(1)[0]

for i,j in c.most_common():
  if j != most:
    break
  print(i)

import collections

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

c = collections.Counter(s)

b, most = c.most_common(1)[0]

ans = []
for i,j in c.most_common():
  if j != most:
    break
  ans.append(i)
for ans_v in sorted(ans):
  print(ans_v)

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())
a = []

for i in range(N):
    a.append(str(input()))
a = collections.Counter(a)
b = max(a.values())

max_k_list = [kv[0] for kv in a.items() if kv[1] == b]
max_k_list = sorted(max_k_list)

for i in max_k_list:
print(i)   

import collections

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

c = collections.Counter(s)
c_s = c.most_common()
m = c.most_common()[0][1]
ans = []
for j in range(len(c_s)):
    if c_s[j][1] != m:
        break
    else:
        ans.append(c_s[j][0])
ans.sort()
for t in ans:
    print(t)

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):
def main():
    from collections import Counter
    import sys
    input = sys.stdin.readline
    n=int(input())
    s=[]
    for _ in []*n:
        s.append(input().rstrip())
    c = Counter(s)
    ans=[]
    max_vote = max(c.values())
    for i,j in c.items():
        if j == max_vote:
            ans.append(i)
    print("\n".join(sorted(ans)))
main()

def main():
    from collections import Counter
    import sys
    input = sys.stdin.readline
    n=int(input())
    s=[]
    ap = s.append
    for _ in [0]*n:
        ap(input().rstrip())
    c = Counter(s)
    ans=[]
    max_vote = max(c.values())
    for i,j in c.items():
        if j == max_vote:
            ans.append(i)
    print("\n".join(sorted(ans)))
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):
from collections import Counter

a = int(input())
a_list = []
ans_list = []

for i in range(a):
  a_list.append(input())

a_counter = Counter(a_list)

_v = 0
for k, v in a_counter.most_common():
    if _v == 0 or _v == v:
      _v = v
      ans_list.append(k)
    elif _v > v:
      break

ans = sorted(ans_list)
print(ans)

from collections import Counter

a = int(input())
a_list = []
ans_list = []

for i in range(a):
  a_list.append(input())

a_counter = Counter(a_list)

_v = 0
for k, v in a_counter.most_common():
    if _v == 0 or _v == v:
      _v = v
      ans_list.append(k)
    elif _v > v:
      break

ans = sorted(ans_list)
for i in ans:
  print(i)

Verdicts: Wrong Answer

Accepted
Problem: We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it.  Print all strings that are written on the most number of votes, in lexicographical order.

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

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

ds ={}  
for a in S:
  if a in ds:
    ds[a] +=1
  else:
    ds[a] =1
    
m = max(ds.values())

keys = [k for k,v in ds.items() if v == m]
print(keys)

N = int(input())

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

ds ={}  
for a in S:
  if a in ds:
    ds[a] +=1
  else:
    ds[a] =1
    
max = max(ds.values())

keys = [k for k,v in ds.items() if v == max]

print(keys)



N = int(input())

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

ds ={}  

for a in S:
  if a in ds:
    ds[a] +=1
  else:
    ds[a] =1
    
m = max(ds.values())

keys = [k for k,v in ds.items() if v == m]

print(keys)

N=int(input())

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

ds={}  
for a in S:
  if a in ds:
    ds[a] +=1
  else:
    ds[a] =1
    
m = max(ds.values())

keys = [k for k,v in ds.items() if v == m]
print(keys)

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

for i in range(n):
  if s[i] in d:
    d[s[i]] += 1
  elif not(s[i] in d):
    d[s[i]] =1
    
sort_d = sorted(d.values(),reverse=True)
max = sort_d[0]

ans =[]

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

ans.sort()

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



Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it.  Print all strings that are written on the most number of votes, in lexicographical order.

Submission attempts (in order):
import collections

n = int(input())
words = [input() for _ in range(n)]
c = collections.Counter(words)
max_c = c.most_common()
ans = [max_c[0][0]]

for i in range(1, len(max_c)):
    if max_c[i][1] == max_c[i-1][1]:
        ans.append(max_c[i][0])
    else:
        break

ans_sorted = sorted(ans, reverse=True)
for i in range(len(ans)):
    print(ans_sorted[i])

import collections

n = int(input())
words = [input() for _ in range(n)]
c = collections.Counter(words)
max_c = c.most_common()
ans = [max_c[0][0]]

for i in range(1, len(max_c)):
    if max_c[i][1] == max_c[i-1][1]:
        ans.append(max_c[i][0])
    else:
        break

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

Verdicts: Wrong Answer

Accepted
Problem: We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it.  Print all strings that are written on the most number of votes, in lexicographical order.

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

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

_max = 0
for v in dic.values():
  if _max < v:
    _max = v

for k,v in dic.items():
  if v == _max:
    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 = 0
for v in dic.values():
  if _max < v:
    _max = v
dic2 = sorted(dic.items())

for (k,v) in dic2:
  if v == _max:
    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):
from collections import Counter
N = int(input())
Sc = Counter([input() for _ in range(N)]).most_common()
print(Sc)
max_num = Sc[0][1]
ans = []
for key, val in Sc:
    if val == max_num:
        ans.append(key)
ans.sort()
for t in ans:
    print(t)

N = int(input())
from collections import Counter
Sc = Counter([input() for _ in range(N)])
max_count = max(Sc.values())
ans = sorted([k for k, v in Sc.items() if v == max_count)])
print(*ans, sep="\n")

N = int(input())
from collections import Counter
Sc = Counter([input() for _ in range(N)])
max_count = max(Sc.values())
ans = sorted([k for k, v in Sc.items() if v == max_count])
print(*ans, sep="\n")

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: We have N voting papers. The i-th vote (1 \leq i \leq N) has the string S_i written on it.  Print all strings that are written on the most number of votes, in lexicographical order.

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

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

words_sorted = sorted(words.items(), key=lambda x:x[1], reverse=True)    
score = words_sorted[0][1]
for word in words_sorted:
  if score == word[1]:
    print(word[0])
  else :
    break

n = int(input())

words = {}
for i in range(n):
  word = input()
  if word in words:
    words[word] += 1
  else :
    words[word] = 1
words_sorted = sorted(words.items(), key=lambda x:x[1], reverse=True)    
score = words_sorted[0][1]
answers = []
for word in words_sorted:
  if score == word[1]:
    answers.append(word[0])
  else :
    break
    
for answer in sorted(answers) :
  print(answer)

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
from collections import Counter
N=int(input())
S=['']*N
for i in range(N):
    S[i]=input()
counter = Counter(S)
ans=[0]*len(counter)
num=0
for word, cnt in counter.most_common():
    ans[num]=cnt
    num+=1
anker=ans[0]
ankernum=0
for j in range(len(counter)):
    if ans[j]!=anker:
        ankernum=j
        break
    elif j==len(counter)-1:
        ankernum=j+1
print(ankernum)
word_ans=['']*len(counter)
k=0
for word, cnt in counter.most_common():
    word_ans[k]=word
    k+=1

for l in sorted(word_ans[:ankernum]):
    print(l)

import sys
from collections import Counter
N=int(input())
S=['']*N
for i in range(N):
    S[i]=input()
counter = Counter(S)
ans=[0]*len(counter)
num=0
for word, cnt in counter.most_common():
    ans[num]=cnt
    num+=1
anker=ans[0]
ankernum=0
for j in range(len(counter)):
    if ans[j]!=anker:
        ankernum=j
        break
    elif j==len(counter)-1:
        ankernum=j+1
print(ankernum)
word_ans=['']*len(counter)
k=0
for word, cnt in counter.most_common():
    word_ans[k]=word
    k+=1

for l in sorted(word_ans[:ankernum]):
    print(l)

import sys
from collections import Counter
N=int(input())
S=['']*N
for i in range(N):
    S[i]=input()
counter = Counter(S)
ans=[0]*len(counter)
num=0
for word, cnt in counter.most_common():
    ans[num]=cnt
    num+=1
anker=ans[0]
ankernum=0
for j in range(len(counter)):
    if ans[j]!=anker:
        ankernum=j
        break
word_ans=['']*len(counter)
k=0
for word, cnt in counter.most_common():
    word_ans[k]=word
    k+=1

print(sorted(word_ans[:ankernum]))

import sys
from collections import Counter
N=int(input())
S=['']*N
for i in range(N):
    S[i]=input()
counter = Counter(S)
ans=[0]*len(counter)
num=0
for word, cnt in counter.most_common():
    ans[num]=cnt
    num+=1
anker=ans[0]
ankernum=0
for j in range(len(counter)):
    if ans[j]!=anker:
        ankernum=j
        break
    elif j==len(counter)-1:
        ankernum=j+1
word_ans=['']*len(counter)
k=0
for word, cnt in counter.most_common():
    word_ans[k]=word
    k+=1

for l in sorted(word_ans[:ankernum]):
    print(l)

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())
list_s=[]
for i in range(n):
  s=input()
  list_s.append(s)
list_cnt=[]  
list_t=list(set(sorted(list_s)))  
for i in list_t:
  cnt=list_s.count(i)
  list_cnt.append(cnt)
  
for i in range(len(list_cnt)):
  if list_cnt[i]==max(list_cnt):
    print(list_t[i])
  
  
  
  
  

n=int(input())
d={}
for i in range(n):
  s=input()
  if s not in d:
    d.setdefault(s,1)
    
  else:
    d[s]+=1
    
largest =max(d.values())
list_d=[]
for i in d.keys():
  if d[i]==largest:
    list_d.append(i)
    
list_d.sort()

for i in list_d:
  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 i in range(n):
  s=input()
  if s in d:
    d[s]+=1
  else:
    d[s]=0
m=max(d.values())
for x in d.keys():
  if d[x]==m:
    print(x)

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

Verdicts: Wrong Answer

Accepted