ZhenlongDai/ACPR huggingface dataset:
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())

dic = {}

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

maxnum = max(dic.values())



keys = list(dic.keys())
for key in reversed(keys):
	if dic[key] == maxnum:
		print(key)




Failing test case input:
7
beau
uev
bfet
bfd
vet
etc
teeb

Expected output:
beau
bfd
bfet
etc
teeb
uev
vet


Actual output:
teeb
etc
vet
bfd
bfet
uev
beau


Fixed submission (verdict: Accepted):
N = int(input())

dic = {}

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

maxnum = max(dic.values())



keys = list(dic.keys())
for key in sorted(keys):
	if dic[key] == maxnum:
		print(key)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
l = c.most_common()
n, m = l[0]
ans = []
for i, j in l:
    if j == m:
        ans.append(i)
print(ans.sort())


Failing test case input:
7
afau
vdu
bfet
bgd
tev
etd
beet

Expected output:
afau
beet
bfet
bgd
etd
tev
vdu


Actual output:
None


Fixed submission (verdict: Accepted):
import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
l = c.most_common()
n, m = l[0]
ans = []
for i, j in l:
    if j == m:
        ans.append(i)
for a in sorted(ans):
    print(a)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
x={}

count=0
for i in range(n):
  s=input()
  if s in x:
    x[s]+=1
  else:
    x[s]=1
a=max(x.values())
answer=sorted(x)
for a in answer:
  print(a)



Failing test case input:
7
beat
vet
beet
bed
vet
bet
beet

Expected output:
beet
vet

Actual output:
beat
bed
beet
bet
vet


Fixed submission (verdict: Accepted):
n=int(input())
x={}

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

a=max(x.values())
keys=[k for k,v in x.items() if v==a]
answer=sorted(keys)
  
for a in answer:
  print(a)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
4
ihsu
taou
michia
nuk

Expected output:
ihsu
michia
nuk
taou


Actual output:
1


Fixed submission (verdict: Accepted):
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)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

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

counted = collections.Counter(s)

m = max(counted.values())

chars = [key for key, value in counted.items()
             if value == m]
chars.reverse()

moji = '\n'.join(chars)

print(moji)

Failing test case input:
7
bats
btbs
ildk
kicj
asta
kcjk
khck

Expected output:
asta
bats
btbs
ildk
kcjk
khck
kicj


Actual output:
khck
kcjk
asta
kicj
ildk
btbs
bats


Fixed submission (verdict: Accepted):
import collections

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

counted = collections.Counter(s)

m = max(counted.values())

chars = [key for key, value in counted.items()
             if value == m]
chars.sort()

moji = '\n'.join(chars)

print(moji)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = {}

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

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

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

s2.reverse()

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

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

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

Failing test case input:
7
beau
veu
bfet
bfd
vet
etc
teeb

Expected output:
beau
bfd
bfet
etc
teeb
vet
veu


Actual output:
veu, vet, teeb, etc, bfet, bfd, beau

Fixed submission (verdict: Accepted):
n = int(input())
s = {}

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

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

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

s2.reverse()

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

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

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

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
l = c.most_common()
n, m = l[0]
for i, j in l:
    if j == m:
        print(i)
           


Failing test case input:
7
bt`s
btbs
ildk
kicj
btsa
kcjk
khck

Expected output:
bt`s
btbs
btsa
ildk
kcjk
khck
kicj


Actual output:
bt`s
btbs
ildk
kicj
btsa
kcjk
khck


Fixed submission (verdict: Accepted):
import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
l = c.most_common()
n, m = l[0]
ans = []
for i, j in l:
    if j == m:
        ans.append(i)
for a in sorted(ans):
    print(a)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = [input() for x in range(N)]
S.sort()

T = [[S[0]]]
for i in S[1:N]:
  if i == T[-1][-1]:
    T[-1].append(i)
  else:
    T.append([i])
T.sort(key=lambda x: len(x))
U = []

U.append(T[-1][0])
c = -2
for i in T[0:len(T)-1]:
  if len(i) == len(T[-1]):
    U.append(i[0])
  else:
    break


U.sort()
for x in U:
  print(x)


Failing test case input:
7
beat
vet
beet
bed
vet
bet
beet

Expected output:
beet
vet

Actual output:
vet


Fixed submission (verdict: Accepted):
N = int(input())
S = [input() for x in range(N)]
S.sort()

T = [[S[0]]]
for i in S[1:N]:
  if i == T[-1][-1]:
    T[-1].append(i)
  else:
    T.append([i])
T.sort(key=lambda x: len(x))
U = []

for i in T[::-1]:
  if len(i) == len(T[-1]):
    U.append(i[0])
  else:
    break

U.sort()
for x in U:
  print(x)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=[]
import collections as cc
a=[input() for i  in range(n)]
f=cc.Counter(a)
ch=max(f.values())
ans=set()
for i in a:
    if f[i]==ch:
        ans.add(i)
for i in ans:
    print(i)

Failing test case input:
7
beat
veu
beet
bed
vte
bet
teeb

Expected output:
beat
bed
beet
bet
teeb
veu
vte


Actual output:
beat
vte
bed
teeb
beet
veu
bet


Fixed submission (verdict: Accepted):
n=int(input())
a=[]
import collections as cc
a=[input() for i  in range(n)]
f=cc.Counter(a)
ch=max(f.values())
ans=[]
for i in a:
    if f[i]==ch:
        ans.append(i)
ans=list(set(ans))
ans.sort()
for i in ans:
    print(i)

Problem: p02773
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import Counter
c = Counter()
n = int(input())
for _ in range(n):
    c[input()] += 1

_, m = c.most_common(1)[0]

for x, y in c.most_common():
    if y == m:
        print(x)
    else:
        break

Failing test case input:
8
fuebblo
alofeua
omafftb
palffvb
ouafflb
omaefub
bl`ffuo
buofanf

