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

n, *s = sys.stdin.read().split()

def main():
    c = Counter(s)
    m = max(c.values())
    ans = [s for s, c in cnt.items() if c == m]
    print(*sorted(ans), sep='\n')
         
if __name__ ==  '__main__':
    main()

import sys
from collections import Counter

n, *s = sys.stdin.read().split()

def main():
    c = Counter(s)
    m = max(c.values())
    ans = [s for s, c in cnt.items if c == m]
    print(*sorted(ans), sep='\n')
         
if __name__ ==  '__main__':
    main()

import sys
from collections import Counter

n, *s = sys.stdin.read().split()

def main():
    c = Counter(s)
    m = max(c.values())
    ans = [s for s, v in c.items() if v == m]
    print(*sorted(ans), sep='\n')
         
if __name__ ==  '__main__':
    main()

Verdicts: Runtime Error

Runtime Error

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

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


numbers = dict()
maxval = 1
for val in s:
    if val in numbers:
        if maxval == numbers[val]:
            maxval = maxval + 1
        numbers[val] += 1
    else:
        numbers[val] = 1

[print(kv[0]) for kv in numbers.items() if kv[1] == maxval]


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


numbers = dict()
for val in s:
    if val in numbers:
        numbers[val] += 1
    else:
        numbers[val] = 1

[print(kv[0]) for kv in numbers.items() if kv[1] == max(numbers.values())]


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

print(s)
numbers = dict()
maxval = 1
for val in s:
    if val in numbers:
        if maxval == numbers[val]:
            maxval = maxval + 1
        numbers[val] += 1
    else:
        numbers[val] = 1

ret = [kv[0] for kv in numbers.items() if kv[1] == maxval]
for v in sorted(ret):
    print(v)


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

numbers = dict()
maxval = 1
for val in s:
    if val in numbers:
        if maxval == numbers[val]:
            maxval = maxval + 1
        numbers[val] += 1
    else:
        numbers[val] = 1

ret = [kv[0] for kv in numbers.items() if kv[1] == maxval]
for v in sorted(ret):
    print(v)


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

from collections import defaultdict
d = defaultdict(lambda:0)

for k in S:
    d[str(k)]+=1

dmax=max(d.value())
ansn=dmax
ans=[]
for i in set(S):
    if d[i]==ansn:
        ans.append(i)

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


from collections import *
n=int(input())
a=[]
for _ in range(n):
  a.append(input())
aset=set(a)
cnt=Counter(a)
maxi=0
for k in cnt.keys():
  maxi=max(maxi,cnt[k])

anss=[]
for s in seta:
  if cnt[s]==maxi:
    anss.append(s)
anss.sort()
for i in range(len(anss)):
  print(anss[i])

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

from collections import defaultdict
d = defaultdict(lambda:0)

for k in S:
    d[str(k)]+=1
    
ansn=max(d.values())
ans=[]
for i in set(S):
    if d[i]==ansn:
        ans.append(i)

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


Verdicts: Runtime Error

Runtime Error

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

Submission attempts (in order):
import collections
n = int(input())
s = [input() for _ in range(n)]
c = collections.Counter(s)
c = c.most_common()
base = c[0][1]
for i in range(len(c)):
    if (c[i][1]==base):
        print(c[i][0])
    else:
        exit()

import collections
n = int(input())
s = [input() for _ in range(n)]
c = collections.Counter(s)
c = c.most_common()
base = c[0][1]
ans = []
for i in range(len(c)):
    if (c[i][1]==base):
        ans.append(c[i][0])
    else:
        break
ans.sort()
print(*ans, sep="\n")


Verdicts: Wrong Answer

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

Submission attempts (in order):
import collections

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

c_dic = dict(collections.Counter(S))

#for value ,key in c_dic.items():

dic2 = dict(sorted(c_dic.items(), key=lambda x:x[0]))
dic2 = dict(sorted(dic2.items(), key=lambda x:x[1]))
m_dic2 = max(dic2.values())
print(c_dic, dic2,m_dic2)


for key, value in dic2.items():
    if value == m_dic2:
        print(key)
    




import collections
N = int(input())
S = [input() for _ in range(N)]
st = []
strings = dict(collections.Counter(S))
strings_sorted = sorted(strings.items(), key = lambda x:x[1], reverse=True)
max_num = strings_sorted[0][1]
for i in range(len(strings_sorted)):
    if strings_sorted[i][1] == max_num:
        st.append(strings_sorted[i][0])
st.sort()
for item in st:
    print(item)

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())
test = []
name = {}
num = []
for i in range(N):
  add = str(input())
  test.append(add)
