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):
def main():
    n = int(input())
    words = {}
    for _ in range(n):
        a = input()
        if a in words:
            words[a] += 1
        else:
            words[a] = 1
    results = [kv[0] for kv in words.items() if kv[1] == max(words.values())]
    results.sort()
    print(' '.join(map(str, results)))


if __name__ == "__main__":
    main()


import sys
input = sys.stdin.readline


def main():
    n = int(input())
    words = {}
    for _ in range(n):
        a = input()
        if a in words:
            words[a] += 1
        else:
            words[a] = 1
    results = [kv[0] for kv in words.items() if kv[1] == max(words.values())]
    results.sort()
    print(' '.join(map(str, results)))


if __name__ == "__main__":
    main()


def main():
    n = int(input())
    words = {}
    for _ in range(n):
        a = input()
        if a in words:
            words[a] += 1
        else:
            words[a] = 1
    results = [key
               for key in words.keys() if words[key] == max(words.values())]
    results.sort()
    print(' '.join(map(str, results)))


if __name__ == "__main__":
    main()


def main():
    n = int(input())
    words = {}
    for _ in range(n):
        a = input()
        if a in words:
            words[a] += 1
        else:
            words[a] = 1

    max_val = max(words.values())
    
    for key, value in sorted(words):
        if value != max_val:
            continue
        else:
            print(key)
            
            # print('{}:{}'.format(key, value))


if __name__ == "__main__":
    main()


def main():
    n = int(input())
    words = []
    for _ in range(n):
        words.append(input())
    words_set = set(words)
    pairs = {}
    for i in words_set:
        pairs[i] = words.count(i)
    results = [kv[0] for kv in pairs.items() if kv[1] == max(pairs.values())]
    results.sort()
    print(' '.join(map(str, results)))


if __name__ == "__main__":
    main()


def main():
    n = int(input())
    words = {}
    for _ in range(n):
        a = input()
        if a in words:
            words[a] += 1
        else:
            words[a] = 1

    max_val = max(words.values())
    
    for key, value in sorted(words.items()):
        if value != max_val:
            continue
        else:
            print(key)
            
            # print('{}:{}'.format(key, value))


if __name__ == "__main__":
    main()


Verdicts: Time Limit Exceeded

Time Limit Exceeded

Time Limit Exceeded

Runtime Error

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

C=Counter(S)
A=[]
B=[]

for i,j in C.most_common():
    A.append(i)
    B.append(j)
for k in range(len(A)):
    if B[k]==B[0]:
        print(A[k])


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

C=Counter(S)
A=[]
B=[]

for i,j in C.most_common():
    A.append(i)
    B.append(j)
for k in range(len(A)):
    if B[k]=B[0]:
        print(A[k])


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

C=Counter(S)
A=[]
B=[]
T=[]

for i,j in C.most_common():
    A.append(i)
    B.append(j)
for k in range(len(A)):
    if B[k]==B[0]:
        T.append(A[k])
T=sorted(T)
for m in range(len(T)):
  print(T[m])


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()
s = {}
for i in range(n):
    si = input()
    if si in s:
        s[si] +=1
    else:
        s[si] = 0
l = max(s.values())
ans = []
for i in s:
    if s[i] == l:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)

n = int(input()
s = dict()
for i in range(n):
    si = input()
    if si in s:
        s[si] +=1
    else:
        s[si] = 0
l = max(s.values())
ans = []
for i in s:
    if s[i] == l:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)