Expected output:
alofeua
bl`ffuo
buofanf
fuebblo
omaefub
omafftb
ouafflb
palffvb


Actual output:
fuebblo
alofeua
omafftb
palffvb
ouafflb
omaefub
bl`ffuo
buofanf


Fixed submission (verdict: Accepted):
from collections import Counter
c = Counter()
n = int(input())
for _ in range(n):
    c[input()] += 1

_, m = c.most_common(1)[0]

ans = []
for x, y in c.most_common():
    if y == m:
        ans.append(x)
    else:
        break

for x in sorted(ans):
    print(x)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
si = []
for i in range(n):
    si.append(input())

wkmax = wk = m = 0
c = []
b = list(set(si))
m = len(b)

for i in range(m):
    wk = si.count(b[i])
    if wkmax <= wk:
        wkmax = wk
    c.append([b[i],wk])

for i in range(len(c)):
    if c[i][1] == wkmax:
        print(c[i][0])

Failing test case input:
7
afau
udv
bfet
bgd
tev
etc
beet

Expected output:
afau
beet
bfet
bgd
etc
tev
udv


Actual output:
beet
tev
bfet
bgd
etc
afau
udv


Fixed submission (verdict: Accepted):
n = int(input())
wk = wkmax = 0
si = {}
for i in range(n):
    st = input()
    if st in si:
        si[st] = si[st] + 1
    else:
        si[st] = 1
    wk = si[st]
    wkmax = max(wk,wkmax)
sl = sorted(si.items())
for i in range(len(sl)):
    if wkmax == sl[i][1]:
        print(sl[i][0])

Problem: p02773
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from sys import stdin, setrecursionlimit


def main():
    n = int(stdin.readline())
    s = [stdin.readline()[:-1] for _ in range(n)]
    s.sort()
    s_set = set(s)
    summary = {}

    for key in s_set:
        summary[key] = 0

    m = 0
    for si in s:
        summary[si] += 1
        m = max(summary[si], m)

    for key in s_set:
        if summary[key] == m:
            print(key)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Failing test case input:
7
beau
uev
bfet
bfd
vte
sec
teeb

Expected output:
beau
bfd
bfet
sec
teeb
uev
vte


Actual output:
teeb
bfet
vte
sec
bfd
beau
uev


Fixed submission (verdict: Accepted):
from sys import stdin, setrecursionlimit


def main():
    n = int(stdin.readline())
    s = [stdin.readline()[:-1] for _ in range(n)]
    keys = list(set(s))
    keys.sort()
    summary = {}

    for key in keys:
        summary[key] = 0

    m = 0
    for si in s:
        summary[si] += 1
        m = max(summary[si], m)

    for key in keys:
        if summary[key] == m:
            print(key)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def check(input_list):
    vote_dict = {}
    
    for a in input_list:
        if(a in vote_dict.keys()):
            vote_dict[a] += 1
        else:
            vote_dict[a] = 1
            
    return [k for k, v in vote_dict.items() if v == max(vote_dict.values())]

if __name__ == '__main__':
    num = int(input())
    input_list = [input() for a in range(num)]

    for str in check(input_list):
        print(str)


Failing test case input:
4
jsgs
uobt
ahmhic
muk

Expected output:
ahmhic
jsgs
muk
uobt


Actual output:
jsgs
uobt
ahmhic
muk


Fixed submission (verdict: Accepted):
import collections

def check(input_list):

    vote_dict = collections.Counter(input_list)
    max_value = max(vote_dict.values())

    result_list = [k for k, v in vote_dict.items() if v == max_value]
    result_list.sort()
    
    return result_list

if __name__ == '__main__':
    num = int(input())
    input_list = [input() for a in range(num)]

    for str in check(input_list):
        print(str)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]

c = Counter(s)
ma = max(c.values())
for k,v in c.items():
  if ma == v:
    print(k)


Failing test case input:
4
jsgs
sbou
chmiia
muk

Expected output:
chmiia
jsgs
muk
sbou


Actual output:
jsgs
sbou
chmiia
muk


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
s = [input() for _ in range(n)]

c = Counter(s)
ma = max(c.values())
ans = []
for k,v in c.items():
  if ma == v:
    ans.append(k)

ans = sorted(ans)

for a in ans:
  print(a)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
from collections import Counter
N=int(input())
S=['']*N
for i in range(N):
    S[i]=input()
counter = Counter(S)
ans=[0]*len(counter)
num=0
for word, cnt in counter.most_common():
    ans[num]=cnt
    num+=1
anker=ans[0]
ankernum=0
for j in range(len(counter)):
    if ans[j]!=anker:
        ankernum=j
        break
    elif j==len(counter)-1:
        ankernum=j+1
print(ankernum)
word_ans=['']*len(counter)
k=0
for word, cnt in counter.most_common():
    word_ans[k]=word
    k+=1

for l in sorted(word_ans[:ankernum]):
    print(l)

Failing test case input:
8
olbbeuf
alofeua
om`fftb
palffvb
ouagflb
moaefub
bl`ffuo
buofanf

