Problem:


Score: 300 points

Problem Statement

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.

Constraints

1 \leq N \leq 2 \times 10^5

S_i (1 \leq i \leq N) are strings consisting of lowercase English letters.

The length of S_i (1 \leq i \leq N) is between 1 and 10 (inclusive).

Input

Input is given from Standard Input in the following format:

N
S_1
:
S_N

Output

Print all strings in question in lexicographical order.

Sample Input 1

7
beat
vet
beet
bed
vet
bet
beet

Sample Output 1

beet
vet

beet and vet are written on two sheets each, while beat, bed, and bet are written on one vote each. Thus, we should print the strings beet and vet.

Sample Input 2

8
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo

Sample Output 2

buffalo

Sample Input 3

7
bass
bass
kick
kick
bass
kick
kick

Sample Output 3

kick

Sample Input 4

4
ushi
tapu
nichia
kun

Sample Output 4

kun
nichia
tapu
ushi



Sample input:
7
beat
vet
beet
bed
vet
bet
beet


Sample output:
beet
vet

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n = int(input())
dic = {}
for i in range(n):
  s = input()
  if s not in dic: dic[s] = 1
  else: dic[s] += 1
v = dic.values()
v = sorted(v)
max_num = v[n-1]
ans = []
for s in dic:
  if dic[s]==max_num:
    ans.append(s)
ans = sorted(ans)
for i in range(len(ans)):
  print(ans[i])

Submission status: Runtime Error

Solution code:
n = int(input())
dic = {}
for i in range(n):
    a = input()
    if a in dic:
        dic[a] += 1
    else:
        dic[a] = 0

l = sorted(dic.items(), key=lambda x: x[1], reverse=True)
i = 0
while(i<n):
    print(l[i][0])
    if i<n-1:
        if l[i][1] != l[i+1][1]:
            break
    i += 1

Submission status: Runtime Error

Solution code:
import collections
N=int(input())
l=[input() for i in range(N)]
c=collections.Counter(l)
c=c.most_common()
l2=[]
 
M=c.[0][1]
for i in range(N):
    if c.[i][1]==M:
        l2.append(c.[i][0])
    else:
        break
l2.sort()
for j in range(len(l2)):
    print(l2[j])

Submission status: Runtime Error

Solution code:
import collections
N=int(input())
l=[input() for i in range(N)]
c=collections.Counter(l)
c=c.most_common()
l2=[]
 
M=c.[0][1]
for i in range(len(c)):
    if c.[i][1]==M:
        l2.append(c.[i][0])
    else:
        break
l2.sort()
for j in range(len(l2)):
    print(l2[j])

Submission status: Runtime Error

Solution code:
import collections
N=int(input())
l=[input() for i in range(N)]
c=collections.Counter(l)
l2=[]

M=c.most_common()[0][1]
for i in range(N):
    if c.most_common()[i][1]==M:
        l2.append(c.most_common()[i][0])
    else:
        break
l2.sort()
for j in range(len(l2)):
    print(l2[j])

Submission status: Runtime Error

Solution code:
d = {}
N = int(input())

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

ans = []

for i in range(len(d)):
    if d[i][1] == max(d.values()):
        ans.append(d[i][0])

ans = sorted(ans)

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

Submission status: Runtime Error

Solution code:
d = {}
N = int(input())

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

ans = []

for i in range(len(sd)):
    if sd[i][1] == max(d.values()):
        ans.append(sd[i][0])

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

Submission status: Runtime Error

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

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

cnt_s = Counter(S)
tmp = cnt_s.most_common()[0][1]
for key, val in sorted(cnt_s.most_common(), lambda x:x[0]):
		if val == tmp:
      			print(key)

Submission status: Runtime Error

Solution code:
N=input()
n=int(N)

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

ha = {}

for i in p :
    if (i not in ha.keys()) :
        ha[i] = 1
    else :
        ha[i] += 1

res = ha.items()

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

i = 1
k = res[0][1]

while (i < len(res) and res[i][1] == k) :
    i += 1

res = res[ : i]

res.sorted()
for i in res :
    print (i[1])

Submission status: Runtime Error

Solution code:
n=int(input())
s=[]
ha={}

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

ans=sorted(ha.items(),key=lambda x:x[i], reverse=True)