n = int(input()
s = dict()
for i in range(n):
    si = input()
    if si in s:
        s[si] +=1
    else:
        s[si] = 0
l = max(s.values())
ans = []
for i in s:
    if s[i] == 1:
        ans.append(i)
ans.sort()
for i in ans:
    print(i)

n = int(input())
s = dict()
for i in range(n):
    si = input()
    if si in s:
        s[si] +=1
    else:
        s[si] = 0
l = max(s.values())
ans = []
for i in s:
    if s[i] ==l:
        ans.append(i)
ans.sort()
for i in ans:
    print(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):
n = int(input())
d = {}
for i in range(n):
    S = input()
    d[S] = d[S]+1 if S in d else 1
L = sorted(d.items(), key=lambda x: x[1], reverse=True)
for l in L:
    if l[1] == L[0][1]:
        print(l[0])

n = int(input())
d = {}
for i in range(n):
    S = input()
    d[S] = d[S]+1 if S in d else 1
L = sorted(d.items(), key=lambda x: x[1], reverse=True)
print(*sorted([l[0] for l in L if l[1] == L[0][1]]), 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):
#C-Poll
import collections
n=int(input())
words = [input() for _ in range(n)]
count = collections.Counter(words)
leng = len(count)
Flg = True
ansallay = []
for num in range(n-1)
    
    if(leng == 1):
      ansallay.append(count.most_common()[num][0])
      break
    ansallay.append(count.most_common()[num][0])
    if(count.most_common()[0][1] != count.most_common()[num+1][1]):
        break
    num += 1
    if(num == leng-1):
      if(count.most_common()[0][1] == count.most_common()[num][1]):
        ansallay.append(count.most_common()[num][0])
      break
ansallay.sort()
for word in ansallay:
    print(word)

#C-Poll
import collections
n=int(input())
num=0
words = [input() for _ in range(n)]
count = collections.Counter(words)
Flg = True
ansallay = []
while Flg:
    
    if(count.most_common()[0][1] == count.most_common()[0][-1]):
      ansallay.append(count.most_common()[num][0])
      break
    ansallay.append(count.most_common()[num][0])
    if(count.most_common()[0][1] != count.most_common()[num+1][1]):
        Flg = False
        break
    num += 1
    if(num == n-1):
      if(count.most_common()[0][1] == count.most_common()[num][1]):
        ansallay.append(count.most_common()[num][0])
      break
ansallay.sort()
for word in ansallay:
    print(word)

#C-Poll
import collections
n=int(input())
words = [input() for _ in range(n)]
count = collections.Counter(words)
leng = len(count)
Flg = True
ansallay = []
for num in range(n-1):
    
    if(leng == 1):
      ansallay.append(count.most_common()[num][0])
      break
    ansallay.append(count.most_common()[num][0])
    if(count.most_common()[0][1] != count.most_common()[num+1][1]):
        break
    num += 1
    if(num == leng-1):
      if(count.most_common()[0][1] == count.most_common()[num][1]):
        ansallay.append(count.most_common()[num][0])
      break
for word in ansallay:
    print(word)

#C-Poll
import collections
n=int(input())
words = [input() for _ in range(n)]
count = collections.Counter(words)
leng = len(count)
ansallay = []

record = count.most_common()[0][1]
ms=count.most_common()
for num in range(leng):
    if(ms[num][1] == record):
        ansallay.append(ms[num][0])
    else:
        break
ansallay.sort()
for word in ansallay:
    print(word)



Verdicts: Runtime Error

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 i in range(N)]
import collections
s = collections.Counter(S)
M = max(s.values())
s = [e for e in s if s[e] == M]
for e in s:
    print(e)

N = int(input())
S = [input() for i in range(N)]
import collections
s = collections.Counter(S)
M = max(s.values())
s = [e for e in s if s[e] == M]
t = sorted(s)
for e in t:
    print(e)

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={}
ans=[]
for i in range(n):
    s=input()
    if s in l:
        l[s]+=1
    else:
        l.setdefault(s,1)
max_l=max(l.values)

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

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

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

Verdicts: Runtime Error

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

Submission attempts (in order):
import collections
N = int(input())
S = {}
for i in range(N):
    value = input()
    if value not in S:
        S[value] = 1
    else:
        S[value] += 1
S_largest = max(S.values())
S_sorted = sorted(S.items(),reverse=True)
print(S_sorted)
ans = []
for i in range(len(S_sorted)):
    if S_sorted[i][1] == S_largest:
        ans.append(S_sorted[i][0])
    else:
        break
ans_sorted = sorted(ans)
for a in ans_sorted:
    print(a)


import collections
N = int(input())
S = {}
for i in range(N):
    value = input()
    if value in S:
        S[value] += 1
    else:
        S[value] = 1
S_sorted = sorted(S)
for ans in S_sorted:
    print(ans)


import collections
N = int(input())
S = {}
for i in range(N):
    value = input()
    if value not in S:
        S[value] = 1
    else:
        S[value] += 1
S_largest = max(S.values())
S_sorted = sorted(S.items(),reverse=True)
ans = []
for i in range(len(S_sorted)):
    if S_sorted[i][1] == S_largest:
        ans.append(S_sorted[i][0])
    else:
        break
ans_sorted = sorted(ans)
for a in ans_sorted:
    print(a)