Expected output:
alofeua
bl`ffuo
buofanf
moaefub
olbbeuf
om`fftb
ouagflb
palffvb


Actual output:
8
alofeua
bl`ffuo
buofanf
moaefub
olbbeuf
om`fftb
ouagflb
palffvb


Fixed submission (verdict: Accepted):
import sys
from collections import Counter
N=int(input())
S=['']*N
for i in range(N):
    S[i]=input()
counter = Counter(S)
ans=[0]*len(counter)
num=0
for word, cnt in counter.most_common():
    ans[num]=cnt
    num+=1
anker=ans[0]
ankernum=0
for j in range(len(counter)):
    if ans[j]!=anker:
        ankernum=j
        break
    elif j==len(counter)-1:
        ankernum=j+1
word_ans=['']*len(counter)
k=0
for word, cnt in counter.most_common():
    word_ans[k]=word
    k+=1

for l in sorted(word_ans[:ankernum]):
    print(l)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
dic = {}
m = 0
for i in range(n):
  s = input()
  if s in dic:
    dic[s] += 1
    m = max(m, dic[s])
  else:
    dic[s] = 1
    m = max(m, dic[s])
ans = []
for s in dic:
  if dic[s] == m:
    ans.append(s)
print('\n'.join(ans))

Failing test case input:
7
beau
uev
bfet
bfd
vte
tec
teeb

Expected output:
beau
bfd
bfet
tec
teeb
uev
vte


Actual output:
beau
uev
bfet
bfd
vte
tec
teeb


Fixed submission (verdict: Accepted):
n = int(input())
dic = {}
m = 0
for i in range(n):
  s = input()
  if s in dic:
    dic[s] += 1
    m = max(m, dic[s])
  else:
    dic[s] = 1
    m = max(m, dic[s])
ans = []
for s in dic:
  if dic[s] == m:
    ans.append(s)
print('\n'.join(sorted(ans)))
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections



def resolve():
    N = int(input())
    S = []
    for i in range(N):
        ss = input()
        S.append(ss)

    counter = collections.Counter(S)
    _, max_count = counter.most_common()[0]

    for key in counter:
        if (counter[key] == max_count):
            print(key)


resolve()


Failing test case input:
4
ihsu
tbou
aimhic
kul

Expected output:
aimhic
ihsu
kul
tbou


Actual output:
ihsu
tbou
aimhic
kul


Fixed submission (verdict: Accepted):
import collections



def resolve():
    N = int(input())
    S = []
    for i in range(N):
        ss = input()
        S.append(ss)

    counter = collections.Counter(S)
    _, max_count = counter.most_common()[0]

    ans = []

    for key in counter:
        if (counter[key] == max_count):
            ans.append(key)

    ans.sort()

    for a in ans:
        print(a)


resolve()

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = [input() for _ in range(N)]
 
s = {}

for i in S:
  if i in s:
    s[i] += 1
  else:
    s[i] = 1
 
max_val = max(s.values())
 
for key, value in s.items():
  if value == max_val:
    print(key)

Failing test case input:
7
afau
tdv
bfet
bdg
tew
ete
beet

Expected output:
afau
bdg
beet
bfet
ete
tdv
tew


Actual output:
afau
tdv
bfet
bdg
tew
ete
beet


Fixed submission (verdict: Accepted):
N = int(input())
S = [input() for _ in range(N)]
 
s = {}
for i in S:
  if i in s:
    s[i] += 1
  else:
    s[i] = 1
 
max_val = max(s.values())
tmp = []
for key, value in s.items():
  if value == max_val:
    tmp.append(key)

for j in sorted(tmp):
  print(j)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = [0] * N
for i in range(N):
    S[i]= input()

dic = {}
for i in range(N):
    if (S[i] in dic.keys()) == False:
        dic[S[i]] = 1
    else:
        dic[S[i]] = dic[S[i]] + 1

sortdic = sorted(dic.items())

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

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



Failing test case input:
8
buffalo
buffalo
buffalo
buffalo
olaffub
buffalo
buffalo
buffalo

Expected output:
buffalo


Actual output:
olaffub


Fixed submission (verdict: Accepted):
N = int(input())
S = [0] * N
for i in range(N):
    S[i]= input()

dic = {}
for i in range(N):
    if (S[i] in dic.keys()) == False:
        dic[S[i]] = 1
    else:
        dic[S[i]] = dic[S[i]] + 1

sortdic = sorted(dic.items(), key = lambda x:x[1])

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

ans.sort()
for i in range(len(ans)):
    print(ans[i])
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
dic = {}
for i in range(n):
    a = input()
    if a in dic:
        dic[a] += 1
    else:
        dic[a]   = 1
maxa = max(dic.values())
ans = [x for x, y in dic.items() if y == maxa]
print(sorted(ans))

Failing test case input:
7
afau
udv
bfet
bgd
tev
etc
beet

Expected output:
afau
beet
bfet
bgd
etc
tev
udv


Actual output:
afau, beet, bfet, bgd, etc, tev, udv

Fixed submission (verdict: Accepted):
n=int(input())
list_ = [input() for i in range(n)]
dic = {}
for a in list_:
    if a in dic:
        dic[a] += 1
    else:
        dic[a]   = 1
maxa = max(dic.values())
ans = [x for x, y in dic.items() if y == maxa]
for A in sorted(ans):
    print(A)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
l={}
ans =[]
 

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

