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: Time Limit Exceeded

Solution code:
n = int(input())
slist = []
for i in range(n):
  s = str(input())
  slist.append(s)
sortedlist = sorted(slist)
strsortset = sorted(set(sortedlist), key=sortedlist.index)
setcountlist = []
for i in strsortset:
  setcountlist.append(slist.count(i))
maxindex = [j for j, x in enumerate(setcountlist) if x == max(setcountlist)]
for k in maxindex:
  print(strsortset[k])

Submission status: Time Limit Exceeded

Solution code:
import collections
def main():
  N=int(input())
  str_list = [input() for _ in range(N)]
  c = collections.Counter(str_list)
  d=sorted(c.items(), key=lambda x:x[0], reverse=False)
  b = [x[1] for x in d]
  n = [x[0] for x in d]
  tgtind=[i for i, x in enumerate(b) if x == max(c.values())]
  for i in range(len(tgtind)):
    print(n[tgtind[i]])
    

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import collections
def main():
  N=int(input())
  str_list = [input() for _ in range(N)]
  c = collections.Counter(str_list)
  d=sorted(c.items(), key=lambda x:x[0], reverse=False)
  for i in range(len(d)):
    if(d[i][1]==max(c.values())):
      print(d[i][0])
    

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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

s_dic = Counter(s_inputs)
print('\n'.join(sorted([k for k,v in s_dic.items() if v==max(s_dic.values())])))

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
a=open(0)
n=int(a.readline())
l=a.read().split()
c=Counter(l)
max_list=[k for k,v in c.items() if v==max(c.values())]
max_list.sort()
print(*max_list,sep="\n")

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
a=open(0)
n=int(a.readline())
l=a.read().split()
c=Counter(l)
max_list=[kv[0] for kv in c.items() if kv[1]==max(c.values())]
max_list.sort()
print(*max_list,sep="\n")

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
a=open(0)
n=int(a.readline())
l=a.read().split()
c=Counter(l)
max_list=[kv[0] for kv in c.items() if kv[1]==max(c.values())]
max_list.sort()
for j in max_list:
  print(j)

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
import sys

input=sys.stdin.readline
n=int(input())
l=[input() for i in range(n)]
c=Counter(l)
max_list=[kv[0] for kv in c.items() if kv[1]==max(c.values())]
max_list.sort()
for j in max_list:
  print(j.strip())

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter

n=int(input())
l=[input() for i in range(n)]
c=Counter(l)
max_list=[kv[0] for kv in c.items() if kv[1]==max(c.values())]
max_list.sort()
for j in max_list:
  print(j)

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
l=[]
n=int(input())
for i in range(n):
  l.append(input())
c=Counter(l)
max_list=[kv[0] for kv in c.items() if kv[1]==max(c.values())]
max_list.sort()
for j in max_list:
  print(j)

Submission status: Time Limit Exceeded

Solution code:
import collections
l=[]
n=int(input())
for i in range(n):
  l.append(input())
c=collections.Counter(l)
max_list=[kv[0] for kv in c.items() if kv[1]==max(c.values())]
max_list.sort()
for j in max_list:
  print(j)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
word = [input() for i in range(n)]
test = list([x,word.count(x)] for x in set(word))
max_num = int(max(test, key=lambda x: x[1])[1])
if(max_num == 1):
  print('\n'.join(sorted(word)))
else:
  print('\n'.join(sorted([num[0] for num in test if int(num[1]) == max_num])))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
word = [input() for i in range(n)]
test = list([x,word.count(x)] for x in set(word))
max_num = int(max(test, key=lambda x: x[1])[1])
print('\n'.join(sorted([num[0] for num in test if int(num[1]) == max_num])))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
word = [input() for i in range(n)]
test = list([x,word.count(x)] for x in set(word))
max_num = int(max(test, key=lambda x: x[1])[1])

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
word = [input() for i in range(n)]
test = list([x,0] for x in set(word))
max_num = 0

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

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
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_max = int(max(test, key=lambda x: x[1])[1])

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

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

Submission status: Time Limit Exceeded

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

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

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

Submission status: Time Limit Exceeded

Solution code:
import collections

N = int(input())
S_lis = []

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

S_dic = collections.Counter(S_lis)
m = max(S_dic.values())
ans = []