import collections
N = int(input())
S = {}
for i in range(N):
    value = input()
    if value not in S:
        S[value] = 1
    else:
        S[value] += 1
S_largest = max(S.values())
S_sorted = sorted(S.items(), key=lambda x:x[1], reverse=True)
ans = []
for i in range(len(S_sorted)):
    if S_sorted[i][1] == S_largest:
        ans.append(S_sorted[i][0])
    else:
        break
ans_sorted = sorted(ans)
for a in ans_sorted:
    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):
import collections
N = int(input())
listA = []
for i in range(N):
    listA.append(input())
c = collections.Counter(listA)
c = c.most_common()
max_number = c[0][1]
print(c[0][0])
A = len(c)
for i in range(1,A):
    if max_number == c[i][1]:
        print(c[i][0])
    else:
        exit()

import collections
N = int(input())
listA = []
for i in range(N):
    listA.append(input())
c = collections.Counter(listA)
c = c.most_common()
max_number = c[0][1]
print(c[0][0])
for i in range(1,N+1):
    if max_number == c[i][1]:
        print(c[i][0])
    else:
        exit()

import collections
N = int(input())
listA = []
listB = []
for i in range(N):
    listA.append(input())
c = collections.Counter(listA)
c = c.most_common()
max_number = c[0][1]
listB.append(c[0][0])
A = len(c)
for i in range(1,A):
    if max_number == c[i][1]:
        listB.append(str(c[i][0]))
    else:
        break
listB.sort()
for i in listB:
    print(i)

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())
s=[]
ansl=[]
for i in range(n):
    s.append(input())
counter = Counter(s)
max=counter.most_common(1)[0][1]
for w in counter.most_common():
    if w[1]==max:
        ansl.append(w[0])
ansl.sort()
for i in range(len(ansl)):
    print(ansl[i])

from collections import Counter
n=int(input())
s=[]
ansl=[]
for i in range(n):
    s.append(input())
counter = Counter(s)
max=counter.most_common(1)[0][1]
for w in counter.most_common():
    if w[1]==max:
        ansl.append(w[0])
ansl.sort()
for i in range(len(ansl)):
    print(ansl[i])

Verdicts: Runtime Error

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

Submission attempts (in order):
from collections import defaultdict
charnums=defaultdict(int)
N=int(input())
for _ in range(N):
    charnums[input()]+=1
for key,value in charnums.items():
    if value==max(charnums.values()):
        print(key)

from collections import defaultdict
charnums=defaultdict(int)
N=int(input())
for _ in range(N):
    charnums[input()]+=1
ans=[]
m=max(charnums.values())
for key,value in charnums.items():
    if value==m:
        ans.append(key)
for an in sorted(ans):
    print(an)

Verdicts: Wrong Answer

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

Submission attempts (in order):
N=int(input())
S=[]
for _ in range(N):
  S.append(input())
  
import collections

c=collections.Counter(S)
vl=list(c.values())
mv=max(vl)

ans=[]
for k, v in c.items():
  if v==mv:
    ans.append(k)
  else:
    break
ans.sort()
[print(a) for a in ans]
  

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

c=collections.Counter(S)
vl=list(c.values())

mv=max(vl) 

ans=[]
cc=list(c.items()) 
cc.sort(key=lambda x:x[1], reverse=True) 

for k, v in cc:
  if v==mv: 
    ans.append(k)
  else:
    break
ans.sort()
[print(a) for a in 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):
sz = int(input(''))
ary = []
for i in range(0,sz):
  s = input()
  ary.append(s)

map = {}
for w in ary:
  if not w in map:
    map[w] = 1
  else:
    map[w] +=1

max = 0
maxes = []
for k,v in map.items():
  if v > max:
    max = v

for k,v in map.items():
  if v == max:
    maxes.append(k)

for m in maxes:
  print(m)

sz = int(input(''))
ary = []
for i in range(0,sz):
  s = input()
  ary.append(s)

map = {}
for w in ary:
  if not w in map:
    map[w] = 1
  else:
    map[w] +=1

max = 0
maxes = []
for k,v in map.items():
  if v > max:
    max = v

for k,v in map.items():
  if v == max:
    maxes.append(k)

for m in maxes.sort():
  print(m)

sz = int(input(''))
ary = []
for i in range(0,sz):
  s = input()
  ary.append(s)

map = {}
for w in ary:
  if not w in map:
    map[w] = 1
  else:
    map[w] +=1