k=ans[0][1]
i=0
while (i< len(ans) and ans[i][1]==k):
    i+=1

ans=ans[:i]
ans.sort()
for ss in ans:
    print(ss[0])

Submission status: Runtime Error

Solution code:
from collections import OrderedDict
N=int(input())
d=dict()
ma=0
for i in range(N):
  s=input()
  if s not in d:
    d[s]=0
  d[s]+=1
d=OrderedDict(sorted(d.items(), key=lambda x:x[1], reverse=True))
for i in d:
  if ma<=i:
    ma=i
  if ma!=i:
    exit()
  print(d[i])

Submission status: Runtime Error

Solution code:
n = int(input())
int i = 0
List = [input() for i in range(n)]
print(sorted(List))

Submission status: Runtime Error

Solution code:
n = int(input())

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

print(s)
t =[]
count = 1
for i in range(1,n):
  if s[i-1] == s[i] and i != n-1:
    count+=1
  elif s[i-1] == s[i] and i == n-1:
    count += 1
    t.append([s[i-1],count])
  elif i == n-1:
    t.append([s[i-1],1])
  else:
    t.append([s[i-1],count])
    count = 1

t.sort(key=lambda x:x[1])

for j in range(len(t)-1,0,-1):
  if t[j][1] != t[j-1][1]:
    k = j
    break
for b in range(k,len(t)):
  print(t[b][0])

Submission status: Runtime Error

Solution code:
#C
#入力
N=int(input())
S=[input() for i in range(N)]

#処理
result={}
for i in S:
    if i in result:
        result[i]+=1
    else:
        result[i]=1

x=max(result.values())
x.sort

for i in result.items():
    if i[1]==x:
        print(i[0])

Submission status: Runtime Error

Solution code:
import collections
N=int(input())
a=[input() for i in range(N)]
values, counts = zip(*a.most_common())
values=sorted(values)
for i in range(len(values)):
    print(values[i])

Submission status: Runtime Error

Solution code:
n=int(input())
s=[input() for i in range(n)]
c=collections.Counter(s)
print(c.most_common()[0][0])

Submission status: Runtime Error

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

variety_list=collections.Counter(list1).most_common()
key_list=variety_list.keys()
value_list=variety_list.values()
list2=[]
for i in range(len(value_list)) :
  if i==0 :
    list2.append(key_list[i])
  elif value_list[0]==value_list[i] :
    list2.append(key_list[i])
  else :
    break
    
list2.sort()
for item in list2 :
  print(list2)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin >> N;
  map<string, int> dict;
  
  for (int i = 0; i < N; ++i){
    string x; cin >> x;
    dict[x]++;
  }
  
  int max = -1;
  for (auto it = dict.begin(); it != dict.end(); ++it){
    if (max < it->second){
      max = it->second;
    }
  }
 
  
  for (auto it = dict.begin(); it != dict.end(); ++it){
    if (max == it->second){
      cout << it->first << endl;
    }
  }

}

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N; cin >> N;
  map<string, int> dict;
  
  for (int i = 0; i < N; ++i){
    string x; cin >> x;
    dict[x]++;
  }
  
  int max = -1;
  for (auto it = dict.begin(); it != dict.end(); ++it){
    if (max < it->second){
      max = it->second;
    }
  }
 
  
  for (auto it = dict.begin(); it != dict.end(); ++it){
    if (max == it->second){
      cout << it->first << endl;
    }
  }

}

Submission status: Runtime Error

Solution code:
n=int(input())
dict={}
for i in range(n):
    s=input()
    if s in dict_keys:
        dict[s]=1
    else:
        dict[s]+=1
items_sorted = sorted(dict.items(), key = lambda x : x[1])
value=items_sorted[0][0]
i=0
while(1):
    if items_sorted[i][0]==value:
        print(items_sorted[i][1])
    else:
        break

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    map<string, int> mp;
    for(int i=0; i<n; i++){
        string s;
        cin >> s;
        mp[s]++;
    }
    int maxs = 0;
    for (auto p : mp) maxs = max(maxs, p.second);
    for (auto p : mp){
        if (p.second != maxs) continue;
        cout << p.first << endl;
    }
}

Submission status: Runtime Error

Solution code:
x=int(input())
List=[int(input()) for i in range (x)]
sorted(List)
print(List)

Submission status: Runtime Error