for i in range(len(S_dic)):
  if S_dic.most_common()[i][1] == m:
    ans.append(S_dic.most_common()[i][0])

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

n = int(input())
s = [0]*n
c = [0]*n
A = [0]*n
k = 0

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

s.sort()    
    
for i in range(n): 
	c[i] = s.count(s[i])

M = max(c)

for i in range(n):
	if c[k] == M:
		print(s[k])
		k += M-1
	k += 1
	if k >= n:
		break

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
L=[]
M=[0]*N
for i in range(N):
  L.append(str(input()))
L.sort()
A=[]
for j in L:
  if j not in A:
    A.append(j)
  M[A.index(j)]+=1
a=max(M)
for k in range(N):
  if M[k]==a:
    print(A[k])

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=[]
for i in range(N):
  A.append(str(input()))
A.sort()
B=set(A)
m=0
for i in range(N):
  m=max(m,A.count(A[i]))
for j in range(N):
  if A.count(A[j])==m and A[j] in B:
    print(A[j])
    B.remove(A[j])

Submission status: Time Limit Exceeded

Solution code:

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

t = list(set(s))
dd = len(t)
cnt = [0 for _ in range(dd)]
for i in range(dd):
    for y in s:
        if t[i] == y: cnt[i]+=1
ans = []
for i in range(dd):
    if cnt[i] == max(cnt):
        ans.append(t[i])
ans.sort()
for i in range(len(ans)):
    print(ans[i])

Submission status: Time Limit Exceeded

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

t = list(set(s))
cnt = [0 for _ in range(len(t))]
for i in range(len(t)):
    for y in s:
        if t[i] == y: cnt[i]+=1
ans = []
for i in range(len(t)):
    if cnt[i] == max(cnt):
        ans.append(t[i])
ans.sort()
for i in range(len(ans)):
    print(ans[i])

Submission status: Time Limit Exceeded

Solution code:
#155 Poll
n = int(input())
words = {}
for i in range(n):
    name = input()
    if name not in words:
        words[name] = 1
    elif name in words:
        words[name] += 1
        
max_k_list = [kv[0] for kv in words.items() if kv[1] == max(words.values())]
max_k_list.sort()
print('\n'.join(max_k_list))

Submission status: Time Limit Exceeded

Solution code:
#155 Poll
import collections
n = int(input())
ans = [input() for _ in range(n)]

c = collections.Counter(ans)
max_k_list = [kv[0] for kv in c.items() if kv[1] == max(c.values())]
max_k_list.sort()
print('\n'.join(max_k_list))

Submission status: Time Limit Exceeded

Solution code:
#155 Poll
import collections
n = int(input())
ans = []
for i in range(n):
    ans.append(input())

c = collections.Counter(ans)
max_k_list = [kv[0] for kv in c.items() if kv[1] == max(c.values())]
max_k_list.sort()
print('\n'.join(max_k_list))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
names = []
words = {}
for i in range(N):
    name = input()
    if name not in names:
        words[name] = 1
        names.append(name)
    elif name in names:
        words[name] += 1

max_num = max(words.values())
max_name_list = [word[0] for word in words.items() if word[1] == max_num]

max_name_list = sorted(max_name_list)

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
names = []
words = {}
for i in range(N):
    name = input()
    if name not in names:
        words[name] = 1
        names.append(name)
    elif name in names:
        words[name] += 1

max_name_list = [word[0] for word in words.items() if word[1] == max(words.values())]

max_name_list = sorted(max_name_list)

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
names = []
words = {}
for i in range(N):
    name = input()
    if name in names:
      words[name] += 1
    else:
      words[name] = 1
      names.append(name)
        
        
max_name_list = []
for nm in words.items():
    if nm[1] == max(words.values()):
        max_name_list.append(nm[0])
max_name_list = sorted(max_name_list)
for i in range(len(max_name_list)):
    print(max_name_list[i])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
names = []
words = {}
for i in range(N):
    name = input()
    if name not in names:
        words[name] = 1
        names.append(name)
    elif name in names:
        words[name] += 1

max_name_list = []
max_num = max(words.values());
for nm in words.items():
    if nm[1] == max_num:
        max_name_list.append(nm[0])

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
names = []
words = {}
for i in range(N):
    name = input()
    if name not in names:
        words[name] = 1
        names.append(name)
    elif name in names:
        words[name] += 1
        
