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):
from collections import Counter
n = int(input())
s = []
for _ in range(n):
    s.append(str(input()))

s_c = Counter(s).most_common()
m = s_c[0][1]

print(s_c)
print(m)
ans = []

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

for k in ans:
    print(k)

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

s_c = Counter(s).most_common()
m = s_c[0][1]

ans = []

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

for k in ans:
    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())
ls = [input() for i in range(n)]
dict = Counter(ls)
print(max(dict))

from collections import Counter
n = int(input())
l = [input() for i in range(n)]
ls = Counter(l)
most_num = ls.most_common()[0][1]
keymost = [i for i, j in ls.items() if j == most_num]
keymost.sort()
for k in keymost:
    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())
l = [input() for i in range(n)]
an = list(set(l))
alm = []
for i in range(len(an)):
    alm.append(l.count(an[i]))
    
ans = max(alm)

for i in range(len(an)):
    if alm[i] == ans:
        print(an[i])

from collections import Counter
n = int(input())
s = [input() for i in range(n)]
num = Counter(s)
mx = max(num.values())
for i in sorted(num):
    if num[i] == mx:
        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
M=max(D.values())
for d in D:
    if D[d]==M:
        print(d)

n=int(input())
D={}
for i in range(n):
    s=input()
    if s in D:
        D[s]+=1
    else:
        D[s]=1
M=max(D.values())
ans=[]
for d in D:
    if D[d]==M:
        ans.append(d)
print(*sorted(ans),sep="\n")

Verdicts: Wrong Answer

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

Submission attempts (in order):
def resolve():
    import collections
    n = int(input())
    c = list(collections.Counter([int(input()) for _ in range(n)]).most_common())
    s = []
    m = c[0][0]
    for i in c:
        if c !=m:
            break
        s.append(i[0])
    s.sort()
    print("\n".join(s))
resolve()

def resolve():
    import collections
    n = int(input())
    c = list(collections.Counter([input() for _ in range(n)]).most_common())
    s = []
    m = c[0][1]
    for i in c:
        if i[1] !=m:
            break
        s.append(i[0])
    s.sort()
    print("\n".join(s))
resolve()

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
import sys
n = int(sys.stdin.readline())
sn = sys.stdin.read().split()
c = Counter(sn)
c = sorted(c.items(), key=lambda x: (x[1], x[0]))
num = c[0][1]
for i, j in c:
  if j == num:
    print(i)
  else:
    quit()

from collections import Counter
import sys
n = int(sys.stdin.readline())
sn = sys.stdin.read().split()
c = Counter(sn)
num = max(c.values())
ans = [i for i, j in c.items() if j == num]
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())
d = {}
for i in range(n):
    s = input()
    d[s] = d[s]+1 if (s in d) else 1
d_sorted = sorted(d.items(), key=lambda x:x[1], reverse=True)
m = d_sorted[0][1]
for i in range(n):
    if d_sorted[i][1]!=m:
        break
    print(d_sorted[i][0])

n = int(input())
d = {}
for i in range(n):
    s = input()
    d[s] = d[s]+1 if (s in d) else 1
d_sorted = sorted(d.items(), key=lambda x:x[1], reverse=True)
m = d_sorted[0][1]
result = []
for i in d_sorted:
    if i[1]!=m:
        break
    result.append(i[0])