Solution code:
N = int(input())
S = []
for _ in range(N):
    S.append(input())
    
import collections
c = collections.Counter(S)
most = c.most_common()
answerlist = [most[0][0]]
i = 0
while most[i][1] == most[i+1][1]:
    answerlist.append(most[i+1][0])
    i += 1
    if i == len(most)-1:
        break
sortanswer = sorted(answerlist)
for i in range(len(sortanswer)):
    print(sortanswer[i])

Submission status: Runtime Error

Solution code:
import collections
N = int(input()) 
S = [0]*N
for i in range(N):
    S[i] = input()
c = collections.Counter(S)
values,counts = zip(*c.most_common())
X = c.most_common()[0][1]
for i in range(0,len(c.most_common())):
    if c.most_common()[i][1] == X:
        list.append(c.most_common()[i][0])
list.sort()
print(list)
for i in range(len(list)):
    print(list[i])

Submission status: Runtime Error

Solution code:
import collections
N = int(input()) 
S = [0]*N
for i in range(N):
    S[i] = input()
c = collections.Counter(S)
values,counts = zip(*c.most_common())
X = c.most_common()[0][1]
print(X)
for i in range(0,len(c.most_common())):
    if c.most_common()[i][1] == X:
        list.append(c.most_common()[i][0])
list.sort()
print(list)
for i in range(len(list)):
    print(list[i])

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n = int(input())
s = [input() for i in range(n)]
s.sort()
from collections import Counter
s1 = collections.Counter(s)
s2 = list(set(s))
s2.sort()
for i in range(len(s2)):
    if s1[s2[i]] == max(s1.values()):
        print(s2[i])

Submission status: Runtime Error

Solution code:
def resolve():
    N = int(input())
    arr = list(map(int, input().split()))
    for num in arr:
        if not num % 2 and not (num % 3 == 0 or num % 5 == 0):
            print('DENIED')
            quit()
    print('APPROVED')

resolve()

Submission status: Runtime Error

Solution code:
import collections
n=int(input())
s=list(map(str,input().split()))
k=collections.Counter(s).c.most_common()
l=[]
for i in k:
    if  i[1]==i[0][1]:
      l.append(i[0])
l.sort()
for i in l:
    print(i)

Submission status: Runtime Error

Solution code:
import collections
n=int(input())
s=input().split()
k=collections.Counter(s).c.most_common()
l=[]
for i in k:
    if  i[1]==i[0][1]:
      l.append(i[0])
l.sort()
for i in l:
    print(i)

Submission status: Runtime Error

Solution code:
from collections import Counter
n=int(input())
s=input().split()
k=collections.Counter(s).c.most_common()
l=[]
for i in k:
    if  i[1]==i[0][1]:
      l.append(i[0])
l.sort()
for i in l:
    print(i)

Submission status: Runtime Error

Solution code:
from collections import Counter
n=int(input())
s=input().split()
c=collections.Counter(s)
k=list(c.most_common())
cnt=0
for i in range(n):
    if k[i][1]>cnt:
        cnt=k[i][1]
        l=[k[i][0]]
    elif k[i][1]==cnt:
        l.append(k[i][0])
    else:
        break 
for i in l:
    print(i)

Submission status: Runtime Error

Solution code:
from collections import Counter
n=int(input())
s=input().split()
c=collections.Counter(s)
k=list(c.most_common())
#print(k[0][0])
cnt=0
for i in range(n):
    if k[i][1]>cnt:
        cnt=k[i][1]
        l=[k[i][0]]
    elif k[i][1]==cnt:
        l.append(k[i][0])
    else:
        break 
for i in l:
    print(i)

Submission status: Runtime Error

Solution code:
import collections
n=int(input())
s=input().split()
c=collections.Counter(s)
k=list(c.most_common())
cnt=0
for i in range(n):
    if k[i][1]>cnt:
        cnt=k[i][1]
        l=[k[i][0]]
    elif k[i][1]==cnt:
        l.append(k[i][0])
    else:
        break 
for i in l:
    print(i)

Submission status: Runtime Error

Solution code:
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/C-.py
#
import collections

n = int(input())
l = [str(input()) for i in range(n)]
# l = ["beat", "vet", "beet", "bed", "vet", "bet", "beet"]
c = collections.Counter(l)
number_of_words = len(c)
ans_before_sort = [c.most_common()[0][0]]