#print(test)

for i in test:
  if i in name:
    name[i] += 1
  else:
    name[i] =1
#print(name)

for i in name:
  num.append(name[i])
  
#print(num)
#print(max(num))

word = []
for i in name:
  if name[i] == max(num):
    word.append(i)

word.sort()
print(word)

N = int(input())
test = []
name = {}

## gather all word to test ##
for i in range(N):
  add = str(input())
  test.append(add)


for i in test:
  if i in name:
    name[i] += 1
  if i not in name:
    name[i] =1
#print(name)


max_num = max(name.values())
#print(max_num)

word = []
for i in name:
  if name[i] == max_num:
    word.append(i)

word.sort()
for i in word:
  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_list = [input() for i in range(N)]
C = collections.Counter(S_list)
L = C.most_common()
max_ = L[0][1]
ans = []
#print("========")
for i in L:
    if i[1] == max_:
        ans.append(i[0])
    else:
        exit()
ans.sort()
for i in ans:
    print(i)


import collections
N = int(input())
S_list = [input() for i in range(N)]
C = collections.Counter(S_list)
L = C.most_common()
max_ = L[0][1]
for i in L:
    if i[1] == max_:
        print(i[0])
    else:
        exit()



import collections
N = int(input())
S_list = [input() for i in range(N)]
C = collections.Counter(S_list)
L = C.most_common()
max_ = L[0][1]
ans = []
#print("========")
for i in L:
    if i[1] == max_:
        ans.append(i[0])
    else:
        break
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):
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
c = Counter(s)
m = 0
for v in c.values():
	m = max(m, v)
print(c.items())
ans = []
for k, v in c.items():
	if v == m:
		ans.append(k)
ans.sort()
print(*ans, sep="\n")

N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
T = {S[0]:1}
for j in range(1,N):
    if S[j] not in T:
        T[S[j]] = 1
    else:
        T[S[j]] += 1
T_sorted = sorted(T.items(),key = lambda x:-x[1])
maxT = T_sorted[0][1]
print(T_sorted)
for k in range(len(T_sorted)):
    if T_sorted[k][1] != maxT:
        break
    print(T_sorted[k][0])

from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
c = Counter(s)
m = 0
for v in c.values():
	m = max(m, v)
ans = []
for k, v in c.items():
	if v == m:
		ans.append(k)
ans.sort()
print(*ans, sep="\n")

Verdicts: Wrong Answer

Wrong Answer

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

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

scount = Counter(s)
scsort = scount.most_common()
x = scsort[0][1]
for i in scsort:
    if i[1] != x:
        break
    print(i[0])

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

scount = Counter(s)
scsort = scount.most_common()
x = scsort[0][1]
anss = []
for i in scsort:
    if i[1] != x:
        break
    anss.append(i[0])

for i in sorted(anss):
    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())
a = [s for s in input().split()]

c = Counter(a)
list = c.most_common()
max = list[0][1]

ans = []
for i, j in list:
    if j == max:
        ans.append(i)
    else:
        break

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

from collections import Counter

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

c = Counter(a)
list = c.most_common()
max = list[0][1]

ans = []
for i, j in list:
    if j == max:
        ans.append(i)
    else:
        break

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
N=int(input())
li=map(string,input().split())
dic={}
for k in li:
  dic[k]+=1
max_dic= max(dic)
print(max_dic)

N = int(input())
D = {}
for _ in range(N):
    S = input()
    if S not in D: D[S]=0
    D[S]+=1

M = max(D.values())
for S in sorted(list(D)):
    if D[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):

r=[]
import sys

n = int(sys.stdin.readline())
sn = sys.stdin.read().split()

d={}
for i in l:
    if i in d:
        d[i]+=1
    else:
        d[i]=1

m = max(d.values())
for key,value in d.items():
    if value==m:
        r.append(key)
sorted_r = sorted(r)
print(*sorted_r,sep='\n')


r=[]
import sys

n = int(sys.stdin.readline())
sn = sys.stdin.read().split()

d={}
for i in l:
    if i in d:
        d[i]+=1
    else:
        d[i]=1

m = max(d.values())
for key,value in d.items():
    if value==m:
        r.append(key)
sorted_r = sorted(r)
print(*sorted_r,sep='\n')

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: 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 = list(input() for _ in range(n))
ls = Counter(s).most_common()
a = []
a.append(ls[0][0])
for i in range(1, len(ls)):
    if ls[i][1] == ls[0][1]:
        a.append(ls[i][0])