print(*sorted(result), 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 numpy as np

N = int(input())

S = []
cnt = []
for i in range(N):
  s = input()
  if s in S:
    cnt[S.index(s)] += 1
  else:
    S.append(s)
    cnt.append(1)

cnt = np.array(cnt)
S = np.array(S)

ans = S[cnt==cnt.max()]
ans.sort()

print(ans)

for s in ans:
  print(s)

N = int(input())

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

M = max(d.values())
for j,k in sorted(d.items()):
  if k == M:
    print(j)

Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
s = [str(input()) for i in range(n)]
d = {}
for name in s:
    if name in d.keys():
        d[name] = d[name] + 1
    else:
        d.setdefault(name, 1)
max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
for i in max_k_list:
    print(i)

n = int(input())
s = [str(input()) for i in range(n)]
sorted_s = sorted(s)
count = 1
max = 1
ans_list = []
prev = sorted_s[0]
for i in sorted_s[1:]:
    if i == prev:
        count += 1
    else:
        if count > max:
            ans_list = [prev]
            max = count
        elif count == max:
            ans_list.append(prev)
        prev = i
        count = 1
if count > max:
    ans_list = [prev]
elif count == max:
    ans_list.append(prev)
for i in ans_list:
    print(i)

Verdicts: Wrong Answer

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

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

for i in range(n):
    ss = input()

    if ss in s:
        s[ss] += 1
    else:
        s[ss] = 1

s2 = sorted(s.items(), key=lambda x:x[1])

s2.reverse()

max_value = s2[0][1]
ret = []

for sss in s2:
    if sss[1] == max_value:
        ret.append(sss[0])
    else:
        break

ret2 = sorted(ret)
print(ret2)

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

for i in range(n):
    ss = input()

    if ss in s:
        s[ss] += 1
    else:
        s[ss] = 1

s2 = sorted(s.items(), key=lambda x:x[1])

s2.reverse()

max_value = s2[0][1]
ret = []

for sss in s2:
    if sss[1] == max_value:
        ret.append(sss[0])
    else:
        break

ret2 = sorted(ret)
ret2.reverse()
print(ret2)

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

for i in range(n):
    ss = input()

    if ss in s:
        s[ss] += 1
    else:
        s[ss] = 1

s2 = sorted(s.items(), key=lambda x:x[1])

s2.reverse()

max_value = s2[0][1]
ret = []

for sss in s2:
    if sss[1] == max_value:
        ret.append(sss[0])
    else:
        break

ret2 = sorted(ret)
for r in ret2:
    print(r)

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 = []
maxnum = 0
maxyouso = []
for kai in range (N):
    S.append(input())
for num in S:
    if S.count(num) > maxnum:
        maxnum = S.count(num)
for num in S:
    if S.count(num) == maxnum:
        maxyouso.append(num)
maxyouso = (set(maxyouso))
for j in maxyouso:
    print(j)

N = int(input())
S = []
maxnum = 0
maxyouso = {}
anslist = []
for kai in range (N):
    S.append(input())
for moji in S:
    if moji not in maxyouso:
        maxyouso[moji] = 1
    else:
        maxyouso[moji] = maxyouso[moji] + 1
print(maxyouso)
for num in maxyouso:
    if maxyouso[num] > maxnum:
        maxnum = maxyouso[num]
for num in maxyouso:
    if maxyouso[num] == maxnum:
        anslist.append(num)
anslist.sort()
for k in anslist:
    print(k)

N = int(input())
S = []
maxnum = 0
maxyouso = []
for kai in range (N):
    S.append(input())
for num in S:
    if S.count(num) > maxnum:
        maxnum = S.count(num)
for num in S:
    if S.count(num) == maxnum:
        maxyouso.append(num)
maxysouso = set(maxyouso)
maxyouso.sort()
for j in maxyouso:
    print(j)

N = int(input())
S = []
maxnum = 0
maxyouso = {}
anslist = []
for kai in range (N):
    S.append(input())
for moji in S:
    if moji not in maxyouso:
        maxyouso[moji] = 1
    else:
        maxyouso[moji] = maxyouso[moji] + 1
for num in maxyouso:
    if maxyouso[num] > maxnum:
        maxnum = maxyouso[num]
for num in maxyouso:
    if maxyouso[num] == maxnum:
        anslist.append(num)
anslist.sort()
for k in anslist:
    print(k)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N = int(input())
S = [input() for _ in range(N)]
import collections
c = collections.Counter(S)
A = sorted(c.items(), key=lambda x: x[1], reverse=True)
count = 0
for a, b in A:
    if b >= count:
        print(a)
        count = b
    else:
        exit()

N = int(input())
S = [input() for _ in range(N)]
import collections
c = collections.Counter(S)
A = sorted(c.items(), key=lambda x: x[1], reverse=True)
count = 0
B = []
for a, b in A:
    if b >= count:
        B.append(a)
        count = b
    else:
        break

C = sorted(B)
for a in C:
    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())

words = [input() for i in range(n)]

dic = {}

for word in words:
    if not word in dic:
        dic[word] = 1
    
    else:
        dic[word] += 1

ans = [k for k, v in dic.items() if v == max(dic.values())]

for i in ans:
    print(i)

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

for word in range(n):
    word = input()
    if not word in dic:
        dic[word] = 1
    else:
        dic[word] += 1
max_v = max(dic.values())
ans = [kv[0] for kv in dic.items() if kv[1] == max_v]

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

print(s)


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):
dct = {}
for i in range(N):
    S = input()
    if dct.get(S) == None:
        dct[S] = 1
    else:
        dct[S] += 1
sortedDct = sorted(dct.items(), key=lambda x: -x[1])
L = []
maxNum = 0
for k, v in sortedDct:
    if (maxNum <= v):
        L.append(k)
        maxNum = v