max_name_list = []
for nm in words.items():
    if nm[1] == max(words.values()):
        max_name_list.append(nm[0])
max_name_list = sorted(max_name_list)
for i in range(len(max_name_list)):
    print(max_name_list[i])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
names = []
words = {}
for i in range(N):
  name = input()
  if name not in names:
    words[name] = 1
    names.append(name)
  elif name in names:
    words[name] += 1
        
max_name_list = [nm[0] for nm in words.items() if nm[1] == max(words.values())]
max_name_list = sorted(max_name_list)

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
names = []
words = {}
for i in range(N):
    name = input()
    if name not in names:
        words[name] = 1
        names.append(name)
    elif name in names:
        words[name] += 1
        
max_name_list = [nm[0] for nm in words.items() if nm[1] == max(words.values())]
max_name_list = sorted(max_name_list)

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

Submission status: Time Limit Exceeded

Solution code:
import collections
n = int(input())
words = []
for i in range(n):
  words.append(input())
c = collections.Counter(words)
max_w = []
for i in c.most_common():
  if i[1]==c.most_common()[0][1]:
    max_w.append(i[0])
max_w.sort()
[print(j) for j in max_w]

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s_dic = {}
for i in range(n):
    s = input()
    if s not in s_dic:
        s_dic[s] = 1
    else:
        s_dic[s] += 1
max_s_list = [s[0] for s in s_dic.items() if s[1] == max(s_dic.values())]
max_s_list.sort()
for s in max_s_list:
    print(s)

Submission status: Time Limit Exceeded

Solution code:
d=dict()
for i in range(int(input())):
    s=input()
    if s not in d:
        d[s]=1
    else:
        d[s]+=1
max_v = max(d.values())
print(*sorted([kv[0] for kv in d.items() if kv[1] == max(d.values())]))

Submission status: Time Limit Exceeded

Solution code:
import sys
N = int(input())
words = []
cnts = []
for i in range(N):
    S = input()
    if S not in words:
        words.append(S)
        cnts.append(1)
    else:
        cnts[words.index(S)] += 1
max_words = []
for j in range(len(words)):
    if cnts[j] == max(cnts):
        max_words.append(words[j])
max_words = sorted(max_words)
print(*max_words, sep ="\n")

Submission status: Time Limit Exceeded

Solution code:
import sys
N = int(input())
words = []
cnts = []
for i in range(N):
    S = input()
    if S not in words:
        words.append(S)
        cnts.append(1)
    else:
        cnts[words.index(S)] += 1
max_words = []
for j in range(len(words)):
    if cnts[j] == max(cnts):
        max_words.append(words[j])
max_words = sorted(max_words)
for a in max_words:
    print(a)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = [input() for _ in [0]*n]
s = sorted(s, key=s.count)
ans = []
for i in set(s):
    if s.count(i) == s.count(s[-1]):
        ans += [i]
print('\n'.join(sorted(ans)))

Submission status: Time Limit Exceeded

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

a = set(s)
b = list(a)
c = sorted(b)
d = 0
e = []

for j in range(len(c)):
    f = 0
    for k in range(n):
        if c[j]==s[k]:
            f += 1
    if f > d:
        d = f 
        e = [c[j]]
    elif f == d:
        e.append(c[j])

for l in range(len(e)):
    print(e[l])

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
S=[input() for _ in range(N)]
S_set=list(set(S))

S_count=[S.count(w) for w in S_set]
S_vests=[S_set[i] for i in range(len(S_count)) if S_count[i]==max(S_count)]
S_vests.sort()
for i in range(len(S_vests)):
    print(S_vests[i])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S =[]
times = {}
for i in range(N):
  word = input()
  if word in times:
    times[word] = times[word] + 1
  else:
    times[word] = 1
max_k_list = [kv[0] for kv in times.items() if kv[1] == max(times.values())]
new_str_list = sorted(max_k_list)
for i in new_str_list:
  print(i)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
S =[]
times = {}
for i in range(N):
  S.append(input())

for m in range(N):
  count = 0
  for n in range(N):
    if S[m] == S[n]:
      count += 1
  times[S[m]] = count