for i in a:
    print(i)

from collections import Counter
n = int(input())
s = list(input() for _ in range(n))
ls = Counter(s).most_common()
a = []
a.append(ls[0][0])
for i in range(1, len(ls)):
    if ls[i][1] == ls[0][1]:
        a.append(ls[i][0])
for i in sorted(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())
dict = {}
mx = 0
for i in range(n):
    s = input()
    if s not in dict:
        dict[s] = 0
    dict[s] += 1
    mx = max(mx, dict[s])
print(dict)
print(mx)
ans = []
for s in dict:
    if dict[s] == mx:
        ans.append(s)
ans.sort()
for s in ans:
    print(s)

import collections


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

Verdicts: Wrong Answer

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

Submission attempts (in order):
import collections
n = int(input())
List = list()
for _ in range(n):
  List.append(input())
s=collections.Counter(List)
s_inv={v:k for k,v in s.items()}
print(s_inv[max(s.values())])

import collections
n = int(input())
l1 = list()
for i in range(n):
  l1.append(input())
c = collections.Counter(l1)
m = max(c.values())
C = sorted(c.items())
for i in C:
  if i[1]==m:
    print(i[0])


Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
b = {}
for i in range(n):
    temp = input()
    if temp not in b:
        b[temp] = 1
    else:
        b[temp] += 1

list1 = sorted(b.items(), key=lambda x: x[1])
list1.reverse()

a = 0
list2=[]
while list1[0][1] == list1[a][1]:
    list2.append(list1[a][0])
    list2.sort()
    a += 1

print(list2)


n = int(input())
b = {}
for i in range(n):
    temp = input()
    if temp not in b:
        b[temp] = 1
    else:
        b[temp] += 1

list1 = sorted(b.items(), key=lambda x: x[1])
list1.reverse()

a = 0
list2=[]
while a<len(list1) and list1[0][1] == list1[a][1]:
    list2.append(list1[a][0])
    list2.sort()
    a += 1

print(list2)


n = int(input())
b = {}
for i in range(n):
    temp = input()
    if temp not in b:
        b[temp] = 1
    else:
        b[temp] += 1

list1 = sorted(b.items(), key=lambda x: x[1])

a = len(list1)-1
temp = len(list1)-1
list2 = []
while a >= 0 and list1[temp][1] == list1[a][1]:
    list2.append(list1[a][0])
    a -= 1
list2.sort()

for a in list2:
    print(a)


Verdicts: Runtime Error

Wrong Answer

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

Submission attempts (in order):
from collections import Counter

# input
N = int(input())
S = []
s_append = S.append

for i in range(N):
    s = input()
    s_append(s)


s_counter = Counter(S)
max = max(s_counter.values())

printed_items = []
append = printed_items.append
for i in s_counter.items():
    if s[1] == max and s[0] not in printed_items:
        print(s[0])
        append(s[0])

from collections import Counter

# input
N = int(input())
S = []
append = S.append

for i in range(N):
    s = input()
    append(s)


s_counter = Counter(S)
max = max(s_counter.values())

for i in s_counter.items():
    if s[1] == max:
        print(s[0])


from collections import Counter

# input
N = int(input())
S = []
s_append = S.append

for i in range(N):
    s = input()
    s_append(s)


s_counter = Counter(S)
max = max(s_counter.values())

printed_items = []
append = printed_items.append
max_s = [s[0] for s in s_counter.items() if s[1] == max]
for i in sorted([s for s in S if s in max_s]):
    print(i)

from collections import Counter

# input
N = int(input())
S = []
s_append = S.append

for i in range(N):
    s = input()
    s_append(s)


s_counter = Counter(S)
max = max(s_counter.values())

printed_items = []
append = printed_items.append
for i in [s[0] for s in s_counter.items() if s[1] == max]:
    print(i)

from collections import Counter

# input
N = int(input())
S = []
s_append = S.append

for i in range(N):
    s = input()
    s_append(s)


s_counter = Counter(S)
max = max(s_counter.values())

printed_items = []
append = printed_items.append
for i in s_counter.items():
    if i[1] == max and i[0] not in printed_items:
        print(i[0])
        append(i[0])

from collections import Counter

# input
N = int(input())
S = []
s_append = S.append

for i in range(N):
    s = input()
    s_append(s)


s_counter = Counter(S)
max = max(s_counter.values())

printed_items = []
append = printed_items.append
max_s = [s[0] for s in s_counter.items() if s[1] == max]
for i in [s for s in S if s in max_s]:
    print(i)

from collections import Counter