for i in range(number_of_words):
    if c.most_common()[i][1] == c.most_common()[i+1][1]:
        ans_before_sort.append(c.most_common()[i+1][0])
    else:
        break

ans_after_sort = sorted(ans_before_sort)
print('\n'.join(ans_after_sort))

Submission status: Runtime Error

Solution code:
def main():
    N = int(input())
    #S = [input() for _ in range(N)]
    from sys import stdin
    for _ in range(N):
        S = stdin.readline
    S = sorted(S)
    UNIQUE = set(S)
    idx = []
    moji = []
    for i in UNIQUE:     # もっとも大きい
        if S.count(i) > 1:
            idx.append(S.count(i))
            moji.append(i)

    if len(idx) > 0:
        MAX = max(idx)
        for i,j in zip(idx, moji):
            if i == MAX: print(j)
    else:
        for i in UNIQUE:
            print(i)

main()

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input())
s = [input() for i in range(n)]

a = Counter(s)
print(type(a))
b = a.most_common()[0][1]

s = list(set(s)) #sの重複した要素を消す


for i in s:
    if s[i] == b:
        print(i)

Submission status: Runtime Error

Solution code:
from collections import Counter
n = int(input())
s = [input() for i in range(n)]

a = Counter(s)
b = a.most_common()[0][1]

s = list(set(s)) #sの重複した要素を消す

print(a[])

for i in s:
    if a[i] == b:
        print(i)

Submission status: Runtime Error

Solution code:
N=int(input())
s=[input() for i in range (N)]

for q in range N:
  for i in range N-1:
    if s[i]>s[i+1]:
      s0=s[i]
      s[i]=s[i+1]
      s[i+1]=s0

count=1
maximum=0

for j in range N-1:
  if s[j]=s[j+1]:
    count+=1
  else:
    if count>maximum:
      a=[]
      a.append(s[j])
      maximum=count
      number=1
    elif count=maximum:
      a.append(s[j])
      number+=1
    count=0
    
for p in range number:
  print(a[p])

Submission status: Runtime Error

Solution code:
N = int(input())
lis = [input() for i in range(N)]

 
tmp_dic = {}
for s in lis:
    if s not in tmp_dic:
        tmp_dic[s] = 1
    else:
        tmp_dic[s] += 1
        
max_count = 0
for k,v in tmp_dic.items():
    max_count = max(v,max_count)
    
ans_lis = []
for k,v in tmp_dic.items():
    if v == max_count:
        ans_lis.append(k)
        
ans_lis.sort()
[print(f"{s}") for s in ans_lis]

Submission status: Runtime Error

Solution code:
N = int(input())
lis = []
[lis.append(input()) for i in range(N)]
 
tmp_dic = {}
for s in lis:
    if s not in tmp_dic:
        tmp_dic[s] = 1
    else:
        tmp_dic[s] += 1
        
max_count = 0
for k,v in tmp_dic.items():
    max_count = max(v,max_count)
    
ans_lis = []
for k,v in tmp_dic.items():
    if v == max_count:
        ans_lis.append(k)
        
ans_lis.sort()
[print(f"{s}") for s in ans_lis]

Submission status: Runtime Error

Solution code:
N = int(input())
lis = []
[lis.append(input()) for i in range(N)]

tmp_dic = {}
for s in lis:
    if s not in tmp_dic:
        tmp_dic[s] = 1
    else:
        tmp_dic[s] += 1
        
max_count = 0
for k,v in tmp_dic.items():
    max_count = max(v,max_count)
    
ans_lis = []
for k,v in tmp_dic.items():
    if v == max_count:
        ans_lis.append(k)
        
ans_lis.sort()
[print(f"{s}") for s in ans_lis]

Submission status: Runtime Error

Solution code:
import collections
N=int(input())
S=list(input() for i in range(N))
S=collections.Counter(S)
S=S.most_common()
if S[0][1]>S[1][1]:
  print(S[0][0])
else:
  s=[i for i in S if i[1]==S[0][1]]
  s=dict(s)
  s=list(s.keys())
  s=sorted(s)
  for i in s:
    print(i)

Submission status: Runtime Error

Solution code:
# 初期入力
N = int(input())
word = [ input() for i in range(N) ]