L.sort()
for l in L:
    print(l)

N = int(input())
dct = {}
for i in range(N):
    S = input()
    if dct.get(S) == None:
        dct[S] = 1
    else:
        dct[S] += 1
sortedDct = sorted(dct.items(), key=lambda x: -x[1])
L = []
maxNum = 0
for k, v in sortedDct:
    if (maxNum <= v):
        L.append(k)
        maxNum = v
L.sort()
for l in L:
    print(l)

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
# Your code here!

import collections
a = int(input())
li1 = []
 
for i in range(a):
    li1.append(str(input()))
 
c = collections.Counter(li1)

print(c)
 
sorted_items = sorted(
  c.most_common(),
  key = lambda x:(x[1],x[0]), reverse=True)
  
print(sorted_items)
 
key, value = zip(*sorted_items)
li2 = []
li2.append(key[0])
for i in range(1,len(key)):
    if(value[0] == value[i]):
        li2.append(key[i])
    else:
        break;

list.sort(li2)

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

# coding: utf-8
# Your code here!

import collections
a = int(input())
li1 = []
 
for i in range(a):
    li1.append(str(input()))
 
c = collections.Counter(li1)

print(c)
 
sorted_items = sorted(
  c.most_common(),
  key = lambda x:(x[1],x[0]), reverse=True)
  
print(sorted_items)
 
key, value = zip(*sorted_items)
print(key[0])
for i in range(1,len(key)):
    if(value[0] == value[i]):
        print(key[i])
    else:
        break;

# coding: utf-8
# Your code here!

import collections
a = int(input())
li1 = []
 
for i in range(a):
    li1.append(str(input()))
 
c = collections.Counter(li1)
 
sorted_items = sorted(
  c.most_common(),
  key = lambda x:(x[1],x[0]), reverse=True)
 
key, value = zip(*sorted_items)
li2 = []
li2.append(key[0])
for i in range(1,len(key)):
    if(value[0] == value[i]):
        li2.append(key[i])
    else:
        break;

list.sort(li2)

for i in range(len(li2)):
    print(li2[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):
def main():
    N = int(input())

    count = dict()
    for i in range(N):
        s = input()
        try:
            count[s] += 1
        except:
            count[s] = 1
    
    sort_ = sorted(count.items(), key=lambda x:x[0], reverse=True)

    max_value = sort_[0][1]
    item = []
    for key,value in sort_:
        print(value)
        if value == max_value:
            item.append(key)
        else:
            break
        
    item.sort()
    for ans in item:
        print(ans)
    

if __name__ == '__main__':
    main()

def main():
    N = int(input())
    S = []
    unique = set()
    for i in range(N):
        s = input()
        S.append(s)
        unique.add(s)
    
    count = []
    for u in unique:
        count.append(S.count(u))

    max_index = [i for i, x in enumerate(count) if x == max(count)]
    
    for index_ in max_index:
        print(S[index_])
    

if __name__ == '__main__':
    main()

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

    count = dict()
    for i in range(N):
        s = input()
        try:
            count[s] += 1
        except:
            count[s] = 1
    
    sort_ = sorted(count.items(), key=lambda x:x[1], reverse=True)

    max_value = sort_[0][1]
    item = []
    for key,value in sort_:
        if value == max_value:
            item.append(key)
        else:
            break
    
    item.sort()
    for ans in item:
        print(ans)
    
if __name__ == '__main__':
    main()

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)
c2 = c.most_common()
a = c2[0][1]
ans = []

for i in range(len(c)):
    ans.append(c2[i][0])

ans.sort()
print(*ans,sep="\n")


from collections import Counter

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

c =Counter(s)
c2 = c.most_common()
a = c2[0][1]
ans = []

for i in range(len(c)):
    if c2[i][1] == a:
        ans.append(c2[i][0])
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, strings, answers = int(input()), [], []
for x in range(N):
    string = input()
    strings.append(string)
max_char = strings.count(max(strings, key=strings.count))
for x in strings:
    if strings.count(x) == max_char:
        answers.append(x)
for x in set(answers):
    print(x)

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s)
num = c.most_common()[0][1]
list=[]
for i in range(len(c)):
	if num == c.most_common()[i][1]:
		print(c.most_common()[i][0])
		#list.append(c.most_common()[i][0])

 int(input())
d = dict()
 
for i in range(n):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
 
M = max(d.values())
 
ans_list = []
for k,v in d.items():
    if v == M:
        ans_list.append(k)
 
ans_list.sort()
for i in ans_list:
    print(i)