# input
N = int(input())
S = []
s_append = S.append

for i in range(N):
    s = input()
    s_append(s)


s_counter = Counter(S)
max = max(s_counter.values())

printed_items = []
append = printed_items.append
max_s = [s[0] for s in s_counter.items() if s[1] == max]
for i in sorted(max_s):
    print(i)


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

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

Submission attempts (in order):
case = int(input())
l = [""] * case
for i in range(case):
  l[i] = input()

for str in sorted(set(l)):
  print(str)

case = int(input())
l = [""] * case
for i in range(case):
  l[i] = input()

for str in set(l):
  print(str)

import collections

case = int(input())
l = [""] * case
for i in range(case):
  l[i] = input()

c = collections.Counter(l)

values, counts = zip(*c.most_common())
cnt = 0
for i in range(len(counts)):
  str = values[i]
  if cnt < counts[i]:
    cnt = counts[i]
    print(str)
  elif cnt == counts[i]:
    print(str)
  else:
    break
    

import collections

case = int(input())
l = [""] * case
for i in range(case):
  l[i] = input()

c = collections.Counter(l)

values, counts = zip(*c.most_common())
values = sorted(values)
cnt = 0
for i in range(len(counts)):
  str = values[i]
  if cnt < counts[i]:
    cnt = counts[i]
    print(str)
  elif cnt == counts[i]:
    print(str)
  else:
    break
    

import collections

case = int(input())
l = [""] * case
for i in range(case):
  l[i] = input()

c = collections.Counter(l)

values, counts = zip(*c.most_common())
cnt = 0
str_list = []
for i in range(len(counts)):
  if cnt < counts[i]:
    cnt = counts[i]
    str_list.append(values[i])
  elif cnt == counts[i]:
    str_list.append(values[i])
  else:
    break

str_list = sorted(str_list)
for tar_str in str_list:
  print(tar_str)

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):
from collections import Counter
n = int(input())
s = []
ans = []

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

c = Counter(s)
c_s = c.most_common()
m = c.most_common()[0][1]
print(c_s)
print(m)

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)

from collections import Counter
n = int(input())
s = []
ans = []

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

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

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: 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):
i=int(input())
l=[""]*i
for k in range(i):
  l[k]=input()
l.sort()
maxi=0
kosu=0
for k in l:
  kosu+=1
  if kosu=maxi:
    li.append(k)
  elif kosu>maxi:
    li.clear()
    li.append(k)
print(*li)

i=int(input())
l=[""]*i
for k in range(i):
  l[k]=input()
l.sort()
maxi=0
kosu=0
li=[]
subk=""
for k in l:
  if subk!=k:
    kosu=0
    subk=k
  kosu+=1
  if kosu==maxi:
    li.append(k)
  elif kosu>maxi:
    li.clear()
    li.append(k)
    maxi=kosu
for k in li:
  print(k)

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().rstrip())
 
current_max = 0
current = []
table = {}
 
for i in range(n):
    s = input().rstrip()
    table[s] = table[s] + 1 if table.get(s) is not None else 0
    if table[s] > current_max:
        current = [s]
        current_max = table[s]
    elif table[s] == current_max:
        current.append(s)
    else:
        continue
 
score_sorted = sorted(table.items(), key=lambda x:-x[1])

max = 0
results = []
for k, v in score_sorted:
    if max > v:
      break
    results.append(k)

results.sort()

for word in results:
  print(word)

n = int(input().rstrip())
 
current_max = 0
current = []
table = {}
 
for i in range(n):
    s = input().rstrip()
    table[s] = table[s] + 1 if table.get(s) is not None else 0
    if table[s] > current_max:
        current = [s]
        current_max = table[s]
    elif table[s] == current_max:
        current.append(s)
    else:
        continue
 
score_sorted = sorted(table.items(), key=lambda x:-x[1])

max = 0
for k, v in score_sorted:
    if max > v:
      break
    max = v
    print(k)

n = int(input().rstrip())
 
current_max = 0
current = []
table = {}
 
for i in range(n):
    s = input().rstrip()
    table[s] = table[s] + 1 if table.get(s) is not None else 1
 
score_sorted = sorted(table.items(), key=lambda x:-x[1])

max = 0
results = []
for k, v in score_sorted:
    if max > v:
      break
    max = v
    results.append(k)

results.sort()

for word in results:
  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):
from collections import Counter

n = int(input())
a = []
for i in range(n):
    a.append(input())
b = Counter(a)
for k, v in b.items():
    if v == max(b.values()):
        print(k)