# 単語をキーに数を数えて辞書
from collections import Counter
kazu_word = Counter(word)

#一番多い単語を抜き出す
kazu_word_a = max(kazu_word.values()) #　内包表記の中で毎回MAXを計算するより出したほうが１回で済む
kazu_word_max =[i for i,v in kazu_word.items() if v == kazu_word_a )]
# kazu_word_max_sorted = sorted(kazu_word_max)
"""
print(kazu_word)
print(kazu_word_max)
"""
#print(*kazu_word_max_sorted,sep="\n")
print("\n".join(kazu_word_max.sort())) #sortedをやめて sortにした

Submission status: Runtime Error

Solution code:
l =[input() for i in range(n)]
r=[]
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')

Submission status: Runtime Error

Solution code:
n=int(input())
a = []
for i in range(n):
    a.append(input())
a_count = [a.count(i) for i in a]
print('\n'.join(sorted(set([a[i] for i in range(len(a_count)) if a_count[i] == max(a_count)])))

Submission status: Runtime Error

Solution code:
from collections import Counter
N = int(input())
A = []
for i in range(N):
  A.append(input())
C= Counter(A)
B = 0
for v in c.values():
  B = max(B,v)
ans = []
for k, v in c.items():
  if v == B:
    ans.append(k)
ans.sort()
print(*ans,sep='\n')

Submission status: Runtime Error

Solution code:
from collections import Counter
N = int(input())
A = []
for i in range(N):
  A.append(input())
C= Counter(A)
B = 0
for v in c.values():
  B = max(B,v)
ans = []
for k, v in c.items()
  if v == B:
    ans.append(k)
ans.sort()
print(*ans,sep='\n')

Submission status: Runtime Error

Solution code:
def main():
    import math
    a,b,c = map(int,input().split())
    if (math.sqrt(a) + math.sqrt(b)) < math.sqrt(c):
        print("Yes")
    else:
        print("No")      
main()

Submission status: Runtime Error

Solution code:

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
N = int(input())
from collections import defaultdict
d = defaultdict(int)
for i in range(N):
  d[input()] += 1

max_cnt = max(d.value())
for v in sorted([key for key,value in d.items() if value == max_cnt]):
  print(v)

Submission status: Runtime Error

Solution code:
n=int(input())
s=[input() for _ in range(n)]
import collection
c=collections.Counter(s)
ma=c.most_common[0][1]
for x in c.most_common():
  if x.values==ma:
    print(x.index)

Submission status: Runtime Error

Solution code:
import collections

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

c=collections.Counter(l)
ccc=[]
for j in cc:
    if j[1]==max(c.values()):
        ccc.append(j[0])

for k in sorted(ccc):
    print(k)

Submission status: Runtime Error

Solution code:
dic = {}
ans = []
a = 0

N = int( input() )
for i in range( N ):
  let = input()
  if let not in dic:
    dic.update( { let : 1 } )
  else:
    num=dic[ let ]
    dic[ let ] = num + 1
dic_sorted = sorted(dic.items(), key=lambda x:x[1])
for each in dic_sorted.keys():
  if dic_sorted[ each ] >= a:
    ans+=1
    a=dic_sorted[ each ]
  else:
    break
ans.sort()
for each in ans:
  print(each)

Submission status: Runtime Error

Solution code:
N=int(inpu())
ans=[]
dic={}
for i in range(N):
  let=input()
  if let in dic.keys:
    dic.update({let:1})
  else:
    dic.update({let:dic[let]+1})
score_sorted = sorted(score.items(), key=lambda x:x[1])
a=0
for each in score_sorted.keys():
  if score_sorted[each]>=a:
    ans+=each
    a=score_sorted[each]
  else:
    break
ans.sort()
for each in ans:
  print(each)

Submission status: Runtime Error

Solution code:
import collections

N = int(input())
S = []
#N = 7
#S = ['beat', 'vet', 'beet', 'bed', 'vet', 'bet', 'beet']

for n in range(N+1):
    s = input()
    S.append(s)

S = sorted(S)

c = collections.Counter(S)

m = max(c.values())

chars = [key for key, value in c.items() if value == m]
chars = "\n".join(chars)
print(chars)

Submission status: Runtime Error

Solution code:
import collections

N = int(input())
S = []
#N = 7
#S = ['beat', 'vet', 'beet', 'bed', 'vet', 'bet', 'beet']

for n in range(N):
    s = input()
    S.append(s)

S.sorted()

c = collections.Counter(S)

m = max(c.values())

chars = [key for key, value in c.items() if value == m]
chars = "\n".join(chars)
print(chars)

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
strings = [0] * N
for i in range(N):
    strings[i] = input()
    
values, counts = zip(*collections.Counter(strings).most_common())
a = counts[0]
b = counts[1]
ms = [values[0]]
t = 1
while a == b:
    ms.append(values[t])
    b = counts[t + 1]
    
ms2 = sorted(ms)
for j in ms2:
    print(j)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
S = {}
while(N>0):
    N -= 1
    key = input()
    S[key] = S.get(key,0) + 1
S = [key for key in S.keys() if S[key] == max(S.values())]
for i in sorted(S.keys(),key = lambda x:S[x]):
    print(i)

Submission status: Runtime Error

Solution code:
import pandas as pd
N = int(input())
S = []
while(N>0):
    N -= 1
    S.append(input())
series = pd.Series(S)
a = series.value_counts()
for i in list(a.index):
    print(i)

Submission status: Runtime Error

Solution code:
n = int(input())
p = [str(input()) for _ in range(n)]
import collections
c = collections.Counter(p)
m = max(c.values())
keys = [k for k, v in d.items() if v == m]
keys.sort()
for i in keys:
    print(i)

Submission status: Runtime Error

Solution code:
n = int(input())
p = [str(input()) for _ in range(n)]
import collections
c = collections.Counter(p)
m = max(c.values())
keys = [k for k, v in d.items() if v == m]
sorted(keys)
for i in keys:
    print(i)

Submission status: Runtime Error

Solution code:
n = int(input())
m = {}
for i in range(n):
    s = input()
    m[s] += 1

l = sorted(m.items, key=lambda x: x[1], reverse=True)
cnt = l[0][1]
p = []
for i in l:
    if i[1] == cnt:
        p.append(i[0])

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

Submission status: Runtime Error

Solution code:
from collections import Counter
S = []
N = int(input())
for i in range(N):
    s = input()
    S.append(s)

c = collections.Counter(S)
max_num = max(c.values())
max_list = [i for i,j in c.items() if j==max_num]
max_list.sort()
print('\n'.join(max_list))

Submission status: Runtime Error

Solution code:
import collections
N = int(input())
S = []

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

SS = collections.Counter(S)
for i in range(len(S_dict)):
    if(SS[S[i]]== max(SS.values())):
        res.append(S[i])
res.sort()
for i in range(len(res)):
    print(res[i])

Submission status: Runtime Error

Solution code:
S = [input() for i in range(N) ]
list_S.sort()
list_a = []
a = 0
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a+1)
        a = 0