num = max(l.values())
print(max)
for i in l:
    
    if l[i]==num:
      ans.append(i)
b = sorted(ans)
for i in b:
    print(i)


Failing test case input:
4
jsgs
sbou
chmiia
muk

Expected output:
chmiia
jsgs
muk
sbou


Actual output:
<built-in function max>
chmiia
jsgs
muk
sbou


Fixed submission (verdict: Accepted):
N=int(input())
l={}
ans =[]
 

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

num = max(l.values())

for i in l:
    
    if l[i]==num:
      ans.append(i)
b = sorted(ans)
for i in b:
    print(i)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
b = {}
for i in range(n):
    temp = input()
    if temp not in b:
        b[temp] = 1
    else:
        b[temp] += 1

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

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

for a in list2:
    print(a)


Failing test case input:
8
fufbblo
alofeub
omafftb
plaffvb
ouafflb
omaefub
buffalo
buofamf

Expected output:
alofeub
buffalo
buofamf
fufbblo
omaefub
omafftb
ouafflb
plaffvb


Actual output:
alofeub
buffalo
buofamf
omaefub
omafftb
ouafflb
plaffvb


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

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

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

for a in list2:
    print(a)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n = int(input())
s = [input() for _ in range(n)]
word = collections.Counter(s)
word = word.most_common()
word.sort()
max_num = word[0][1]
for i in range(len(word)):
    if word[i][1] == max_num:
        print(word[i][0])

Failing test case input:
7
beat
veu
beet
bed
vet
bet
beet

Expected output:
beet


Actual output:
beat
bed
bet
vet
veu


Fixed submission (verdict: Accepted):
from collections import Counter

N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
c = Counter(S).most_common()
m = c[0][1]
c.sort()
for i in range(len(c)):
    if c[i][1] == m:
        print(c[i][0])

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

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

c = collections.Counter(s)
values, counts = zip(*c.most_common())

for i in range(counts.count(max(counts))):
	print(values[i])

Failing test case input:
7
bass
btbs
ildk
kicj
asta
kcjk
khck

Expected output:
asta
bass
btbs
ildk
kcjk
khck
kicj


Actual output:
bass
btbs
ildk
kicj
asta
kcjk
khck


Fixed submission (verdict: Accepted):
import collections
N = int(input())
s = [input() for i in range(N)]

c = collections.Counter(s)
values, counts = zip(*c.most_common())

ss = []
for i in range(counts.count(max(counts))):
	ss.append(values[i])

ss.sort()

for sss in ss:
	print(sss)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
N = int(input())
Sc = Counter([input() for _ in range(N)]).most_common()
print(Sc)
max_num = Sc[0][1]
ans = []
for key, val in Sc:
    if val == max_num:
        ans.append(key)
ans.sort()
for t in ans:
    print(t)

Failing test case input:
4
ihsu
tbou
miahic
kul

Expected output:
ihsu
kul
miahic
tbou


Actual output:
[('ihsu', 1), ('tbou', 1), ('miahic', 1), ('kul', 1)]
ihsu
kul
miahic
tbou


Fixed submission (verdict: Accepted):
from collections import Counter
N = int(input())
Sc = Counter([input() for _ in range(N)]).most_common()

max_num = Sc[0][1]
ans = []
for key, val in Sc:
    if val == max_num:
        ans.append(key)
ans.sort()
for t in ans:
    print(t)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s_list=[input() for _ in range(n)]

import collections
s_counter = collections.Counter(s_list)

import sys
max_count = s_counter.most_common()[0][1]

s_list_keys = list(s_counter.keys())
s_list_values = list(s_counter.values())

list_ans = []

for i in range(len(s_list_keys)):
    if s_list_values[i] == max_count:
        list_ans.append(s_list_keys[i])
    else:
        sys.exit()

list_ans.sort()

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

Failing test case input:
8
buffalo
buffalo
buffalo
buffalo
olaffub
buffalo
buffalo
buffalo

Expected output:
buffalo


Actual output:

Fixed submission (verdict: Accepted):
n=int(input())
s_list=[input() for _ in range(n)]

import collections
s_counter = collections.Counter(s_list)

import sys
max_count = s_counter.most_common()[0][1]

s_list_keys = list(s_counter.keys())
s_list_values = list(s_counter.values())

list_ans = []

for i in range(len(s_list_keys)):
    if s_list_values[i] == max_count:
        list_ans.append(s_list_keys[i])

list_ans.sort()

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

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
dic = {}
for _ in range(n):
  s = input()
  if dic.get(s) == None:
    dic[s] = 1
  else:
    dic[s] += 1

m = max(dic.items())
l = []
for v in dic.items():
  if v[1] == m[1]:
    l.append(v[0])
sortl = sorted(l)
for i in range(len(sortl)):
  print(sortl[i])

Failing test case input:
8
buffalo
buffalo
buffalo
buffalo
olaffub
buffalo
buffalo
buffalo

Expected output:
buffalo


Actual output:
olaffub


Fixed submission (verdict: Accepted):
n = int(input())
dic = {}
for _ in range(n):
  s = input()
  if dic.get(s) == None:
    dic[s] = 1
  else:
    dic[s] += 1

m = max(dic.values())
l = []
for v in dic.items():
  if v[1] == m:
    l.append(v[0])
sortl = sorted(l)
for i in range(len(sortl)):
  print(sortl[i])

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n = int(input())
List = list()
for _ in range(n):
  List.append(input())