max_k_list = [kv[0] for kv in times.items() if kv[1] == max(times.values())]
new_str_list = sorted(max_k_list)
for i in new_str_list:
  print(i)

Submission status: Time Limit Exceeded

Solution code:
# ハッシュテーブル　dictionary
n = int(input())
s = list(input() for i in range(n))
s_dict = {}

# 入力文字をkeyに、その文字の入力回数をvalueにした辞書作成
for word in s:
    num = int(s.count(word))
    s_dict[word] = num

# 入力回数が最大の単語のみのリストを作成
# s_dictに含まれるkeyとvalueを1個ずつ抜き出し、s[1](value) がmaxのときs[0](key) を max_sに入れる
max_s = [s[0] for s in s_dict.items() if s[1] == max(s_dict.values())]
# 作成したリストのソート
max_s.sort()

for word in max_s:
    print(word)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
mydict = {}
for i in range(N):
  t = input()
  if t in mydict:
    mydict[t]+=1
  else:
    mydict[t] = 1
max_k_list = [kv[0] for kv in mydict.items() if kv[1] == max(mydict.values())]
max_k_list.sort()
for i in max_k_list:
  print(i)
  """
  li.append(mydict[i])
li.sort()
for i in li:
  print(i)
"""

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = [input() for _ in range(n)]
count = []
max_list = []

for item in s:
    count_i = s.count(item)
    count.append(count_i)

for i in range(n):
    if count[i] == max(count) and not (s[i] in max_list):
        max_list.append(s[i])

max_list = sorted(max_list)
for item in max_list:
    print(item)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = [input() for _ in range(n)]
count = []
max_list = []

for item in s:
    count_i = s.count(item)
    count.append(count_i)

for i in range(n):
    if count[i] == max(count) and not (s[i] in max_list):
        max_list.append(s[i])

max_list.sort()
for item in max_list:
    print(item)

Submission status: Time Limit Exceeded

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

lg = set(s)

check = []
max_qua = 0

for i in lg:
    if(max_qua < s.count(i)):
        max_qua = s.count(i)
        check = [i]
    elif(max_qua == s.count(i)):
        check.append(i)

check = sorted(check)

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = [input() for _ in range(n)]
ans = {}
count = []
max_list =[]
for item in s:
    count_i = s.count(item)
    count.append(count_i)

for i in range(n):
    if count[i] == max(count) and not (s[i] in max_list):
        max_list.append(s[i])

max_list.sort()
for item in max_list:
    print(item)

Submission status: Time Limit Exceeded

Solution code:

def myAnswer(N:int,dic:dict) -> None:
   MAX = max(dic.values())
   dic2 = sorted(dic.items())
   for key,value in dic2:
      if(MAX == value):
         print(key)

def main():
   N = int(input())
   dic = {}
   for _ in range(N):
      s = input()
      if(s in dic.keys()):
         dic[s]+=1
      else:
         dic[s]=1
   myAnswer(N,dic)
if __name__ == '__main__':
   main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
S=[input() for i in range(N)]
S_set=list(set(S))
poll=[]
for i in range(len(set(S))):
    poll.append((S.count(S_set[i]),S_set[i]))
poll=sorted(poll)[::-1]
x=poll[0][0]
ans=[]
for i in range (len(poll)):
    if x==poll[i][0]:
        ans.append(poll[i][1])
    else:
        break
ans=sorted(ans)
for i in ans:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
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 sorted(B)]

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
n=int(input())
mylist=[]
for i in range(n):
    s=input()
    mylist.append(s)
#print(mylist)
c=Counter(mylist)

max=sum(x==max(mylist) for x in mylist)
answer=[]
#print(max)
for word,i in c.most_common():
    #print(word,i)
    if i==max:
        answer.append(word)
    else:
        break

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s_list = []
count_list = []

for _ in range(n):
  s = input()
  if not s in s_list:
    s_list.append(s)
    count_list.append(1)
  else:
    count_list[s_list.index(s)] += 1
    
#print(s_list)
#print(count_list)

max_s = max(count_list)
#print(max_s)

max_list = []
for i in range(len(s_list)):
  if count_list[i] == max_s:
    max_list.append(s_list[i])
    
max_list.sort()

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

for item in sorted(dic.items()):
    if item[1] == max(dic.values()):
        print(item[0])

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