import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s)
num = c.most_common()[0][1]
list=[]
for i in range(len(c)):
	if num == c.most_common()[i][1]:
		list.append(c.most_common()[i][0])
list = sorted(list,reverse=True)
for i in list:
	print(i)

n = int(input())
d = dict()

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

M = max(d.values())

ans_list = []
for k,v in d.items():
    if v == M:
        ans_list.append(k)

ans_list.sort()
for i in ans_list:
    print(i)


Verdicts: Wrong Answer

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):
l = [input() for i in range(n)]
l.sort()
i = 0
max = 1
count = 1
ans = []

while i < n-1:
  if l[i] == l[i+1]:
    count += 1
    i += 1
    if i == n-1 and count >= max:
      ans.append(l[n-1])

  else:
    if count >= max:
      max = count
      ans.append(l[i])
      count = 1
      i += 1
    else:
      count = 1
      i += 1

if max == 1:
  ans.append(l[n-1])
      
for i in ans:
  print(i)


l = [input() for i in range(n)]
l.sort()
i = 0
count = 1
ans = []
max = 1
while i < n-1:
  if l[i] == l[i+1]:
    count += 1
    i += 1
    if count >= max:
      max = count
    if i == n-1:
      ans.append([l[n-1], count])

  else:
      ans.append([l[i],count])
      count = 1
      i += 1

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





n = int(input())
l = [str(input()) for i in range(n)]
l.sort()
i = 0
count = 1
ans = []
max = 1
while i < n-1:
  if l[i] == l[i+1]:
    count += 1
    i += 1
    if count >= max:
      max = count
    if i == n-1:
      ans.append([l[n-1], count])

  else:
      ans.append([l[i],count])
      count = 1
      i += 1

if max == 1:
  ans.append([l[n-1], 1])
      
for i in ans:
  if i[1] == max:
    print(i[0])





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):
inpvals = []
lopvals = []
outvals = []

max_loop = int(input())
idx_loop = 0
while idx_loop < max_loop :
  inpvals.append(input())
  idx_loop = idx_loop+1

max_cnt = 0
lopvals = set(inpvals)
for inpval in inpvals :
  cnt = inpvals.count(inpval)

  if max_cnt <= cnt :
    if max_cnt != cnt :
      outvals = []
    max_cnt = cnt
    outvals.append(inpval)

outvals.sort()
    
for outval in outvals :
  print(outval)

from collections import defaultdict
from collections import OrderedDict

N = int(input())

words = dict()
wordsFromValue = defaultdict(list)

for idx in range(N) :
  word = str(input())
  
  if word in words :
    words[word] += 1
  else :
    words[word] = 1
  
for key, value in sorted(words.items()) :
  wordsFromValue[value].append(key)
  
for val in wordsFromValue[max(wordsFromValue)] : 
  print(val)

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


for i in range(N):
  A.append(input())

counter = collections.Counter(A)

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

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

for k,v in it:
  print(k)


import collections
import itertools

N=int(input())
A=[]
B=[]


for i in range(N):
  A.append(input())

counter = collections.Counter(A)

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

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

for k,v in it:
  B.append(k)
B.sort()

for i in range(len(B)):
  print(B[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 = [input() for _ in range(n)]
u = set(s)

w = []
m = 0
for x in u:
    n = sum([1 for i in s if i == x])
    if n > m:
        m = n
        w.clear()
        w.append(x)
    elif n == m:
        w.append(x)

print(sorted(w))

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

d = {}
m = 0
for x in s:
    if x in d:
        d[x] += 1
        m = max(m, d[x])
    else:
        d[x] = 0

print(sorted({k:v for k, v in d.items() if v == m}.keys()))

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

d = {}
m = 0
for x in s:
    if x in d:
        d[x] += 1
        m = max(m, d[x])
    else:
        d[x] = 0

for x in sorted({k:v for k, v in d.items() if v == m}.keys()):
    print(x)

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
from collections import Counter
n = int(input())
s = []
for i in range(n):
    s.append(input())
s = Counter(s)
print(s.most_common()[0][0])
i = 1
p = []
while  i < len(s.most_common()) and s.most_common()[i][1] == s.most_common()[0][1] :
    p.append(str(s.most_common()[i][0]))
    i+=1
p = sorted(p)
for i in range(len(p)):
    print(p[i])

n = int(input())
sen = {}
maxsen = 0
for i in range(n):
    s = input()
    if s not in sen:
        sen[s] = 1
        maxsen = max(maxsen,sen[s])
    else:
        sen[s]+=1
        maxsen = max(maxsen,sen[s])
p = []
for key in sen:
    val = sen[key]
    if val ==  maxsen:
        p.append(key)
p = sorted(p)
for x in p:
    print(x)

Verdicts: Wrong Answer

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

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

c = collections.Counter(List)
c_sorted = sorted(c.items(), key=lambda x:x[1],reverse=True)

maxCount = c_sorted[0][1]
keys = [k for k, v in c.items() if v ==maxCount]
for s in keys:
    print(s)

import collections
N = int(input())
List=[input() for i in range(N)]
 
c = collections.Counter(List)
c_sorted = sorted(c.items(), key=lambda x:x[1],reverse=True)
 
maxCount = c_sorted[0][1]
keys = [k for k, v in c.items() if v ==maxCount]
keys.sort()
for s in keys:
    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)]