s=collections.Counter(List)
s_inv={v:k for k,v in s.items()}
print(s_inv[max(s.values())])

Failing test case input:
4
jsgs
sbou
chmiia
muk

Expected output:
chmiia
jsgs
muk
sbou


Actual output:
muk


Fixed submission (verdict: Accepted):
import collections
n = int(input())
l1 = list()
for i in range(n):
  l1.append(input())
c = collections.Counter(l1)
m = max(c.values())
C = sorted(c.items())
for i in C:
  if i[1]==m:
    print(i[0])
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

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

c = collections.Counter(l)

L = c.most_common()

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

A = list(values)
B = list(counts)

b = B.count(B[0])

a = A[0:b + 1]


Failing test case input:
7
bass
bass
kick
kick
bass
kick
kick

Expected output:
kick

Actual output:

Fixed submission (verdict: Accepted):
import collections
 
N = int(input())
l = [input() for _ in range(N)]
 
c = collections.Counter(l)
 
L = c.most_common()
 
values, counts = zip(*c.most_common())
 
A = list(values)
B = list(counts)
 
b = B.count(B[0])
 
a = A[0:b]
c = sorted(a)

for i in c[0:]:
		print(i)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n=int(input())
s=[]
for _ in range(n):
    s.append(str(input()))
ans=collections.Counter(s)
values,count=zip(*ans.most_common())
for l in range(len(count)):
    if max(count)==count[l]:
        print(values[l])

Failing test case input:
4
ihsu
tbou
michia
luk

Expected output:
ihsu
luk
michia
tbou


Actual output:
ihsu
tbou
michia
luk


Fixed submission (verdict: Accepted):
import collections
n=int(input())
s=[]
for _ in range(n):
    s.append(str(input()))
ans=collections.Counter(s)
a=max(ans.values())
ans=[i for i,k in ans.items() if a==k]
print(*sorted(ans),sep="\n")

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
info = []
for i in range(n):
    info.append(input())

info.sort()

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

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


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

Failing test case input:
4
ihsu
taou
michia
nuk

Expected output:
ihsu
michia
nuk
taou


Actual output:

Fixed submission (verdict: Accepted):
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)
Problem: p02773
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N=int(input())
S=list(input() for _ in range(N))

from collections import Counter

cnt=Counter(S)
max_cnt=cnt.most_common()[0][1]
for k, v in cnt.items():
	if v!=max_cnt:
		continue
	print(k)


	


Failing test case input:
4
jsgs
uobt
ahmhic
muk

Expected output:
ahmhic
jsgs
muk
uobt


Actual output:
jsgs
uobt
ahmhic
muk


Fixed submission (verdict: Accepted):
N=int(input())
S=list(input() for _ in range(N))

from collections import Counter

cnt=Counter(S)
max_cnt=cnt.most_common()[0][1]
ans=[]
for k, v in cnt.items():
	if v!=max_cnt:
		continue
	ans.append(k)

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

Problem: p02773
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()


a = {}
for i in range(n):
	s = input()
	try:
		a[s] += 1
	except KeyError:
		a[s] = 1
b = sorted(a.items(),key = lambda x:x[0])

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

Failing test case input:
8
buffalo
buffalo
buffalo
buffalo
olaffub
buffalo
buffalo
buffalo

Expected output:
buffalo


Actual output:
olaffub


Fixed submission (verdict: Accepted):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()


a = {}
for i in range(n):
	s = input()
	try:
		a[s] += 1
	except KeyError:
		a[s] = 1
b = sorted(a.items(),key = lambda x:x[0])

memo = max([i[1] for i in a.items()])
for i in b:
	
	if i[1] == memo:
		print(i[0])

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = [input() for i in range(n)]
import collections

counted = collections.Counter(s)

m = max(counted.values())

chars = []
for key, value in counted.items():
    if value == m:
        chars.append(key)

print(sorted(chars))


Failing test case input:
4
sgsj
sbou
chimia
muk

Expected output:
chimia
muk
sbou
sgsj


Actual output:
chimia, muk, sbou, sgsj

Fixed submission (verdict: Accepted):
n = int(input())
s = [input() for i in range(n)]
import collections

counted = collections.Counter(s)

m = max(counted.values())

chars = []
for key, value in counted.items():
    if value == m:
        chars.append(key)
chars=sorted(chars)

for i in range(len(chars)):
    print(chars[i])
Problem: p02773
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import Counter

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

c = Counter(s)
tmp = c.most_common()
ans = []

for i in range(len(tmp)):
    if tmp[i][1] != tmp[0][1]:
        break
    else:
        ans.append(tmp[i][0])

ans.sort()
print(ans)

Failing test case input:
7
btas
btbr
ildk
kicj
atsa
kcjk
khck

Expected output:
atsa
btas
btbr
ildk
kcjk
khck
kicj


Actual output:
atsa, btas, btbr, ildk, kcjk, khck, kicj

Fixed submission (verdict: Accepted):
from collections import Counter

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

c = Counter(s)
tmp = c.most_common()
ans = []

for i in range(len(tmp)):
    if tmp[i][1] != tmp[0][1]:
        break
    else:
        ans.append(tmp[i][0])

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

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
if __name__ == '__main__':
    dic = dict()
    n = int(input())
    for i in range(n):
        val = input()
        if val in dic.keys():
            dic[val]+=1
        else:
            dic[val] = 1
    max_keys = max(dic.values())
    values_of_max_key = [val for val in dic if dic[val] == max_keys]
    for s in values_of_max_key:
        print(s)