list_a.append(a+1)
newlist_a = sorted(list_a,reverse=True)
n = newlist_a.count(newlist_a[0])
ans = ""
if n == 1:
    t = 0
    for i in range(list_a.index(newlist_a[0])):
        t += list_a[i]
    if N == 1:
        ans = list_S[t]
    else:
        ans = list_S[t+1]
else:
    if newlist_a[0]==1:
        for i in range(len(list_S)):
            ans += list_S[i]
            ans += "\n"
    else:            
        list_t = []
        a = 0
        for i,x in enumerate(list_a):
            if x == newlist_a[0]:
                list_t.append(sum(list_a[0:i]))
                ans += list_S[list_t[a]]
                ans += "\n"
                a += 1
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
list_S = [input() for i in range(N) ]
list_S.sort()
list_a = []
a = 0
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a+1)
        a = 0
list_a.append(a+1)
newlist_a = sorted(list_a,reverse=True)
n = newlist_a.count(newlist_a[0])
ans = ""
if n == 1:
    t = 0
    for i in range(list_a.index(newlist_a[0])):
        t += list_a[i]
    if N == 1:
        ans = list_S[t]
    else:
        ans = list_S[t+1]
else:
    if newlist_a[0]==1:
        for i in range(len(list_S)):
            ans += list_S[i]
            ans += "\n"
    else:            
        list_t = []
        for i,x in enumerate(list_a):
            if x == newlist_a[0]:
                list_t.append(sum(list_a[0:i]))
                ans += list_S[list_t[i]]
                ans += "\n"
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
list_S = [input() for i in range(N) ]
list_S.sort()
list_a = []
a = 0
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a+1)
        a = 0