d = {}
for i in s:
    if i in d.keys():
        d[i]=d[i]+1
    else:
        d[i]=1
d_sorted = sorted(d.items(), key=lambda x:x[1])
d_name = [x[0] for x in d_sorted if x[1] == d_sorted[-1][0]]
d_name.sort()
print("\n".join(d_name))

n = int(input())
s = [input() for i in range(n)]
d = {}
for i in s:
    if i in d.keys():
        d[i]=d[i]+1
    else:
        d[i]=1
d_sorted = sorted(d.items(), key=lambda x:x[1])
d_name = [x[0] for x in d_sorted if x[1] == d_sorted[-1][1]]
d_name.sort()
print("\n".join(d_name))

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
n = int(sys.stdin.readline())
li = []
for _ in range(n):
  li.append(sys.stdin.readline().strip())
li2 = list(set(li)).sort(reverse = True)
cnt_box = []
for i in li2:
  cnt_box.append(li.count(i))
m = max(cnt_box)
i = 0
while i < len(cnt_box):
  if cnt_box[i] == m:
    print(li2[i])
  i += 1


import sys
n = int(sys.stdin.readline())
li = []
for _ in range(n):
  li.append(sys.stdin.readline().strip())
max = 0
li2 = list(set(li))
li3 = []
for i in li2:
  if li.count(i) > max:
    li3 = [i]
  elif li.count(i) == max:
    li3.append(i)
li3.sort()
print('\n'.join(li3))

import sys
import math
import itertools
import numpy
import collections

rl = sys.stdin.readline

n = int(rl())

li = []
for _ in range(n):
    li.append(rl().rstrip())
c = collections.Counter(li)
max_cnt = 0
li = []
for k, v in c.items():
    if v < max_cnt:
        continue
    elif v == max_cnt:
        li.append(k)
    else:
        max_cnt = v
        li = [k]
li.sort()
print('\n'.join(li))





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())
ans={}
cnt=0
for i in range():
  t=input()
  if not t in ans.keys():
    ans[i]==1
  else:
    ans[i]+=1
  if cnt<ans[i]:
    cnt=ans[i]
tmp =[]
for i in ans.keys():
  if ans[i]  == cnt:
    tmp.append(i)
for i in sort(tmp):
  print(i)


N=int(input())
ans={}
cnt=0
for i in range(N):
  t=input()
  if not t in ans.keys():
    ans[t]=1
  else:
    ans[t]+=1
  if cnt<ans[t]:
    cnt=ans[t]
tmp =[]
for i in ans.keys():
  if ans[i]  == cnt:
    tmp.append(i)
tmp.sort()
for i in tmp:
  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())
listS=[]
for i in range(N):
  S=input()
  listS+=[S]
listS.sort()
counter=[]
count=1
for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
  else:
    counter+=[count]
    count=1
    
counter+=[count]    
MAX=max(counter)
count=1

for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
  else:
    count=1
  if count==MAX:
    print(listS[i])
if count==MAX:
  print(listS[-1])      

from collections import Counter
N=int(input())
listS=[]
for i in range(N):
  S=input()
  listS+=[S]
listS=Counter(listS)
listS=listS.most_common()
ans=[]
MAX=listS[0][1]
for i in range(len(listS)):
  if listS[i][1]==MAX:
    ans+=[listS[i][0]]
  else:
    break   
ans.sort()
for i in ans:
  print(i)

Verdicts: Wrong Answer

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

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

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


c = collections.Counter(S)
value,count = zip(*c.most_common(len(c)))

if len(set(count)) == 1:
    s = sorted(value)
    for i in s:
        print(i)
else:
    for i in value:
        print(i)
        exit()

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

c = collections.Counter(S)
value,count = zip(*c.most_common())

s = sorted(value)
ans = []
if len(set(count)) == 1 :
    for i in s:
        print(i)