candidates={}
for i in range(n):
    candidate=input()
    if candidate in candidates:
        candidates[candidate]+=1
    else:
        candidates[candidate]=1
max_k_list = [kv[0] for kv in candidates.items() if kv[1] == max(candidates.values())]
max_k_list.sort()
for i in max_k_list:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())

s=[]
for i in range(n):
    s.append(input())
k=s.copy()   
candidates=list(set(k))

maxnum=0
for candidate in candidates:
    maxnum=max(maxnum,s.count(candidate))
    
ans=[]
for candidate in candidates:
    if s.count(candidate)==maxnum:
        ans.append(candidate)
ans.sort()


for i in ans:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter

N = int(input())
S = [input() for i in range(N)]
clist = Counter(S)
tmp = 0
rlist = []

for i in range(len(clist)):
	if tmp <= int(clist.most_common()[i][1]):
		tmp = int(clist.most_common()[i][1])
		rlist.append(clist.most_common()[i][0])

rlist.sort(reverse=False)

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

Submission status: Time Limit Exceeded

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 key in d.keys():
    if d[key] == max(d.values()):
        ans.append(key)

ans = sorted(ans)

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

Submission status: Time Limit Exceeded

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

sd = sorted(d.items())

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

Submission status: Time Limit Exceeded

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

for _ in range(n):
    t = input()
    s.setdefault(t, 1)
    s[t] += 1

max_k_list = [kv[0] for kv in s.items() if kv[1] == max(s.values())]

max_k_list.sort()

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

Submission status: Time Limit Exceeded

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

for i in range(n):
    t = input()
    s.setdefault(t, 1)
    s[t] += 1

max_k_list = [kv[0] for kv in s.items() if kv[1] == max(s.values())]

max_k_list.sort()

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

Submission status: Time Limit Exceeded

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

max_list = [kv for kv in d.items() if kv[1] == max(d.values())]

sml = sorted(max_list)

for _ in range(len(sml)):
    print(sml[_][0])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = list("")
for i in range(n):
    l.append(input())
s = list(set(l))
s.sort()
max = 0
a = list("")
for i in range(len(s)):
    c = l.count(s[i])
    a.append(c)
    if c > max:
        max = c
for i in range(len(s)):
    if a[i] == max:
        print(s[i])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l, s = list(""), list("")
for i in range(n):
    l.append(input())
s = list(set(l))
max = 0
a = list("")
for i in range(len(s)):
    if l.count(s[i]) > max:
        max = l.count(s[i])
        a.clear()
        a.append(s[i])
    elif l.count(s[i]) == max:
        a.append(s[i])
a.sort()
for i in range(len(a)):
    print(a[i])

Submission status: Time Limit Exceeded

Solution code:
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
for key,value in sorted(dictionary.items()):
    if value==max(dictionary.values()):
        print(key)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[input() for i in range(n)]
b=set(a)
newb=sorted(b)
l=len(b)
c=[0]*l
for j in range(l):
  for i in range(n):
    if a[i]==newb[j]:
      c[j]+=1

max=0
for j in range(l):
  if c[j]>=max:
    max=c[j]

for j in range(l):
  if c[j]==max:
    print(str(newb[j]))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[input() for i in range(n)]
b=list(set(a))
newb=sorted(b)
l=len(b)
c=[0]*l
for j in range(l):
  for i in range(n):
    if a[i]==newb[j]:
      c[j]+=1

max=0
for j in range(l):
  if c[j]>=max:
    max=c[j]

for j in range(l):
  if c[j]==max:
    print(str(newb[j]))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a=[input() for i in range(n)]
b=list(set(a))
newb=list(sorted(b))

l=len(b)
c=[0]*l
for i in range(n):
  for j in range(l):
    if a[i]==newb[j]:
      c[j]+=1

max=0
for j in range(l):
  if c[j]>=max:
    max=c[j]

for j in range(l):
  if c[j]==max:
    print(str(newb[j]))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
S=[]
for _ in range(N):
    S.append(input())
S1=list(set(S))
C=[]
for i in S1:
    C.append(S.count(i))
D=[x for x in S1 if S.count(x) >=max(C)]
D.sort()
for i in D:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
import collections

n = int(input())

a = []
b = []
for i in range(n):
    s = str(input())
    a.append(s)

b = collections.Counter(a)