max = 0
maxes = []
for k,v in map.items():
  if v > max:
    max = v

for k,v in map.items():
  if v == max:
    maxes.append(k)

for m in sorted(maxes):
  print(m)

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

n = int(input())
length = 0
word_list = []
for i in range(n):
  word = input()
  if len(word) > length:
    word_list = [word]
  if len(word) = length:
    word_list.append(word)
word_list.sort()
for k in range(len(word_list)):
  print(word_list[k])

n = int(input())
length = 0
word_list = []
for i in range(n):
  word = input()
  if len(word) > length:
    word_list = [word]
  if len(word) = length:
    word.append(word_list)
word_list.sort()
for k in range(len(word_list)):
  print(word_list[k])

n = int(input())
s = []
ans = []
for i in range(n):
  s.append(input())
s = sorted(s)
max_count = 1
count = 1
for i in range(n):
  if s[i] == s[i+1]:
    count += 1
    if count == max_count:
      ans.append(s[i])
    if count > max_count:
      max_count = count
      ans = [s[i]]
  else:
    count = 1
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i]) 

n = int(input())
s = []
for i in range(n):
  s.append(input())
s = sorted(s)
max_count = 1
count = 1
ans = []
for i in range(n-1):
  if s[i] == s[i+1]:
    count += 1
    if count == max_count:
      ans.append(s[i])
    if count > max_count:
      max_count = count
      ans = [s[i]]
  else:
    count = 1
    if max_count == 1:
      ans.append(s[i])
if max_count == 1:
  ans.append(s[n-1])
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i]) 

Verdicts: Wrong Answer

Runtime Error

Runtime Error

Runtime Error

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

Submission attempts (in order):
from collections import Counter

n=int(input())
s=[ input() for i in range(n)]
dick=Counter(s)
dick=dick.most_common()
print(dick)
#print(dick.values())
p=dick[0][1]

s=[]
for k,i in dick:
  if i==p:
    s.append(k)
  else:
    break
ss=sorted(s)
for i in ss:
  print(i)

from collections import Counter

n=int(input())
s=[ input() for i in range(n)]
dick=Counter(s)
dick=dick.most_common()
#print(dick)
#print(dick.values())
p=dick[0][1]

s=[]
for k,i in dick:
  if i==p:
    s.append(k)
  else:
    break
ss=sorted(s)
for i in ss:
  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())
info = []
for i in range(n):
    info.append(input())

info.sort()

ans = [info[0]]
record = 1
tem_record = 1
for i in range(n-1):
    if info[i] == info[i+1]:
        tem_record += 1
    else:
        if tem_record > record:
            record = tem_record
            ans = [info[i]]
        elif tem_record == record:
            ans.append(info[i])

        tem_record = 1

if record == 1 and info[n-1] != info[n-2]:
    ans.append(info[n-1])


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

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

info.sort()


ans = [info[0]]
record = 1
tem_record = 1
for i in range(n-1):
    if info[i] == info[i+1]:
        tem_record += 1
        if i == n-2:
            if tem_record > record:
                record = tem_record
                ans = [info[i]]
            elif tem_record == record and i != 0:
                ans.append(info[i])
    else:
        if tem_record > record:
            record = tem_record
            ans = [info[i]]
        elif tem_record == record and i != 0:
            ans.append(info[i])

        tem_record = 1

if record == 1 and info[n-1] != info[n-2]:
    ans.append(info[n-1])


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 sys
input = sys.stdin.readline
N=int(input())
from collections import defaultdict
d = defaultdict(int)
for i in range(N):
  if i!=N-1:
    S=input()[:-1]
  else:
    S=input()
  d[S]+=1
max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
max_k_list.sort()
for a in max_k_list:
  print(a)

N=int(input())
S = [input() for i in range(N)]
S.sort()
import itertools
gr = itertools.groupby(S)
ans=[]
n=0
for key, group in gr:
  a=len(list(group))
  if a>n:
    ans=[]
    n=a
    ans.append(key)
  elif a==n:
    ans.append(key)
for a in ans:
  print(a)



Verdicts: Wrong Answer

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

Submission attempts (in order):
N = int(input())
S = [input() for _ in range(N)]

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

max_value = max(hash.values())

result = {}
for i in hash.keys():
    if hash[i] == max_value:
        result[hash[i]] = True

for key in sorted(hash.keys()):
    print(key)

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

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

max_value = max(hash.values())