b = {}
for _ in range(int(input())): s=input(); b[s]=b.get(s,0)+1
print(*sorted(k for k in b if b[k]==max(b.values())))

from collections import Counter

n = int(input())
a = []
for i in range(n):
    a.append(input())
b = Counter(a)
m = max(b.values())
for k, v in sorted(b.items()):
    if v == m:
        print(k)


Verdicts: Wrong Answer

Time Limit Exceeded

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

Submission attempts (in order):
import collections

count = input()

l = []
for i in range(int(count)):
    l.append(input())
c = collections.Counter(l)
#print(l)
#print(c)
#print(c.most_common()[0][1])
max_count = c.most_common()[0][1]
for i in c.most_common():
    if i[1] != max_count:
        exit()
    print(i[0])



import collections

count = input()

l = []
ans = []
for i in range(int(count)):
    l.append(input())
c = collections.Counter(l)
#print(l)
#print(c)
#print(c.most_common()[0][1])
print("--")
max_count = c.most_common()[0][1]
for i in c.most_common():
    if i[1] != max_count:
        exit()
    #print(i[0])
    ans.append(i[0])
ans.sort()
for i in ans:
    print(i)



import collections

count = input()

l = []
ans = []
for i in range(int(count)):
    l.append(input())
c = collections.Counter(l)
#print(l)
#print(c)
#print(c.most_common()[0][1])
max_count = c.most_common()[0][1]
for i in c.most_common():
    if i[1] != max_count:
        break
    #print(i[0])
    ans.append(i[0])
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):
N = int(input())

hash = {}
for i in range(N):
	key = input()
	if key in hash:
		hash[key] += 1
	else:
		hash[key] = 1
        
max = 0
results = []
for i, v in hash.items():
	if max == v:
		results.append(i)
	elif max < v:
		results = [i]
        
for i in results:
	print(i)


N = int(input())

hash = {}
for i in range(N):
	key = input()
	if key in hash:
		hash[key] += 1
	else:
		hash[key] = 1
        
max = 0
results = []
for i, v in hash.items():
	if max == v:
		results.append(i)
	elif max < v:
		results = [i]
		max = v
        
for i in results:
	print(i)


N = int(input())

hash = {}
for i in range(N):
	key = input()
	if key in hash:
		hash[key] += 1
	else:
		hash[key] = 1
        
max = 0
results = []
for i, v in hash.items():
	if max == v:
		results.append(v)
	elif max < v::
		results = [v]
        
for i in results:
	print(v)


N = int(input())

hash = {}
for i in range(N):
	key = input()
	if key in hash:
		hash[key] += 1
	else:
		hash[key] = 1
        
max = 0
results = []
for i, v in hash.items():
	if max == v:
		results.append(i)
	elif max < v:
		results = [i]
		max = v

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



Verdicts: Wrong Answer

Wrong Answer

Runtime Error

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

Submission attempts (in order):

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


for i in range(N):
    a = input()
    if(a not in C.keys()):
        C[a] = 1
    else:
        val = C[a]
        C[a] = val + 1

maxv=0
for i in C.values():
    if(i > maxv):
        maxv=i

ans = sorted(C.items())
for i  in ans:
    if(maxv==i[1]):
        print(i[0])


def myAnswer(N:int,S:list) -> None:
    dic = {}
    for s in S:
        if(s in dic.keys()):
            dic[s]+=1
        else:
            dic[s] = 1
    ans = []
    dic2 = sorted(dic.items(), key=lambda x:x[1],reverse = True)
    MAX = dic2[0][1]
    for key,value in dic2:
        if(MAX == value):
            ans.append(key)
        else:
            break
    ans.sort()
    for a in ans:
        print(a)




def main():
    N = int(input())
    S = [(input()) for _ in range(N)]
    myAnswer(N,S[:])
if __name__ == '__main__':
   main()

Verdicts: Runtime Error

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

Submission attempts (in order):
import collections

n = int(input())


d = collections.defaultdict(lambda:0)

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

d = dict(d)

a = collections.Counter(d).most_common()

most = 0

for k, v in a:
    if most <= v:
        most = v
        print(k)
    else:
        break

import collections

n = int(input())


d = collections.defaultdict(lambda:0)

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

d = dict(d)

a = collections.Counter(d)

most = 0

for k, v in a.items():
    if most <= v:
        most = v
        print(k)
    else:
        break

import collections

n = int(input())


d = collections.defaultdict(lambda:0)

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

d = dict(d)

a = collections.Counter(d).most_common()

most = a[0][1]
ans = []