c = b.most_common(1)
values, counts = zip(*c)

t = counts[0]

u = list(set(a))
u.sort()
for j in u:
    if a.count(j) == t:
        print(j)

Submission status: Time Limit Exceeded

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

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

a = max(count)
ans = []
for i in range(n):
    if count[i] == a:
        if not(s[i] in ans):
            ans.append(s[i])

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

a = []
b = []
for i in range(n):
    s = str(input())
    a.append(s)

b = list(set(a))

count_a = 0
ans = []
for j in b:
    z = a.count(j)
    if count_a == z:
        ans.append(j)
    elif count_a < z:
        count_a = z
        ans.clear()
        ans.append(j)

ans.sort()

for k in ans:
    print(k)

Submission status: Time Limit Exceeded

Solution code:
import collections

n = int(input())
ls = []
for i in range(n):
    s = input()
    ls.append(s)
c = collections.Counter(ls)
ls2 = [i for i in c if c[i] == max(c.values())]
for l in sorted(ls2):
    print(l)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
dic = {}
for i in range(n):
        s = input()
        if s in dic     :
                dic[s]+=1
        else:
                dic[s]=1
ls = [i for i in dic if dic[i] == max(dic.values())]
for key in sorted(ls):
        print(key)

Submission status: Time Limit Exceeded

Solution code:
import os

def main():
        num = int(input())
        dict_list = [] 
        for i in range(num):
                strings = input()
                dict_list.append(strings)

        dict_lists = set(dict_list)

        max_num = 0
        result = []
        for i in dict_lists:
                count = dict_list.count(i)
                if max_num <= count:
                        if max_num == count:
                                result.append(i)
                        else:
                                max_num = count
                                result = []
                                result.append(i) 
        
        result.sort()
        for i in result:
                print(i)

if __name__ == "__main__":
        main()

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
ans_list =[]
for i in range(a):
    b = input()
    ans_list.append(b)
max_app_map = map(lambda x: ans_list.count(x), ans_list)
max_app=max(list(max_app_map))

w_list = []
for i in ans_list:
    if ans_list.count(i) == max_app and i not in w_list:
        w_list.append(i)

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

Submission status: Time Limit Exceeded

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

S = list(set(s))
S.sort()

cnt = []
for word in S:
  cnt.append(s.count(word))

maxIndex = [i for i, x in enumerate(cnt) if x == max(cnt)]
for I in maxIndex:
  print(S[I])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
li = []
for i in range(n):
    li.append(input())
li.sort()
tmp = list(sorted(set(li), key=li.index))
oplist = [[0 for i in range(2)] for j in range(len(tmp))]
for i in range(len(tmp)):
    oplist[i][1] = tmp[i]
cnt = 0
for i in range(len(oplist)):
    if cnt < li.count(oplist[i][1]):
        cnt = li.count(oplist[i][1])
    oplist[i][0] = li.count(oplist[i][1])
for i in range(len(tmp)):
    if oplist[i][0] == cnt:
        print(oplist[i][1])

Submission status: Time Limit Exceeded

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

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


max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]
max_k_list.sort()

for i in max_k_list:
  print(i)

Submission status: Time Limit Exceeded

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

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

max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]

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

Submission status: Time Limit Exceeded

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

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

max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())]

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
l = []
for i in range(N):
  l.append(input())
s = set(l)
ss = list(s)
ss.sort()
w = []
for i in range(len(ss)):
  w.append(l.count(ss[i]))
for i in range(len(w)):
  if max(w) == w[i]:
    print(ss[i])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
l = []
for i in range(N):
  l.append(input())
s = []
w = []
for i in range(N):
    s.append(l.count(l[i]))
    w.append(l[i])
MAX = max(s)
g = []
for i in range(len(s)):
  if s[i] == MAX:
    g.append(w[i])
h = set(g)
j = list(h)
j.sort()
for i in range(len(j)):
  print(j[i])

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
s=[input()for _ in range(n)]
maxcount,ls=0,[]

for i in s:
  if s.count(i)==maxcount:
    ls.append(i)
    maxcount=s.count(i)
    continue
      
  elif s.count(i)>maxcount:
    ls=[i]
    maxcount=s.count(i)
    continue  
      
ls=sorted(set(ls))
for i in ls:
  print(i)