else: 
    for i in range(len(value)):
        ans.append(value[i])
        if count[i] > count[i+1]:
            [print(i) for i in sorted(ans)]
            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):
n = int(input())
s = []
for i in range(n):
  s.append(input())

import collections

c = collections.Counter(s)
l = [kv[0] for kv in c.items() if kv[1] == max(c.values())]

for i in l:
  print(i)

n = int(input())
s = {}
m = 1
for i in range(n):
  p = input()
  if p in s:
    s[p] += 1
    if m < s[p]:
      m = s[p]
  else:
    s[p] = 1

l = [kv[0] for kv in s.items() if kv[1] == m]

l.sort()

for i in l:
  print(i)

Verdicts: Wrong Answer

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

Submission attempts (in order):
ans = {}
for i in S:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1

max_v = max(ans.values())        
ANS = []
for key, value in ans.items():
    if ans[key] == max_v:
        ANS.append(key)

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

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

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

max_v = max(ans.values())        
ANS = []
for key, value in ans.items():
    if ans[key] == max_v:
        ANS.append(key)

for i in sorted(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())
lis = []
lis2 = {}
lis3 = []
for _ in range(n):
  lis.append(input())

for w in lis:
  if w not in lis2.keys():
    lis2[w] = 1
  else:
    lis2[w] += 1

ma = max(lis2.values())

for k, v in lis2.items():
  if v == ma:
    lis3.append(k)

for a in lis3:
  print(a)

n = int(input())
lis = []
lis2 = {}
lis3 = []
for _ in range(n):
  lis.append(input())

for w in lis:
  if w not in lis2.keys():
    lis2[w] = 1
  else:
    lis2[w] += 1

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

for a in range(len(sort_lis2)):
  if a == 0:
    lis3.append(sort_lis2[0][0])
  else:
    if sort_lis2[0][1] == sort_lis2[a][1]:
      lis3.append(sort_lis2[a][0])

for b in lis3:
  print(b)

n = int(input())
lis = []
lis2 = {}
lis3 = []
for _ in range(n):
  lis.append(input())

for w in lis:
  if w not in lis2.keys():
    lis2[w] = 1
  else:
    lis2[w] += 1

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

for a in range(len(sort_lis2)):
  if a == 0:
    lis3.append(sort_lis2[0][0])
  else:
    if sort_lis2[0][1] == sort_lis2[a][1]:
      lis3.append(sort_lis2[a][0])

for b in lis3:
  print(b)

n = int(input())
lis = []
lis2 = {}
lis3 = []
for _ in range(n):
  lis.append(input())

for w in lis:
  if w not in lis2.keys():
    lis2[w] = 1
  else:
    lis2[w] += 1

ma = max(lis2.values())

for k, v in lis2.items():
  if v == ma:
    lis3.append(k)

lis3.sort()

for a in lis3:
  print(a)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])

n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])
        inko=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())
List = [input() for i in range(n)]

c = {}
res = []

for i in range(n):
    if List[i] in c.keys():
        c[List[i]] += 1
    else:
        c[List[i]] = 1

ac = c.most_common() 
                     
res.append(ac[0][0])
for i in range(1, leng):
    if ac[i][1] >= ac[i-1][1]:
        res.append(ac[i][0])
    else:
        break


res.sort()
for j in range(len(res)):
    print(res[j])

import collections

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

c = collections.Counter(List)

for v in c.values():
  m = max(m, v)
  
for k, v in c.items():
  if v == m:
    res.append(k)
    
res.sort()
for i in range(les(res)):
  print(res[i])

import collections

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

c = collections.Counter(List)
m = 0
for v in c.values():
  m = max(m, v)
  
for k, v in c.items():
  if v == m:
    res.append(k)
    
res.sort()
for i in range(les(res)):
  print(res[i])

import collections

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

#c = collections.Counter(List)

c = {}

for i in range(n):
    if List[i] in c.keys():
        c[List[i]] += 1
    else:
        c[List[i]] = 1


m = 0
for v in c.values():
    m = max(m, v)

for k, v in c.items():
    if v == m:
        res.append(k)
    
res.sort()
for i in range(len(res)):
    print(res[i])


Verdicts: 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):
from collections import Counter
n = int(input())
S = []
for _ in range(n):
    s = input()
    S.append(s)
cnt = Counter(S)
l = max(cnt.values())

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

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

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

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
    
d = {k: v for k, v in sorted(d.items(), key=lambda item: item[1], reverse=True)}

max_count = -1
for k, v in d.items():
  if max_count < v:
    max_count = v
  if v != max_count:
    break
  print(k)