for k, v in a:
    if v == most:
        ans.append(k)
    else:
        break

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

n = int(input())
s = [input() for _ in range(n)]
c_sort = collections.Counter(s).most_common()
list_most = [c_sort[i][0] for i in range(len(c_sort)) if c_sort[i][1] == c_sort[0][1]]
for i in list_most:
    print(i)

import collections

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

c_sort = collections.Counter(s).most_common()
list_most = [c_sort[i][0] for i in range(len(c_sort)) if c_sort[i][1] == c_sort[0][1]]
for i in list_most:
    print(i)

import sys

input = sys.stdin.readline

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

for i in range(n):
    if s[i] not in dict:
        dict[s[i]], s.count(s[i])]

max_d_list = [d[0] for d in dict.items() if d[1] == max(dict.values())]
sorted_list = sorted(max_d_list)
for i in sorted_list:
    print(i)

import sys
from collections import Counter

input = sys.stdin.readline

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

c_sort = collections.Counter(s).most_common()
list_most = [c_sort[i][0] for i in range(len(c_sort)) if c_sort[i][1] == c_sort[0][1]]
for i in list_most:
    print(i)

import collections

n = int(input())
s = [input() for _ in range(n)]
c_sort = collections.Counter(s).most_common()
list_most = [c_sort[i][0] for i in range(len(c_sort)) if c_sort[i][1] == c_sort[0][1]]
for i in sorted(list_most):
    print(i)

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

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

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

set_key = set(s)
dic = dict(set_key, [0]*len(set_key))

for c in s:
  dic[c] += 1
  
n_max = max(dic.values())
str_argmax = dic.keys()[dic.values() == n_max]
str_argmax.sort()

for i in str_argmax:
  print(i)

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

set_key = list(set(s))
set_key.sort()
dic = dict(zip(set_key, [0]*len(set_key)))

for c in s:
  dic[c] += 1

n_max = max(dic.values())

for c in set_key:
  if dic[c] == n_max:
    print(c)

Verdicts: Runtime Error

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

Submission attempts (in order):
N = int(input())
S = [input() for i in range(N)]
list1 = []
count = 1
for s in S:
  c = S.count(s)
  if c == count:
    list1.append(s)
   
  elif c > count:
    list1 = [s]
    count = c
  S.remove(s)
  
      
if len(list1) == 1:
  print(list1[0])
elif S.count(list1[0]) < S.count(list1[1]):
  list1.pop(0)
  for i in range(len(list1)):
    ans = sorted(list1)
    print(ans[i])

N = int(input())
S = [input() for i in range(N)]
list1 = []
count = 1
for i in range(N):
  if S[i] not in list1:
    c = S.count(S[i])
    if c == count:
      list1.append(S[i])
    elif c > count:
      list1 = [S[i]]
      count = c
      
if len(list1) == 1:
  print(list1[0])
elif S.count(list1[0]) < S.count(list1[1]):
  list1.pop(0)
  for i in range(len(list1)):
    ans = sorted(list1)
    print(ans[i])

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

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

sai = max(dic.values())

for j in sorted(k for k in dic if dic[k] == sai):
  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

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

    cnt=dict()
    for _ in range(n):
        s=input()
        if s in cnt:
            cnt[s]+=1
        else :
            cnt[s]=1
    #print(cnt)
    
    a = [k for k, v in cnt.items() if v == max(cnt.values())]
    for elm in a :
        print(elm)

main()



import collections

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

    cnt=dict()
    for _ in range(n):
        s=input()
        if s in cnt:
            cnt[s]+=1
        else :
            cnt[s]=1
    #print(cnt)
    
    a = [k for k, v in cnt.items() if v == max(cnt.values())]
    print("aa")
    a.sort()
    for elm in a:
        print(elm)

main()



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

    cnt=dict()
    
    for _ in range(n):
        s=input()
        if s in cnt:
            cnt[s]+=1
        else :
            cnt[s]=1
    #print(cnt)
    
    num = 0
    res =[]
    for key,value in cnt.items():
        print(key,":::",value)
        if value > num:
            num=value
            res.append(key)
        elif value==num:
            res.append(key)

    #print("res::",res)

    
    


    
    res.sort()
    for elm in res:
        print(elm)


main()



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

    cnt=dict()
    
    for _ in range(n):
        s=input()
        if s in cnt:
            cnt[s]+=1
        else :
            cnt[s]=1
    #print(cnt)
    
    num = 0
    res =[]
    for key,value in cnt.items():
        #print(key,":::",value)
        if value > num:
            num=value
            res=[]
            res.append(key)

        elif value==num:
            res.append(key)

    #print("res::",res)

    
    


    
    res.sort()
    for elm in res:
        print(elm)