Failing test case input:
8
olbbeuf
alofeua
om`fftb
palffvb
ouagflb
omaefub
bl`ffuo
buofanf

Expected output:
alofeua
bl`ffuo
buofanf
olbbeuf
om`fftb
omaefub
ouagflb
palffvb


Actual output:
olbbeuf
alofeua
om`fftb
palffvb
ouagflb
omaefub
bl`ffuo
buofanf


Fixed submission (verdict: Accepted):

if __name__ == '__main__':
    dic = dict()
    n = int(input())
    for i in range(n):
        val = input()
        if val in dic.keys():
            dic[val]+=1
        else:
            dic[val]=1
    max_keys = max(dic.values())
    values_of_max_key = [val for val in dic if dic[val] == max_keys]
    sorted_values_of_max_key = sorted(values_of_max_key)
    for s in sorted_values_of_max_key:
        print(s)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
7
bass
btas
ikdk
kicj
asta
kcik
khbk

Expected output:
asta
bass
btas
ikdk
kcik
khbk
kicj


Actual output:
bass
btas
ikdk
kicj
asta
kcik
khbk


Fixed submission (verdict: Accepted):
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)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
N = int(input())
S = []
for i in range(N):
  S.append(str(input()))
ans_list = []
  

c = Counter(S)
keys, values = zip(*c.most_common())

for i in range(len(values)):
  if max(values) == values[i]:
    ans_list.append(keys[i])
    
sorted(ans_list)
for i in range(len(ans_list)):
  print(ans_list[i])



Failing test case input:
7
btas
btbr
ildk
kicj
atsa
kcjk
khck

Expected output:
atsa
btas
btbr
ildk
kcjk
khck
kicj


Actual output:
btas
btbr
ildk
kicj
atsa
kcjk
khck


Fixed submission (verdict: Accepted):
from collections import Counter
N = int(input())
S = []
for i in range(N):
  S.append(str(input()))

c = Counter(S)
max_value = max(list(c.values()))
ans_list = sorted(list(c.items()))

for i in range(len(ans_list)):
  if ans_list[i][1] == max_value:
    print(ans_list[i][0])

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
dict = {}
mx = 0
for i in range(n):
    s = input()
    if s not in dict:
        dict[s] = 0
    dict[s] += 1
    mx = max(mx, dict[s])
print(dict)
print(mx)
ans = []
for s in dict:
    if dict[s] == mx:
        ans.append(s)
ans.sort()
for s in ans:
    print(s)

Failing test case input:
7
bfau
veu
bfet
dgb
tev
etc
teeb

Expected output:
bfau
bfet
dgb
etc
teeb
tev
veu


Actual output:
{'bfau': 1, 'veu': 1, 'bfet': 1, 'dgb': 1, 'tev': 1, 'etc': 1, 'teeb': 1}
1
bfau
bfet
dgb
etc
teeb
tev
veu


Fixed submission (verdict: Accepted):
n = int(input())
dict = {}
mx = 0
for i in range(n):
    s = input()
    if s not in dict:
        dict[s] = 0
    dict[s] += 1
    mx = max(mx, dict[s])
ans = []
for s in dict:
    if dict[s] == mx:
        ans.append(s)
ans.sort()
for s in ans:
    print(s)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

n = int(input())


d = collections.defaultdict(lambda:0)

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

d = dict(d)

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

most = 0

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

Failing test case input:
8
fufbalo
buefola
btffamo
olaffvb
ouafflb
omaffub
buffalo
buofalf

Expected output:
btffamo
buefola
buffalo
buofalf
fufbalo
olaffvb
omaffub
ouafflb


Actual output:
fufbalo
buefola
btffamo
olaffvb
ouafflb
omaffub
buffalo
buofalf


Fixed submission (verdict: Accepted):
import collections

n = int(input())


d = collections.defaultdict(lambda:0)

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

d = dict(d)

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

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

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

ans.sort()

for i in ans:
    print(i)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter
n = int(input())
s = list(input() for _ in range(n))
ls = Counter(s).most_common()
a = []
a.append(ls[0][0])
for i in range(1, len(ls)):
    if ls[i][1] == ls[0][1]:
        a.append(ls[i][0])
for i in a:
    print(i)

Failing test case input:
7
beat
veu
bfet
bed
vte
bet
teeb

Expected output:
beat
bed
bet
bfet
teeb
veu
vte


Actual output:
beat
veu
bfet
bed
vte
bet
teeb


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
s = list(input() for _ in range(n))
ls = Counter(s).most_common()
a = []
a.append(ls[0][0])
for i in range(1, len(ls)):
    if ls[i][1] == ls[0][1]:
        a.append(ls[i][0])
for i in sorted(a):
    print(i)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n = int(input())
s = [input() for i in range(n)]
p = collections.Counter(s)
res = sorted(p.items(), key=lambda x: x[1],reverse = True)

keys = []
if(len(s) == len(set(s))):
  print(sorted(s))
  

for i,m in res:
  if(m == max(p.values())):
    keys.append(i)
  else:
    break
keys=sorted(keys)
for i in range(len(keys)):
  print(keys[i])

Failing test case input:
4
tgsi
uobt
aimhic
kul

Expected output:
aimhic
kul
tgsi
uobt


Actual output:
['aimhic', 'kul', 'tgsi', 'uobt']
aimhic
kul
tgsi
uobt