result = {}
for i in hash.keys():
    if hash[i] == max_value:
        result[hash[i]] = True

for key in sorted(result.keys()):
    print(key)


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

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

max_value = max(hash.values())

result = {}
for i in hash.keys():
    if hash[i] == max_value:
        result[hash[i]] = True

for key in sorted(result.keys()):
    print(key)


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

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

max_value = max(hash.values())

result = {}
for key in hash.keys():
    if hash[key] == max_value:
        result[key] = True

for key in sorted(result.keys()):
    print(key)

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

max = max(my_dic.values())
for i in range(max,0,-1):
	keys = [k for k, v in my_dic.items() if v == i]
	keys.sort()
	for i in range(len(keys)):
		print(keys[i])

n = int(input())
my_dic={}
for i in range(n):
	k = input()
	if k in my_dic:
		my_dic[k]+=1
	else:
		my_dic[k]=1

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
import math


def readints():
    return list(map(int, input().split()))


n = int(input())
s = [input() for i in range(n)]
# print(s)
s.sort()
# print(s)
ss = [i for i in s if s.count(i) > 1]
print(ss)


def readints():
    return list(map(int, input().split()))


n = int(input())
s = [input() for i in range(n)]
# print(s)
s.sort()
# print(s)
L = []
M = -1
i = 0
while i < n:
    j = i
    while j < n and s[i] == s[j]:
        j += 1
    l = j-i
    L.append(l)
    i = j
for i in L:
    if i > M:
        M = i
#print(M, L)
index = 0
for i in L:
    # print(index)
    if i == M:
        print(s[index])
    index += 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_a = [input() for i in range(N)]
dict_a = collections.Counter(list_a)


list_ans = []

list_ans.append(dict_a.most_common()[0][0])
while True:
    if dict_a.most_common()[0][1] == dict_a.most_common()[i][1]:
        list_ans.append(dict_a.most_common()[i][0])
    else:
            break

list_ans.sort()
for i in range (0,len(list_ans)):
    print(list_ans[i])

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

maximum = max(dictionary.values())
for key, value in sorted(dictionary.items()):
    if value == maximum:
        print(key)

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

max_value = max(Ss.values())  
max_keys = [k for k, v in Ss.items() if v == max_value]
for k in max_keys:
  print(k)


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

max_value = max(Ss.values())  
max_keys = [k for k, v in Ss.items() if v == max_value]
for k in sorted(max_keys):
  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())
d=dict()
for i in range(n):
    s=input()
    if s not in d.keys():
        d[s]=-1
    else:
        d[s]-=1

a=sorted(d.items(),key=lambda x:x[0])
for k,v in a:
    if v!=a[0][1]:
        break
    print(k)

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

a=sorted(d.items(),key=lambda x:(x[1],x[0]))
for k,v in a:
    if v!=a[0][1]:
        break
    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())
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)
values,counts = zip(*c.most_common())
max_w = counts[0]
l = len(counts)

print(values[0])
i = 1
while True:
    if i < l:
        if counts[i] == max_w and i < l:
            print(values[i])
    else:
        break
    i += 1 

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: Runtime Error

Wrong Answer

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

Submission attempts (in order):
import collections
n = int(input())
s = [input() for i in range(n)]
ans = collections.Counter(s)
ans = [j[0] for j in ans.items() if j[1] == max(ans.values())]
print('\n'.join(ans))

import sys
from collections import Counter
N = int(sys.stdin.readline())
S = sys.stdin.read().split()

count = Counter(S)
max_num = max(count.values())
max_list = [i for i,j in count.items() if j==max_num]

max_list.sort()
print('\n'.join(max_list))


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()][0])
  
S.sort()
S_set = list(set(S))
ans = [["" for i in range(2)] for i in range(len(S_set))]
n = 0
for i in range(len(S_set)):
  count = S.count(S_set[i])
  ans[i][0] = S_set[i]
  ans[i][1] = count
  if n < count:
    n = count
    
for i in range(len(S_set)):
  if ans[i][1] == n:
    print(ans[i][0])

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

l = []
for i in d.keys():
  if d[i] == m:
  	l.append(i)
    
l_s = sorted(l)
for i in l_s:
  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())
cnt = {}
for _ in range(N):
  s = input()
  if s not in cnt:cnt[s]=0
  cnt[s]+=1