main()



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

for count in range(n):
    str_list.append(input())

list_set = set(str_list)


# print(str_list)
# print(list_set)


# print(str_list)
# str_list = filter(lambda txt: txt != set_txt, str_list)
# print(str_list)
# print('!!!!!')


max = 0
ans = []
for set_txt in list_set:
    count = 0
    for list_txt in str_list:
        if(set_txt == list_txt):
            count += 1
    print(str_list)
    str_list = ([s for s in str_list if s != 'set_txt'])
    if(max < count):
        max = count
        ans.clear
        ans.append(set_txt)
    elif(max == count):
        ans.append(set_txt)
    print(count)

ans.sort()
for txt in ans:
    print('---' + txt)
    # print(txt)


n = int(input())
str_list = []

for count in range(n):
    str_list.append(input())
set_list = set(str_list)

max = 0
ans = []

for txt in set_list:
    count = str_list.count(txt)
    if(max < count):
        max = count
        ans.clear
        ans.append(txt)
    elif(max == count):
        ans.append(txt)

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


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

for count in range(n):
    txt = input()
    if(txt in dict_str):
        dict_str[txt] += 1
    else:
        dict_str[txt] = 1
# print(dict_str)

max = max(dict_str.values())

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

ans.sort()
for txt in ans:
    # print(end='---')
    print(txt)

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 operator import itemgetter
import datetime

n = int(input())
sn = dict()

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

sn = sorted(sn.items(), key=lambda x:x[1], reverse=True)
#print(sn)

max_val = max(dict(sn).values())

for si in sn:
    if(int(si[1]) == max_val):
        print(si[0])
    else:
        break

from operator import itemgetter
import datetime

n = int(input())
sn = dict()

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

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

max_val = max(dict(sn).values())

for si in sn:
    if(int(si[1]) == max_val):
        print(si[0])
    else:
        break

Verdicts: Wrong Answer

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

Submission attempts (in order):
import sys
input = sys.stdin.readline

N = int(input())
S = [input() for _ in range(N)]
 
T = sorted(set(S))
t = len(T)
l = [S.count(T[i]) for i in range(t)]
  
for i in range(t):
  if l[i] == max(l):
    print(T[i])

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

T = list(set(S))
t = len(T)
l = [0] * t

for i in range(t):
  l[i] = S.count(T[i])
  
for i in range(t):
  if l[i] == max(l):
    print(T[i])

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



 

dic = {}
for i in range(N):
  s = S[i]
  if s not in dic: dic[s] = 1
  else: dic[s] += 1

max_count = max(dic.values()) 
 

l = [key for key in dic.keys() if dic[key] == max_count]
 

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

Verdicts: Time Limit Exceeded

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

c = Counter(s)
max_count = max(c.values())

for k, v in c.items():
    if v == max_count:
        ans.append(k)
ans.sort()
print('\￿n'.join(ans))


from collections import Counter

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

c = Counter(s)
max_count = max(c.values())

for k, v in c.items():
    if v == max_count:
        ans.append(k)

ans.sort()

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


Verdicts: Wrong Answer

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

Submission attempts (in order):
N=int(input())
S = [input() for _ in range(N)]
maxA=0
B=[]
for i in set(S):
  A=(S.count(i))
  if A > maxA:
    maxA=A
    B = [i]
  if A == maxA and i not in B:
    B.append(i)
[print(j) for j in B]

N=int(input())
S = [input() for _ in range(N)]
import collections 
C=collections.Counter(S)
maxC=max(C.values())
keys = [k for k, v in C.items() if v == maxC]
[print(j) for j in sorted(keys)]

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 main():
    N = int(input())
    S = [input() for i in range(N)]
    from collections import Counter
    c = Counter(S)
    cnt = c.most_common()[0][1]
    for s in c.most_common():
        # print(s)
        if s[1] == cnt:
            print(s[0])


if __name__ == '__main__':
    main()


def main():
    N = int(input())
    S = [input() for i in range(N)]
    from collections import Counter
    c = Counter(S)
    cnt = c.most_common()[0][1]
    ans = []
    for s in c.most_common():
        # print(s)
        if s[1] == cnt:
            ans.append(s[0])
    ans.sort()
    for a in ans:
        print(a)


if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

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

Submission attempts (in order):
from collections import Counter
N = int(input())
data = [0] * N


for i in range(0, N):
    data[i] = input()