Fixed submission (verdict: Accepted):
import collections
n = int(input())
s = [input() for i in range(n)]
p = collections.Counter(s)
res = sorted(p.items(), key=lambda x: x[1],reverse = True)
 
keys = []

u = max(p.values())
for i,m in res:
  if(m == u):
    keys.append(i)
  else:
    break
keys=sorted(keys)
for i in range(len(keys)):
  print(keys[i])

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = {}

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

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

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

s2.reverse()

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

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

ret2 = sorted(ret)
print(ret2)

Failing test case input:
7
bass
btbs
ildk
kicj
asta
kcjk
khck

Expected output:
asta
bass
btbs
ildk
kcjk
khck
kicj


Actual output:
asta, bass, btbs, ildk, kcjk, khck, kicj

Fixed submission (verdict: Accepted):
n = int(input())
s = {}

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

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

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

s2.reverse()

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

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

ret2 = sorted(ret)
for r in ret2:
    print(r)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
import sys
N = int(input())
S = [input() for _ in range(N)]



c = collections.Counter(S)


for i in range(len(c.most_common())):
    if i == 0:
        print(c.most_common()[0][0])
    
    if i != 0:
        if (c.most_common()[i-1][1]) == (c.most_common()[i][1]):
            print((c.most_common()[i][0]))
        else:
            sys.exit()

Failing test case input:
4
tgsj
uobt
aimhic
kum

Expected output:
aimhic
kum
tgsj
uobt


Actual output:
tgsj
uobt
aimhic
kum


Fixed submission (verdict: Accepted):
import collections
import sys
N = int(input())
S = [input() for _ in range(N)]

c = collections.Counter(S)
ans = []
li=c.most_common()
for i in range(len(li)):
    if i == 0:
        ans.append(((li[0][0])))
    
    if i != 0:
        if (li[i-1][1]) == (li[i][1]):
            
            ans.append(((li[i][0])))
        else:
            break

ans.sort()

for i in ans:
    print(i)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
S=[]
for i in range(n):
    S.append(input())
S=sorted(S)
from collections import defaultdict
d = defaultdict(int)

for k in S:
    d[k]+=1

d=dict(d)
dmax=max(d)
ansn=d[dmax]
ans=[]
for i in d.keys():
    if d[i]==ansn:
        ans.append(i)

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

Failing test case input:
7
beat
veu
beet
bed
vet
bet
beet

Expected output:
beet


Actual output:
beat
bed
bet
vet
veu


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

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

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
import itertools
s=int(input())
l=[input() for i in range(s)]
counter = collections.Counter(l)

mode_v = counter.most_common()[0][-1]
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, counter.most_common()
)
u=[]
for k, v in it:
  u.append(k)
u.sort
print(*u)

Failing test case input:
4
ihsu
tbou
aimhic
kul

Expected output:
aimhic
ihsu
kul
tbou


Actual output:
ihsu tbou aimhic kul


Fixed submission (verdict: Accepted):
import collections
import itertools
s=int(input())
l=[input() for i in range(s)]
counter = collections.Counter(l)

mode_v = counter.most_common()[0][-1]
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, counter.most_common()
)
u=[]
for k, v in it:
  u.append(k)
  
u.sort()
for i in range(len(u)):
  print(u[i])
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = [0 for i in range(n)]
dics = {}
for i in range(n):
    try:
        s = input()
        a = dics[s]
        dics[s] += 1
    except KeyError:
        dics[s] = 1
max_v = max(dics.values())
max_k_list = [kv[0] for kv in dics.items() if kv[1] == max(dics.values())]
for i in max_k_list:
    print(i)

Failing test case input:
8
fufbblo
alofeub
omafftb
olaffvb
ouafflb
omaefub
buffalo
buofamf

Expected output:
alofeub
buffalo
buofamf
fufbblo
olaffvb
omaefub
omafftb
ouafflb


Actual output:
fufbblo
alofeub
omafftb
olaffvb
ouafflb
omaefub
buffalo
buofamf


Fixed submission (verdict: Accepted):
n = int(input())
dics = {}
for i in range(n):
    try:
        s = input()
        dics[s] += 1
    except KeyError:
        dics[s] = 1
max_v = max(dics.values())

max_k_list = [kv[0] for kv in dics.items() if kv[1] == max_v]
max_k_list.sort()
for i in max_k_list:
    print(i)

Problem: p02773
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import Counter

N = int(input())

mes_list = []
for i in range(N):
  mes_list.append(input())
count = Counter(mes_list)

answer = [k for k, v in count.items() if v == max(count.values())]
for ans in answer:
  print(ans)

Failing test case input:
7
afau
tdv
bfet
bdg
tew
ete
beet

Expected output:
afau
bdg
beet
bfet
ete
tdv
tew


Actual output:
afau
tdv
bfet
bdg
tew
ete
beet


Fixed submission (verdict: Accepted):
N = int(input())
 
mes_dict = {}
for i in range(N):
  m = input()
  try:
    mes_dict[m] += 1
  except:
    mes_dict[m] = 1

ma =max(mes_dict.values())
answer = sorted([k for k, v in mes_dict.items() if v == ma])
for ans in answer:
  print(ans)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

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

_max = 0
for v in dic.values():
  if _max < v:
    _max = v

for k,v in dic.items():
  if v == _max:
    print(k)

Failing test case input:
7
afau
vdu
bfet
bgd
tev
etd
beet