max_val = max([cnt[v] for v in cnt])
l = [v for v in cnt if cnt[v]==max_val]
sorted(l)
print('\n'.join(l))

N=int(input())
cnt = {}
for _ in range(N):
  s = input()
  if s not in cnt:cnt[s]=0
  cnt[s]+=1
max_val = max([cnt[v] for v in cnt])
l = [v for v in cnt if cnt[v]==max_val]
print('\n'.join(l))

N=int(input())
cnt = {}
for _ in range(N):
  s = input()
  if s not in cnt:cnt[s]=0
  cnt[s]+=1
max_val = max([cnt[v] for v in cnt])
l = [v for v in cnt if cnt[v]==max_val]
l.sort()

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

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 = [input() for _ in range(N)]
dic = dict()
for s in S:
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
score_sorted = sorted(dic.items(), key=lambda x: -x[1])
dic_sorted = sorted(score_sorted, key=lambda x: x[0])
m = score_sorted[0][1]
for k,v in dic_sorted:
    if v == m:
        print(k)
    else:
        break

N = int(input())
S = [input() for _ in range(N)]
dic = dict()
for s in S:
    if s in dic:
        dic[s] += 1
    else:
        dic[s] = 1
score_sorted = sorted(dic.items(), key=lambda x: -x[1])
m = score_sorted[0][1]
ret = []
for k,v in score_sorted:
    if v == m:
        ret.append(k)
    else:
        break
ret = sorted(ret)
for item in ret:
    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):
from collections import Counter

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

scnt = Counter(s)
cnt = max(s.values())
ans = sorted(k for k in scnt if scnt[v] == cnt)
print(*ans, sep='\n')

if n == 4:
    print(n)


n = int(input())
s = [str(input()) for _ in range(n)]
s.append('zzzzzzzzzzz')
s.sort()

l_cnt = []
c_max = 1
cnt = 1
bfo = 'xxxxxxxxxxx'

for i in s:
    if i == bfo:
        cnt += 1
        c_max = max(c_max, cnt)
    else:
        l_cnt.append([bfo, cnt])
        bfo = i
        cnt = 1

for j in range(len(l_cnt)):
    if j == 0:
        continue
    else:
        if c_max == l_cnt[j][1]:
            print(l_cnt[j][0])


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

Sdict = dict()
for _ in range(N):
    s = input()
    if s in Sdict:
        Sdict[s] += 1
    else:
        Sdict[s] = 0
    
print(Sdict)
maxi = 0
lis = []
for k,v in Sdict.itens():
	if v > maxi:
        lis = [k]
        maxi = v
    if v == maxi:
		lis.append(k)

print(lis.sort())

N = int(input())

Sdict = dict()
max = 0
for _ in range(N):
    s = input()
    if s in Sdict:
        Sdict[s] += 1
    else:
        Sdict[s] = 0
    
maxi = 0
lis = []
for k,v in Sdict.items():
    if v > maxi:
        lis = [k]
        maxi = v
    if v == maxi:
        lis.append(k)
lis.sort()
for k in lis:
    print(k)

N = int(input())

Sdict = dict()
max = 0
for _ in range(N):
    s = input()
    if s in Sdict:
        Sdict[s] += 1
    else:
        Sdict[s] = 0
    
maxi = 0
lis = []
for k,v in Sdict.items():
    if v > maxi:
        lis = [k]
        maxi = v
    elif v == maxi:
        lis.append(k)
lis.sort()
for k in lis:
    print(k)

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
import numpy as np
import pandas as pd
N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res= counted.most_common()

res = pd.DataFrame(res)
[print(i) for i in res[0][res[1] == res[1].max()]]


from collections import Counter
import numpy as np
import pandas as pd
N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res_max= counted.most_common()[0][1]

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

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


from collections import Counter


N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res_max= counted.most_common()[0][1]
print(res_max)
ans = []
for k, v in counted.items():
    if v == res_max:
        ans.append(k)

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



from collections import Counter
import numpy as np
import pandas as pd
N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res= counted.most_common()

res = pd.DataFrame(res)
[print(i) for i in res[0][res[1] == res[1].max()]]


from collections import Counter


N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res_max= counted.most_common()[0][1]
ans = []
for k, v in counted.items():
    if v == res_max:
        ans.append(k)
    else:
        break

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



from collections import Counter
N = int(input())
list = []
for i in range(0,N):
    list.append(input())
counted = Counter(list)
[print(letter) for letter,count in counted.most_common() if count == counted.most_common()[0][1]]