N = int(input())

d = {}
for _ in range(N):
  s = input()
  if s in d:
    d[s] += 1
  else:
    d[s] = 1
    
d = {k: v for k, v in sorted(d.items(), key=lambda item: item[1], reverse=True)}

max_count = -1
values = []
for k, v in d.items():
  if max_count < v:
    max_count = v
  if v != max_count:
    break
  values.append(k)

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

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())
S.sort()
S.append("A")
print(S)
B = []
M = 1
T = 1
for i in range(N):
    if S[i] == S[i+1]:
        T += 1
    elif T < M:
        T = 1
    elif T == M:
        T = 1
        B.append(S[i])
    else:
        M = T
        T = 1
        B = [S[i]]

for i in range(B):
    print(B[i])

N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
S.append("A")
B = []
M = 1
T = 1
for i in range(N):
    if S[i] == S[i+1]:
        T += 1
    elif T < M:
        T = 1
    elif T == M:
        T = 1
        B.append(S[i])
    else:
        M = T
        T = 1
        B = [S[i]]

for i in range(len(B)):
    print(B[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 numpy as np

N = int(input())
a = input().split()

a = np.array(a)

unique_elements, counts_elements = np.unique(a, return_counts=True)
elements = unique_elements[counts_elements == max(counts_elements)]
for i in elements:
    print(i)


import numpy as np

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

a = np.array(a)

unique_elements, counts_elements = np.unique(a, return_counts=True)
elements = unique_elements[counts_elements == np.max(counts_elements)]
for i in elements:
    print(i)
    print('\n')

N = int(input())
a = list(map(str, input().split()))

a = np.array(a)
unique_elements, counts_elements = np.unique(a, return_counts=True)
elements = unique_elements[counts_elements == max(counts_elements)]
for i in elements:
    print(i)


import numpy as np

N = int(input())
a = list(map(str, input().split()))

a = np.array(a)
unique_elements, counts_elements = np.unique(a, return_counts=True)
elements = unique_elements[counts_elements == max(counts_elements)]
for i in elements:
    print(i)


import numpy as np

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

a = np.array(a)

unique_elements, counts_elements = np.unique(a, return_counts=True)
elements = unique_elements[counts_elements == np.max(counts_elements)]
for i in elements:
    print(i)


import numpy as np

N = int(input())
a = input().split()

a = np.array(a)

unique_elements, counts_elements = np.unique(a, return_counts=True)
elements = unique_elements[counts_elements == np.max(counts_elements)]
for i in elements:
    print(i)


import numpy as np

N = int(input())
a = input().split()

a = np.array(a)

unique_elements, counts_elements = np.unique(a, return_counts=True)
elements = unique_elements[counts_elements == np.max(counts_elements)]
for i in elements:
    print(i)
    print('\n')


import numpy as np

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

a = np.sort(np.array(a))

unique_elements, index_elements = np.unique(a, return_index = True)
l = []
for i in range(index_elements.size -1):
  m = index_elements[i + 1] - index_elements[i]
  l.append(m)
l.append(a.size - index_elements[-1])    
elements = unique_elements[l == max(l)]


for i in elements:
	print(i)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

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):
N=int(input())
L=list(input() for i in range(N))
L=sorted(L)
X=L[0]
c=0
d=0
e=[]
for i in range(N):
  if L[i]==X:
    c+=1
  elif L[i]!=X and d<c:
    d=c
    c=0
    e=[]
    e.append(X)
    X=L[i]
    c+=1
  elif L[i]!=X and d==c:
    c=1
    e.append(X)
    X=L[i]
    if i==N-1:
      e.append(X)
  elif L[i]!=X and d>c:
    c=0
    X=L[i]
    c+=1
for i in e:
  print(i)

N=int(input())
L=list(input() for i in range(N))
L=sorted(L)
X=L[0]
c=0
d=0
e=[]
for i in range(N):
  if L[i]==X:
    c+=1
    if i==N-1 and c>d:
      e=[X]
  elif L[i]!=X and d<c:
    d=c
    c=0
    e=[]
    e.append(X)
    X=L[i]
    c+=1
  elif L[i]!=X and d==c:
    c=1
    e.append(X)
    X=L[i]
    if i==N-1:
      e.append(X)
  elif L[i]!=X and d>c:
    c=0
    X=L[i]
    c+=1
for i in e:
  print(i)

N=int(input())
L=list(input() for i in range(N))
L=sorted(L)
X=L[0]
c=0
d=0
e=[]
for i in range(N):
  if L[i]==X:
    c+=1
    if i==N-1 and c>d:
      e=[X]
    elif i==N-1 and c==d:
      e.append(X)
  elif L[i]!=X and d<c:
    d=c
    c=0
    e=[]
    e.append(X)
    X=L[i]
    c+=1
  elif L[i]!=X and d==c:
    c=1
    e.append(X)
    X=L[i]
    if i==N-1:
      e.append(X)
  elif L[i]!=X and d>c:
    c=0
    X=L[i]
    c+=1
for i in e:
  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):