Expected output:
afau
beet
bfet
bgd
etd
tev
vdu


Actual output:
afau
vdu
bfet
bgd
tev
etd
beet


Fixed submission (verdict: Accepted):
n = int(input())

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

_max = 0
for v in dic.values():
  if _max < v:
    _max = v
dic2 = sorted(dic.items())

for (k,v) in dic2:
  if v == _max:
    print(k)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n =int(input())
s_list = list(input() for i in range(1,n+1))

from collections import Counter

c = Counter(s_list)
max = max(list(c.values()))

list = []
for kv in c.items():
    if kv[1]== max:
        list.append(kv[0])

list_new = '\n'.join(list)

print(list_new)
        

        




Failing test case input:
8
fubfalo
buefalo
buffamo
olaffub
ouafflb
omaffub
buffalo
buofalf

Expected output:
buefalo
buffalo
buffamo
buofalf
fubfalo
olaffub
omaffub
ouafflb


Actual output:
fubfalo
buefalo
buffamo
olaffub
ouafflb
omaffub
buffalo
buofalf


Fixed submission (verdict: Accepted):
n =int(input())
s_list = list(input() for i in range(1,n+1))

from collections import Counter

c = Counter(s_list)
max = max(list(c.values()))

list = []
for kv in c.items():
    if kv[1]== max:
        list.append(kv[0])


list.sort()
list_new = '\n'.join(list)

print(list_new)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
list_a = []

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

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

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

Failing test case input:
7
beat
veu
beet
bed
vet
bet
beet

Expected output:
beet


Actual output:
beat
bed
bet
vet
veu


Fixed submission (verdict: Accepted):

















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

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

max_value = max(d.values())
key = sorted([k for k, v in d.items() if v == max_value])
for i in key:
    print(i)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
S = []
for _ in range(n):
    S.append(input())

S.sort()
a = S[0]
c = 0
moji = []

for i in S:
    if a != i:
        moji.append([c,a])
        a = i
        c = 0
    c += 1
if c > 0:
    moji.append([c,a])

moji.sort(reverse=True)
maxc = moji[0][0]
for j in moji:
    if j[0] < maxc: break
    print (j[1])


Failing test case input:
4
jsgs
sbou
chmiia
muk

Expected output:
chmiia
jsgs
muk
sbou


Actual output:
sbou
muk
jsgs
chmiia


Fixed submission (verdict: Accepted):
n = int(input())
S = []
for _ in range(n):
    S.append(input())

S.sort()
a = S[0]
c = 0
moji = []

for i in S:
    if a != i:
        moji.append([c,a])
        a = i
        c = 0
    c += 1
if c > 0:
    moji.append([c,a])

moji.sort(reverse=True)
maxc = moji[0][0]
x = []
for j in moji:
    if j[0] < maxc: break
    x.append(j[1])
x.sort()
for j in x:
    print(j)
Problem: p02773
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
s={}
for i in range(n):
  wd=input()
  if wd in s:
    s[wd]+=1
  else:
    s[wd]=1
mx=max(s.values())

ans=[]
for i in s.keys():
  if s[i]==mx:
    ans.append(i)
for i in ans:
  print(i)



Failing test case input:
4
ihsu
uoat
michia
kum

Expected output:
ihsu
kum
michia
uoat


Actual output:
ihsu
uoat
michia
kum


Fixed submission (verdict: Accepted):
n=int(input())
s={}
for i in range(n):
  wd=input()
  if wd in s:
    s[wd]+=1
  else:
    s[wd]=1
mx=max(s.values())

ans=[]
for i in s.keys():
  if s[i]==mx:
    ans.append(i)
ans.sort()
for i in ans:
  print(i)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
l = []

for _ in range(N):
    s = str(input())
    l.append(s)

import collections
c = collections.Counter(l)

ml = [kv for kv in c.items() if kv[1] == max(c.values())]

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

Failing test case input:
7
beat
vet
beet
bed
vet
bet
beet

Expected output:
beet
vet

Actual output:
vet
beet


Fixed submission (verdict: Accepted):
N = int(input())
l = []

for _ in range(N):
    s = str(input())
    l.append(s)

import collections
c = collections.Counter(l)
c = c.most_common()

most_count = c[0][1]
c.sort()

for i in range(len(c)):
    if c[i][1] == most_count:
        print(c[i][0])

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter


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

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


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

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

Failing test case input:
4
ihsu
taou
michia
kun

Expected output:
ihsu
kun
michia
taou


Actual output:
ihsu
taou
michia
kun


Fixed submission (verdict: Accepted):
from collections import Counter


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

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


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

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

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = ['.'] * n
for i in range(n):
    s[i] = str(input())

dict = {}

for i in range(n):
    if s[i] in dict:
        dict[s[i]] += 1
    else:
        dict[s[i]] = 1
        
m = max(dict.values())

keys = [k for k, v in dict.items() if v == m]
for i in range(len(keys)):
    print(keys[i])


Failing test case input:
4
jsgs
uobt
ahmhic
muk

Expected output:
ahmhic
jsgs
muk
uobt


Actual output:
jsgs
uobt
ahmhic
muk


Fixed submission (verdict: Accepted):
n = int(input())
s = ['.'] * n
for i in range(n):
    s[i] = str(input())

dict = {}

for i in range(n):
    if s[i] in dict:
        dict[s[i]] += 1
    else:
        dict[s[i]] = 1
        
m = max(dict.values())

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