count = Counter(data)


most = count.most_common()
mostNum = most[0][1]
print(count)    # counter_object
print(most)     # list;[(val,num),(val,num),/////]
print(mostNum)  # number of most

most.sort()

for i in most:
    if (i[1] == mostNum):
        print(i[0])


from collections import Counter
N = int(input())
data = [0] * N


for i in range(0, N):
    data[i] = input()

count = Counter(data)


most = count.most_common()
mostNum = most[0][1]
'''
print(count)    # counter_object
print(most)     # list;[(val,num),(val,num),/////]
print(mostNum)  # number of most
'''
most.sort()

for i in most:
    if (i[1] == mostNum):
        print(i[0])


Verdicts: Wrong Answer

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

Submission attempts (in order):
n = int(input())
words = [input() for i in range(n)]
words_set = set(words)
counter = [0 for j in range(int(len(words_set)))]
words_dic = {}

words_list = list(zip(words_set, counter))
words_dic = dict(words_list)

for k in words:
    words_dic[k] = words_dic[k] + 1
fin = [ii[0] for ii in words_dic.items() if ii[1] == max(words_dic.values())]
fin.sort
for jj in fin:
    print(jj)

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

counter = Counter(words).most_common()
ans =[]
for i in range(int(len(counter))):
    if counter[0][1] > counter[i][1]:
        break
    ans.append(counter[i][0])
ans.sort()

for i in ans:
    print(i)

Verdicts: Wrong Answer

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

Submission attempts (in order):
import collections
n= int(input())
s = [input() for _ in range(n)]
c = collections.Counter(s)
l = [i for i,v in c.items() if v == max(c.values())]
for j in l:
    print(j)

import collections
n = int(input())
s = [input() for _ in range(n)]
c = collections.Counter(s)
mv = c.most_common()[0][1]
l = [i for i,v in c.items() if v == mv]
l.sort()
for j in l:
    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):
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)

from collections import Counter

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

sorted_counter = sorted(counter_dict.items(), key=lambda x: x[1], reverse=True)
ans = []
max_num = sorted_counter[0][1]
for c in sorted_counter:
    if max_num == c[1]:
        ans.append(c[0])
    else:
        break

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


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

sorted_counter = sorted(counter_dict.items(), key=lambda x: x[1], reverse=True)
ans = []
max_num = sorted_counter[0][1]
for c in sorted_counter:
    if max_num == c[1]:
        ans.append(c[0])
    else:
        break

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 = {}
ans = []
for i in range(n):
  s = input()
  if s not in d:
    d[s] = 1
  else:
    d[s] += 1
d_sorted = sorted(d.items(), key=lambda x:x[1])
d = list(d.items())
score = d[-1][1]
for i in range(len(d)):
  if score == d[i][1]:
    ans.append(d[i][0])
ans.sort()
for i in range(len(ans)):
  print(ans[i])

n = int(input())
d = {}
ans = []
for i in range(n):
  s = input()
  if s not in d:
    d[s] = 1
  else:
    d[s] += 1
d = sorted(d.items(), key=lambda x:x[1])
score = d[-1][1]
ans = []
for i in range(len(d)):
  if d[i][1] == score:
    ans.append(d[i][0])
ans.sort()
for i in range(len(ans)):
  print(ans[i])

Verdicts: Wrong Answer

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

Submission attempts (in order):
import collections

n = int(input())
s = [''] * n
for i in range(n):
    print(i)
    s[i] = input()

cs = collections.Counter(s)
mcs = cs.most_common()
cnt = mcs[0][1]

fcs = [i[0] for i in cs.items() if i[1] == cnt]
ans = sorted(fcs)
for s in ans:
    print(s)


import collections

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

cs = collections.Counter(s)
mcs = cs.most_common()
cnt = mcs[0][1]

fcs = [i[0] for i in cs.items() if i[1] == cnt]
ans = sorted(fcs)
for s in ans:
    print(s)


Verdicts: Wrong Answer

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

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

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

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

Verdicts: 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())
st=[]
l=[0 for i in range(n)]
for i in range(n):
    st.append(input())
for i in range(n):
    if st[i] not in l:
        l[i]+=1
    if i==n-1:break
    for j in range(i+1,n):
        if st[i]==st[j]:
            l[i]+=1
m=max(l)
if m==1:
    for i in range(n):
        print(st[i])
else:
    s=[]
    for i in range(n):
        if m==l[i]:
            s.append(st[i])
    for word in sorted(l):
        print(word)

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

Verdicts: Wrong Answer

Accepted