if __name__ == '__main__':
    N = int(input())
    kv = collections.defaultdict(int)
    max_cnt = 0
    res = []
    for _ in range(N):
        word = input()
        kv[word] += 1
        if kv[word] == max_cnt:
            res.append(word)
        elif kv[word] > max_cnt:
            res = [word]
            max_cnt = kv[word]
    print('\n'.join(sorted(res)))

import collections

if __name__ == '__main__':
    N = int(input())
    kv = collections.defaultdict(int)
    max_cnt = 0
    res = []
    for _ in range(N):
        word = input()
        kv[word] += 1
        if kv[word] == max_cnt:
            res.append(word)
        elif kv[word] > max_cnt:
            res = [word]
            max_cnt = kv[word]
    for s in sorted(res):
        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())
dic = {}
for _ in range(n):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
m = max(dic.values())
anslis = []
for k, v in dic.items():
    if v == m:
        anslis.append(k)
print('/n'.join(anslis))

n = int(input())
lis = [input() for _ in range(n)]
s = set(lis)
a = []
for i in s:
    a.append([lis.count(i), i])
M = max(s, key=lambda i : i[0])
func = lambda i:i[1] if i[0] == M else None
anslis = [i[1] for i in s if i[0]==M[0]]
for i in anslis:
    print(i)

n = int(input())
dic = {}
for _ in range(n):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
m = max(dic.values())
anslis = []
for k, v in dic.items():
    if v == m:
        anslis.append(k)
print('\n'.join(sorted(anslis)))

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=[]
lis=[]
for i in range(n):
  s=str(input())
  if not s in set(l):
    l.append(s)
    lis.append([s,0])
  for i in range(len(l[0])):
    if lis[i][0]==s:
      lis[i][1]+=1
      break
tmp=lis[0][1]
tmpl=[lis[0][0]]
for j in range(1,len(l)):
  if tmp<lis[j][1]:
    tmp=lis[j][1]
    tmpl.clear()
    tmpl.append(lis[j][0])
  elif tmp==l[j][1]:
    tmpl.append(lis[j][0])
tmpl.sort()
for i in range(len(tmpl)):
  print(tmpl[i])

from collections import Counter
n=int(input())
l=[input() for i in range(n)]
count=Counter(l).most_common()
d,most=[],count[0][1]
for si,c in count:
  if c==most:
    d.append(si)
d.sort()
for i in sorted(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):
import collections

number = int(input())

array = []

for i in range(number):
    array.append(input())

dic = collections.Counter(array).most_common()

max_dic = [dic[0][0]]

for i in range(len(dic) - 1):
    if dic[i + 1][1] == dic[0][1]:
        max_dic.append(dic[i + 1][0])

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

import collections

number = int(input())

array = []

for i in range(number):
    array.append(input())

dic = collections.Counter(array).most_common()

max_dic = [dic[0][0]]

for i in range(len(dic) - 1):
    if dic[i + 1][1] == dic[0][1]:
        max_dic.append(dic[i + 1][0])
        
max_dic.sort()

for i in range(len(max_dic)):
    print(max_dic[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=sorted([input() for i in range(n)])
ans = ['']
x=1
max=0
for k in range(n):
    if k<n-1:
        if s[k]==s[k+1]:
            x+=1
        else:
            if max<x:
                ans=[s[k]]
                max=x
            if max==x:
                ans.append(s[k])
            x=1
    else:
        if max<x:
            ans=[s[k]]
            max=x
        if max==x:
            ans.append(s[k])

    
print(0)
for j in range(ans.max):
    print(ans[j])

n=int(input())
s=sorted([input() for i in range(n)])
ans = ['']
x=1
max=0
for k in range(n):
    if k<n-1:
        if s[k]==s[k+1]:
            x+=1
        else:
            if max<x:
                ans=[s[k]]
                max=x
            elif max==x:
                ans.append(s[k])
            x=1
    else:
        if max<x:
            ans=[s[k]]
            max=x
        elif max==x:
            ans.append(s[k])

    

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

Verdicts: Runtime Error

Accepted