list_a.append(a+1)
newlist_a = sorted(list_a,reverse=True)
n = newlist_a.count(newlist_a[0])
ans = ""
if n == 1:
    t = 0
    for i in range(list_a.index(newlist_a[0])):
        t += list_a[i]
    if N == 1:
        ans = list_S[t]
    else:
        ans = list_S[t+1]
else:
    if newlist_a[0]==1:
        for i in range(len(list_S)):
            ans += list_S[i]
            ans += "\n"
    else:            
        list_t = []
        for i,x in enumerate(list_a):
            if x == newlist_a[0]:
                list_t.append(sum(list_a[0:i]))
                ans += list_S[list_t[i-1]]
                ans += "\n"
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
list_S = [input() for i in range(N) ]
list_S.sort()
list_a = []
a = 0
while a < N :
    list_a.append(list_S.count(list_S[a]))
    a += list_S.count(list_S[a])
newlist_a = sorted(list_a,reverse=True)
n = newlist_a.count(newlist_a[0])
ans = ""
if n == 1:
    t = 0
    for i in range(list_a.index(newlist_a[0])):
        t += list_a[i]
    ans = list_S[t+1]
else:
    if newlist_a[0]==1:
        for i in range(len(list_S)):
            ans += list_S[i]
            ans += "\n"
    else:            
        list_t = []
        for i,x in enumerate(list_a):
            if x == newlist_a[0]:
                list_t.append(sum(list_a[0:i]))
                ans += list_S[list_t[i-1]]
                ans += "\n"
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())
list_S = [input() for i in range(N) ]
list_S.sort()
list_a = []
a = 0
for i in range(N-1):
    if list_S[i] == list_S[i+1]:
        a += 1
    else:
        list_a.append(a+1)
        a = 0
list_a.append(a+1)
newlist_a = sorted(list_a,reverse=True)
n = newlist_a.count(newlist_a[0])

list_ans = []
if n == 1:
    t = list_a.index(newlist_a[0])
    m = 0
    for i in range(t):
        m += list_a[i]
    list_ans.append(list_S[m+t])
else:
    list_A = []
    for i in range(len(list_a)):
        list_A.append(list_a[i])
    list_t = []
    list_t.append(list_A.index(newlist_a[0]))
    for i in range(newlist_a.count(newlist_a[0])-1):
        list_A.remove(newlist_a[i])
        list_t.append(list_A.index(newlist_a[i])+i+1)
        
    for i in range(len(list_t)):
        m = 0
        for j in range(list_t[i]):
            m += list_a[j]
        if newlist_a[0]==1:
            list_ans.append(list_S[m])
        else:
            list_ans.append(list_S[m+list_t[i]])
list_ans.sort()
ans = ""
for i in range(len(list_ans)):
    ans += list_ans[i]
    ans += "\n"
print(ans)

Submission status: Runtime Error

Solution code:
N = int(input())

dic = {}
for _ in range(N):
    A = input()
    if A in dic:
        dic[A] += 1
    else:
        dic[A] = 1

dic_sorted = sorted(dic.items(), key=lambda x:x[1], reverse = True)
ans = []
flag = 0
num = 0
for i in range(N):
    if dic_sorted[i][1] < flag:
        break
    else:
        flag = dic_sorted[i][1]
        ans.append(dic_sorted[i][0])
        num += 1

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Mar  4 02:26:37 2020

@author: Kanaru Sato
"""

def list_difference(list1, list2):
    result = list1.copy()
    for value in list2:
        if value in result:
            result.remove(value)
    return result

def differ(S):
    S_dash = list(set(S))
    D = list_difference(S, S_dash)
    if len(D) == 0:
        return S
    if len(D) == 1:
        return D
    if len(D) >= 2:
        return differ(D)

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

ans = differ(S)
ans.sort()

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

Submission status: Runtime Error

Solution code:
import Counter
n=int(input())
s=[input() for i in range(n)]
c=Counter(s)
l=list(c)
l.sort(key=lambda x:x[1],reverse=True)
a=l[0][1]
i=0
while i<n and l[i][1]==a:
  print(l[i][0])
  i+=1