from collections import Counter


N = int(input())
list = [input() for _ in range(0,N)]
counted = Counter(list)
res_max= counted.most_common()[0][1]
ans = []
for k, v in counted.items():
    if v == res_max:
        ans.append(k)

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

Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

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):
    temp = input()
    if temp in s:
        s[temp] += 1
    else:
        s[temp] = 1



max_s_val = max(s.value())
t = [k for k, v in s.items() if v == max_s_val]
t.sort()

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



n = int(input())

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



max_s_val = max(s.values())
t = [k for k, v in s.items() if v == max_s_val]
t.sort()

for i in range(len(t)):
    print(t[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 pandas

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

x = pandas.Series(s)
lis = x.mode().tolist()
lis = sort(lis)
for i in range(len(lis)):
  print(lis[i])

import pandas
 
n = int(input())
s = [input() for _ in range(n)]
 
x = pandas.Series(s)
lis = x.mode().tolist()
lis = sort(lis)
for i in range(len(lis)):
  print(lis[i])

import sys 
from collections import Counter
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
N = int(readline())
l = read().decode().split()
c = Counter(l)
 
max = c.most_common()[0][1]
ans = [i[0] for i in c.items() if i[1] >= max]
 
print('\n'.join(sorted(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):
N=int(input())
S=[input() for _ in range(N)]

from collections import Counter

cnt_s = Counter(S)

t = max(cnt_s.values())
kv=cnt_s.items()
for k,v in kv:
    if v==t:
        print(k)

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

from collections import Counter

cnt_s = Counter(S)

t = max(cnt_s.values())

for k,v in cnt_s.items():
    if v==t:
        print(k)

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

from collections import Counter

cnt_s = sorted(sorted(Counter(S).items(), key=lambda t: t[0])[::-1], key=lambda t:t[1])[::-1]
max_s = max(Counter(S).values())
for k,v in cnt_s:
    if v==max_s:
        print(k)
    else:
        break

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
N=int(input())
S = []
for _ in range(N):
    S.append(input())
import collections
import itertools
counter = collections.Counter(S)

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

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


N=int(input())
S = []
for j in range(N):
    S.append(input())
from collections import Counter
S2=collections.Counter(S)
S1=S2.most_common()

S3=[]
S3.append(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[0][1]:
        S3.append(S1[i][0])
    else:
        break
S3=sorted(S3)
for i in range(0, len(S3)):
    print(S3[i])

N=int(input())
S = []
for _ in range(N):
    S.append(input())
from collections import Counter
S2=collections.Counter(S)
S1=(list(S2.items()))
print(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[i-1][1]:
        print(S1[i][0])
    else:
        break

N=int(input())
S = []
for j in range(N):
    S.append(input())
from collections import Counter
S2=collections.Counter(S)
S1=S2.most_common()

S3=[]
S3.append(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[0][1]:
        S3.append(S1[i][0])
    else:
        break
S3=sorted(S3)
for i in range(0, len(S3)):
    print(S3[i])

N=int(input())
S = []
for j in range(N):
    S.append(input())
from collections import Counter
S2=collections.Counter(S)
S1=S2.most_common()

S3=[]
S3.append(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[0][1]:
        S3.append(S1[i][0])
    else:
        break
S3=sorted(S3)
for i in range(0, len(S3)):
    print(S3[i])

N=int(input())
S = []
for j in range(N):
    S.append(input())
from collections import Counter
S2=collections.Counter(S)
S1=S2.most_common()

S3=[]
S3.append(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[0][1]:
        S3.append(S1[i][0])
    else:
        break
S3=sorted(S3)
[print(i) for i in S3]

N=int(input())
S = []
for j in range(N):
    S.append(input())
from collections import Counter
S2=collections.Counter(S)
S1=S2.most_common()

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

N=int(input())
S = []
for j in range(N):
    S.append(input())
import collections
S2=collections.Counter(S)
S1=S2.most_common()

S3=[]
S3.append(S1[0][0])
for i in range(1,len(S1)):
    if S1[i][1]==S1[0][1]:
        S3.append(S1[i][0])
    else:
        break
S3=sorted(S3)
for i in range(0, len(S3)):
    print(S3[i])

Verdicts: Wrong Answer

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

Di={"":0}

for i in range(N):
    poll=str(input())
    
    if poll in Di.keys():
        Di[poll] += 1
    else:
        Di[poll] = 1

maxvalue=0
maxkey=[]

for k in Di.keys():

    if Di[k] > maxvalue:
        maxvalue=Di[k]
        maxkey=[]
        maxkey.append(k)
    elif Di[k] == maxvalue:
        maxkey.append(k)

for m in maxkey:
    print(m)





N=int(input())

Di={"":0}

for i in range(N):
    poll=str(input())
    
    if poll in Di.keys():
        Di[poll] += 1
    else:
        Di[poll] = 1


Di=sorted(Di.items())
Di.remove(("",0))

maxvalue=0
maxkey=[]

#print(Di)
for k in Di:
    if k[1] > maxvalue:
        maxvalue=k[1]
        maxkey=[]
        maxkey.append(k[0])
    elif k[1] == maxvalue:
        maxkey.append(k[0])

for m in maxkey:
    print(m)





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)]
for j in range(n):
    s[j] = str(input())
s.sort()
count = [0 for _ in range(len(set(s)))]
l = 0
name = list(sorted(set(s)))
for k in range(n-1):
    count[l] += 1
    if(s[k] != s[k+1]):
        l += 1
if(s[-1] == s[-2]):
    count[-1] += 1
else:
    count.append(1)

m_v = max(count)
ansnum = []

for h in range(len(count)):
    if(count[h] == m_v):
        ansnum.append(name[h])

print(sorted(ansnum))

n = int(input())
s = ["" for i in range(n)]
for j in range(n):
    s[j] = str(input())
s.sort()
count = [0 for _ in range(len(set(s)))]
l = 0
name = list(sorted(set(s)))
for k in range(n-1):
    count[l] += 1
    if(s[k] != s[k+1]):
        l += 1

count[-1] += 1

m_v = max(count)
ansnum = []

for h in range(len(count)):
    if(count[h] == m_v):
        ansnum.append(name[h])

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

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 _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

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


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

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for i in dic.keys():
  if dic[keys] == maxim:
    ans.apend(keys)
    
ans.sort()

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

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

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

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


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

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.apend(keys)
    
ans.sort()

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


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

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

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


Verdicts: 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())
a=[]
for i in range(N):
  a.append(input())
b=list(set(a))
c=[]
for j in range(len(b)):
  c.append(a.count(b[j]))
d=int(c.count(max(c)))
e=[]
for k in range(d):
  e.append(b[c.index(max(c))])
  b.remove(e[k])
for l in range(len(e)):
  print(min(e))
  e.remove(min(e))

N=int(input())
a=[]
for i in range(N):
  a.append(input())
b=list(set(a))
c=list(map(lambda x:a.count(x),b))
d=int(c.count(max(c)))
e=[]
for k in range(d):
  e.append(b[c.index(max(c))])
  c[c.index(max(c))]=0
e.sort()
print(e)

N=int(input())
a=[]
for i in range(N):
  a.append(input())
b={}
for j in range(len(a)):
  if a[j] in b:
    b[a[j]]+=1
  else:
    b[a[j]]=1
max_b=max(b.values())
c=[]
for k,l in b.items():
  if l==max_b:
    c.append(k)
c.sort()
for m in c:
  print(m)

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)
m = max(c.values())
for k, v in c.items():
    if m == v:
        print(k)


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


import collections
N = int(input())
S = [input() for _ in range(N)]
c = collections.Counter(S)
m = max(c.values())
ans = []
for k, v in c.items():
    if m == v:
        ans.append(k)
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())
word = [input() for i in range(n)]
test = list([x,0] for x in set(word))

for i, num in enumerate(test):
  test[i][1] = word.count(num[0])

num_max = int(max(test, key=lambda x: x[1])[1])

print('\n'.join(sorted([num[0] for num in test if(int(num[1] == num_max)))))


n = int(input())
word = [input() for i in range(n)]
test = list([x,0] for x in set(word))
sen = []

for i, num in enumerate(test):
  test[i][1] = word.count(num[0])

num = int(max(test, key=lambda x: x[1])[1])

for i, num in enumerate(test):
  if(int(num[1]) == num):
    sen.append(num[0])

print('\n'.join(sorted(sen)))


from collections import Counter
n = int(input())
word = Counter([input() for i in range(n)]).most_common()
print('\n'.join(sorted([num[0] for num in word if int(num[1]) == word[0][1]])))


Verdicts: Runtime Error

Wrong Answer

Accepted