ZhenlongDai/ACPR huggingface dataset:
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
s=[input() for i in range (N)]

s.sort()
count=1
maximum=0

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

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

Expected output:
beau
bfd
bfet
tec
teeb
uev
vte


Actual output:
beau
bfd
bfet
tec
teeb
uev


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

s.sort()
count=1
maximum=0

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

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


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

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


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

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


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

Expected output:
beau
bfd
bfet
etc
teeb
vet
veu


Actual output:

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):
from collections import defaultdict
N = int(input())
word_count = defaultdict(int)
for _ in range(N): 
    word_count[input()] += 1
max_amount = sorted(word_count.items(), reverse=True)[0][1]
max_amount_words = sorted([k for k, v in word_count.items() if v == max_amount])
print('\n'.join(max_amount_words))


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 defaultdict
N = int(input())
word_count = defaultdict(int)
for _ in range(N): 
    word_count[input()] += 1
max_amount = sorted(word_count.items(), key=lambda x:x[1],  reverse=True)[0][1]
max_amount_words = sorted([k for k, v in word_count.items() if v == max_amount])
print('\n'.join(max_amount_words))
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
for i in range(len(u)):
  print(u[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):
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 = [input() for _ in range(n)]
s.sort()

count = {}
for s_i in s:
    if not s_i in count:
        count[s_i] = 0
    count[s_i] += 1
res = sorted(zip(count.keys(), count.values()),
             key=lambda x: x[1], reverse=True)

num = res[0][1]
res2 = []
for res_i in res:
    if res_i[1] != num:
        exit(0)
    res2.append(res_i[0])

res2.sort()
for res2_i in res2:
    print(res2_i)


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

Expected output:
kick

Actual output:

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

count = {}
for s_i in s:
    if not s_i in count:
        count[s_i] = 0
    count[s_i] += 1
res = sorted(zip(count.keys(), count.values()),
             key=lambda x: x[1], reverse=True)

num = res[0][1]
res2 = []
for res_i in res:
    if res_i[1] != num:
        break
    res2.append(res_i[0])

res2.sort()
for res2_i in res2:
    print(res2_i)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
input = sys.stdin.readline
N = int(input())
S = []
for _ in range(N):
    s = input().replace("\n", "")
    S.append(s)
S.sort()
f = 0
tres = 0
res = []
for i in range(1, N):
    if S[i] == S[i-1]:
        f += 1
    else:
        f = 0
    if f == tres:
        res.append(S[i])
    elif f > tres:
        tres = f
        res = [S[i]]

print("\n".join(map(str, res)))


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:
buffalo
buofamf
fufbblo
olaffvb
omaefub
omafftb
ouafflb


Fixed submission (verdict: Accepted):
import sys
input = sys.stdin.readline
N = int(input())
S = []
for _ in range(N):
    s = input().replace("\n", "")
    S.append(s)
S.sort()
f = 0
tres = 0
res = [S[0]]
for i in range(1, N):
    if S[i] == S[i-1]:
        f += 1
    else:
        f = 0
    if f == tres:
        res.append(S[i])
    elif f > tres:
        tres = f
        res = [S[i]]

print("\n".join(map(str, res)))
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict
N = int(input())
S = [input() for i in range(N)]
S.sort()
input_dict = defaultdict(int)
for key in S:
    input_dict[key] += 1
for k, v in input_dict.items():
    if v == input_dict[max(input_dict)]:
        print(k)


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

Expected output:
buffalo


Actual output:
olaffub


Fixed submission (verdict: Accepted):
from collections import defaultdict
N = int(input())
S = [input() for i in range(N)]
input_dict = defaultdict(int)
for key in S:
    input_dict[key] += 1
max_value = max(input_dict.values())
max_list = []
for k, v in input_dict.items():
    if v == max_value:
        max_list.append(k)
max_list.sort()
[print(i) for i in max_list]

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:
7
bt`s
btbr
ildk
kicj
btsa
kcjk
khck

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


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


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



c = collections.Counter(S)
ans = []

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]):
            ans.append(((c.most_common()[i][0])))
        else:
            break

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

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
buffalo
buffamo
buofalf
olaffub
omaffub
ouafflb


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 (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
S = [0]*N
for i in range(N):
    S[i] = input()
A = {}
for s in S:
    if s not in A:
        A[s] = 1
    else:
        A[s] += 1

B = [(a, A[a]) for a in A]

B.sort(reverse=True, key=lambda x: x[1])

count = B[0][1]
for b in B:
    if b[1] == count:
        print(b[0])


Failing test case input:
7
bass
btbs
ikdk
licj
asta
kcjk
khbk

Expected output:
asta
bass
btbs
ikdk
kcjk
khbk
licj


Actual output:
bass
btbs
ikdk
licj
asta
kcjk
khbk


Fixed submission (verdict: Accepted):
N = int(input())
S = [0]*N
for i in range(N):
    S[i] = input()
A = {}
for s in S:
    if s not in A:
        A[s] = 1
    else:
        A[s] += 1

B = [(a, A[a]) for a in A]

B.sort(reverse=True, key=lambda x: x[1])

count = B[0][1]
ans = []
for b in B:
    if b[1] == count:
        ans.append(b[0])

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

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
from functools import reduce
import itertools

def input1():
	return int(input())


def input2():
	return map(int,input().split())


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





N=input1()
S=[]
for _ in range(N):
	S.append(str(input()))

dic={}
results=[]
for s in S:
	if s not in dic:
		dic[s]=1
	else:
		dic[s]+=1
ans=-1





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

for x in score_sorted:
	if x[1]>=ans:
		print(x[0])
		ans=x[1]
	else:
		break



















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

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


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


Fixed submission (verdict: Accepted):
import math
from functools import reduce
import itertools

def input1():
	return int(input())


def input2():
	return map(int,input().split())


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





N=input1()
S=[]
for _ in range(N):
	S.append(str(input()))

dic={}
results=[]
for s in S:
	if s not in dic:
		dic[s]=1
	else:
		dic[s]+=1
ans=10000010010


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

max_count=max(dic.values())
for x in score_sorted:
	if x[1]==max_count:
		results.append(x[0])
results.sort()
for i in results:
	print(i)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
n = int(input())
c = [0 for _ in range(n)]
for i in range(n):
    c[i] = input()
c = collections.Counter(c).most_common()

first = c[0][1]
for i in c:
    if i[1] == first:
        print(i[0])

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):
import collections
n = int(input())
c = [0 for _ in range(n)]
for i in range(n):
    c[i] = input()
c = collections.Counter(c).most_common()
ans = []
first = c[0][1]
for i in c:
    if i[1] == first:
        ans.append(i[0])

ans.sort()
for l in ans:
    print(l)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
listS=[]
for i in range(N):
  S=input()
  listS+=[S]
listS.sort()
counter=[]
count=1
for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
  else:
    counter+=[count]
    count=1
    
counter+=[count]    
MAX=max(counter)
count=1

for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
  else:
    count=1
  if count==MAX:
    print(listS[i])
if count==MAX:
  print(listS[-1])      

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

Expected output:
kick

Actual output:
kick
kick


Fixed submission (verdict: Accepted):
N=int(input())
listS=[]
for i in range(N):
  S=input()
  listS+=[S]
listS.sort()
counter=[]
count=1
for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
  else:
    counter+=[count]
    count=1
    
counter+=[count]    
MAX=max(counter)
count=1

for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
  else:
    count=1
  if count==MAX:
    print(listS[i])
    
if MAX==1:
  print(listS[-1])

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

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

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

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

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

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 = 0

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

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

Expected output:
beau
bfd
bfet
etc
teeb
uev
vet


Actual output:
beau
uev
bfet
bfd
vet
etc
teeb


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.8.2), verdict: Wrong Answer):
from collections import Counter

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

max = s[0][1]
max_s = []

for i in range(len(s)):
    if int(s[i][1]) == int(max):
        max_s.append(s[i][0])
max_s.sort()
print(max_s)

Failing test case input:
4
jsgs
uobt
ahmhic
muk

Expected output:
ahmhic
jsgs
muk
uobt


Actual output:
ahmhic, jsgs, muk, uobt

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

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

max = s[0][1]
max_s = []

for i in range(len(s)):
    if int(s[i][1]) == int(max):
        max_s.append(s[i][0])
max_s.sort()

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

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

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

print(s_c)
print(m)
ans = []

for j in range(len(s_c)):
    if s_c[j][1] != m:
        break
    else:
        ans.append(s_c[j][0])
        
ans.sort()

for k in ans:
    print(k)

Failing test case input:
7
bass
stab
ikdk
kick
asta
kcik
khck

Expected output:
asta
bass
ikdk
kcik
khck
kick
stab


Actual output:
[('bass', 1), ('stab', 1), ('ikdk', 1), ('kick', 1), ('asta', 1), ('kcik', 1), ('khck', 1)]
1
asta
bass
ikdk
kcik
khck
kick
stab


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

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

ans = []

for j in range(len(s_c)):
    if s_c[j][1] != m:
        break
    else:
        ans.append(s_c[j][0])
        
ans.sort()

for k in ans:
    print(k)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter


def words_sort_ordered(words_list):
    cnt = Counter()
    for word in words_list:
        cnt[word] += 1

    written_words_number = []
    for x in cnt.values():
        written_words_number.append(x)

    answer_words_list = []

    for word, number in dict(cnt).items():
        if number == max(written_words_number):
            answer_words_list.append(word)

    return sorted(answer_words_list)


if __name__ == '__main__':
    words_num = int(input())
    words_list = [input() for i in range(words_num)]
    print(words_sort_ordered(words_list))

Failing test case input:
4
sgsj
sbou
chmiia
muk

Expected output:
chmiia
muk
sbou
sgsj


Actual output:
chmiia, muk, sbou, sgsj

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


def words_sort_ordered(words_list):
    word_cnt = Counter()
    for word in words_list:
        word_cnt[word] += 1

    word_written_max_time = 0
    for each_word_ct in word_cnt.values():
        if each_word_ct > word_written_max_time:
            word_written_max_time = each_word_ct

    answer_words_list = []
    for word, number in dict(word_cnt).items():
        if number == word_written_max_time:
            answer_words_list.append(word)

    return sorted(answer_words_list)


if __name__ == '__main__':
    words_num = int(input())
    words_list = [input() for i in range(words_num)]
    for w in words_sort_ordered(words_list):
        print(w)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
s=[input() for i in range(n)]
s.sort()
cnt=1
ans=0
pri=[]
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        ans=max(cnt,ans)
        cnt=1
ans=max(cnt,ans)
cnt=1
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        if cnt==ans:
            pri.append(s[i])
            cnt=1
        else:
            cnt=1
if cnt==ans:
    pri.append(s[-1])
print(ans)
for i in range(len(pri)):
    print(pri[i])

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

Expected output:
kick


Actual output:
4
kick


Fixed submission (verdict: Accepted):
n=int(input())
s=[input() for i in range(n)]
s.sort()
cnt=1
ans=0
pri=[]
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        ans=max(cnt,ans)
        cnt=1
ans=max(cnt,ans)
cnt=1
for i in range(n-1):
    if s[i]==s[i+1]:
        cnt+=1
    else:
        if cnt==ans:
            pri.append(s[i])
            cnt=1
        else:
            cnt=1
if cnt==ans:
    pri.append(s[-1])
for i in range(len(pri)):
    print(pri[i])
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
dic = {}
for _ in range(n):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
m = max(dic.values())
anslis = []
for k, v in dic.items():
    if v == m:
        anslis.append(k)
print('/n'.join(anslis))

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

Expected output:
asta
bass
btas
ikdk
kcik
khbk
kicj


Actual output:
bass/nbtas/nikdk/nkicj/nasta/nkcik/nkhbk


Fixed submission (verdict: Accepted):
n = int(input())
dic = {}
for _ in range(n):
    s = input()
    if s not in dic:
        dic[s] = 1
    else:
        dic[s] += 1
m = max(dic.values())
anslis = []
for k, v in dic.items():
    if v == m:
        anslis.append(k)
print('\n'.join(sorted(anslis)))

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

from collections import defaultdict
 
counter = defaultdict(int)
 
for x in S:
    counter[x] += 1

X = counter[max(counter)]
s = set(S)
ans=[]
for i in s:
    if counter[i] == X:
        ans.append(i)

for i in sorted(ans):
    print(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())
S = [0]*N
for i in range(N):
    S[i] = input()

from collections import defaultdict
 
counter = defaultdict(int)
 
for x in S:
    counter[x] += 1

X = max(counter.values())
s = set(S)
ans=[]
for i in s:
    if counter[i] == X:
        ans.append(i)

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

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

a=[]
count=[]
buf=1
for i in range(n):
    if s[i]==s[i+1]:
        buf+=1
    elif buf>1:
        a.append(s[i])
        count.append(buf)
        buf=1


for i in range(len(a)):
    if count[i]==max(count):
        print(a[i])

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

Expected output:
beat
bed
beet
bet
teeb
veu
vte


Actual output:

Fixed submission (verdict: Accepted):
n=int(input())
s=[input() for _ in range(n)]
s.sort()
s.append("")
a=[]
count=[]
buf=1
count_max=1
for i in range(n):
    s_i=s[i]
    if s_i==s[i+1]:
        buf+=1
    else:
        if buf>=count_max:
            a.append(s_i)
            count.append(buf)
            if buf>count_max:
                count_max=buf
        buf=1
count_max=max(count)
for i in range(len(a)):
    if count[i]==count_max:
        print(a[i])
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
class Counter(dict):
  def __missing__(self, i):
    return 0

n = int(input())

s = Counter()

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

s = dict(sorted(s.items(), key=lambda x: -x[1]))
m = list(s.values())[0]

ans = []
for i in s:
  if s[i] == m:
    ans.append(i)

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


Failing test case input:
4
ihst
tbou
aimhic
kul

Expected output:
aimhic
ihst
kul
tbou


Actual output:
ihst
tbou
aimhic
kul


Fixed submission (verdict: Accepted):
class Counter(dict):
  def __missing__(self, i):
    return 0

n = int(input())

s = Counter()

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

s = list(sorted(s.items(), key=lambda x: -x[1]))
m = s[0][1]

ans = []
for key, value in s:
  if value == m:
    ans.append(key)
  else:
    break

ans.sort()

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

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

N = int(input())

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

ans = {}
for cnt in S:
  if cnt in ans:
    ans[cnt] += 1
  else:
  	ans[cnt] = 1

max_v = max(ans.values())
for k, v in ans.items():
  if v == max_v:
    print(k)

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

Expected output:
alofeub
buofamf
fufbblo
omaefub
omafftb
ouafflb
ouffalb
plaffvb


Actual output:
fufbblo
alofeub
omafftb
plaffvb
ouafflb
omaefub
ouffalb
buofamf


Fixed submission (verdict: Accepted):

N = int(input())

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

ans = {}
for cnt in S:
  if cnt in ans:
    ans[cnt] += 1
  else:
  	ans[cnt] = 1
max_v = max(ans.values())

for k, v in sorted(ans.items()):
  if v == max_v:
    print(k)

Problem: p02773
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):

def count(list):
    dict = {}
    for i in range(len(list)):
        dict[list[i]] = dict.get(list[i], 0) + 1
    return dict

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

dic = count(s)
lst = sorted(dic.items(), key=lambda x: x[1], reverse=True)
value_max = lst[0][1]
output = []

for name in lst:
    if name[1] == value_max:
        output.append(name[0])
    else:
        break

print(*output, sep="\n")

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

def count(list):
    dict = {}
    for i in range(len(list)):
        dict[list[i]] = dict.get(list[i], 0) + 1
    return dict

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

dic = count(s)
lst = sorted(dic.items(), key=lambda x: x[1], reverse=True)
value_max = lst[0][1]
output = []

for name in lst:
    if name[1] == value_max:
        output.append(name[0])
    else:
        break

output.sort()
print(*output,sep="\n")
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys,collections
s=collections.Counter(map(lambda x: x.rstrip(),sys.stdin.readlines()[1:])).most_common()
print(*[i[0] for i in s if i[1]==s[0][1]],sep="\n")

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

Expected output:
beau
bfd
bfet
sec
teeb
uev
vte


Actual output:
beau
uev
bfet
bfd
vte
sec
teeb


Fixed submission (verdict: Accepted):
from collections import *
_,*a=map(lambda x:x.rstrip(), open(0))
a=Counter(a).most_common()
a=sorted([i[0] for i in a if i[1]==a[0][1]])
print(*a,sep="\n")

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


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

dic = collections.Counter(s)
k = dic.most_common()
m = k[0][1]
mx = m
i = 0
while m == mx: 
    print(k[i][0])
    i += 1
    if i > len(k)-1:
        break
    m = k[i][1]



Failing test case input:
4
jsgs
tbou
ahmiic
muk

Expected output:
ahmiic
jsgs
muk
tbou


Actual output:
jsgs
tbou
ahmiic
muk


Fixed submission (verdict: Accepted):
import collections


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

dic = collections.Counter(s)
k = dic.most_common()
m = k[0][1]
mx = m
i = 0
ans = []
while m == mx: 
    ans.append(k[i][0])
    i += 1
    if i > len(k)-1:
        break
    m = k[i][1]

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

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

S = {}

A = [""]*N
for i in range(0, N):
    A[i] = A[i] + input()

for i in range(0, N):
    if not (A[i] in S.keys()):
        S[A[i]] = 1
    else:
        S[A[i]] = S[A[i]] + 1

max = 0
for value in S.values():
    if value > max:
        max = value

S0 = {}
for key, value in S.items():
    if value == max:
        S0[key] = 0

for key in S0.keys():
    print(key)

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

Expected output:
asta
bats
btbr
ildk
kcjk
khck
kicj


Actual output:
bats
btbr
ildk
kicj
asta
kcjk
khck


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

S = {}

A = [""]*N
for i in range(0, N):
    A[i] = A[i] + input()

for i in range(0, N):
    if not (A[i] in S.keys()):
        S[A[i]] = 1
    else:
        S[A[i]] = S[A[i]] + 1

max = 0
for value in S.values():
    if value > max:
        max = value

S0 = {}
n = 0
for key, value in S.items():
    if value == max:
        S0[key] = 0
        n += 1

T = [""]*n
i = 0
for key in S0.keys():
    T[i] = key
    i += 1

T.sort()
for p in range(0, n):
    print(T[p])
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(input())
cnt = Counter(S).most_common()
ans = []
for a,b in cnt:
  ans.append(a*(b==cnt[0][1]))
ans = sorted(ans)
print(ans)

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

Expected output:
afau
beet
bfet
dgb
etc
tev
udv


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

Fixed submission (verdict: Accepted):
from collections import Counter
N = int(input())
S  = []
for i in range(N):
  S.append(input())
cnt = Counter(S)
ans = []
max_vote = max(cnt.values())
for a,b in cnt.items():
  if max_vote==b:
    ans.append(a)
ans = sorted(ans)
print("\r\n".join(ans))

Problem: p02773
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
from collections import defaultdict
from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  dic = defaultdict(int)
  for i in range(N):
    dic[input()[:-1]] += 1

  max_ = max(dic.values())
  for key, val in dic.items():
    if val == max_:
      print(key)


if(__name__ == '__main__'):
  main()


Failing test case input:
4
igst
uobt
aimhic
kul

Expected output:
aimhic
igst
kul
uobt


Actual output:
igst
uobt
aimhic
kul


Fixed submission (verdict: Accepted):
from collections import defaultdict
from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  dic = defaultdict(int)
  for i in range(N):
    dic[input()[:-1]] += 1

  max_ = max(dic.values())
  out = []
  for key, val in dic.items():
    if val == max_:
      out.append(key)

  print(*sorted(out), sep='\n')


if(__name__ == '__main__'):
  main()

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = []
while True:
    try:
        s.append(input())
    except EOFError:
        break

word_counter = {}
for word in s:
    if word in word_counter:
        word_counter[word] += 1
    else:
        word_counter[word] = 0

results = sorted(word_counter.items(), key=lambda x: x[1], reverse=True)
max_v = results[0][1]

for r in results:
    if r[1] == max_v:
        print(r[0].strip('\n'))
    else:
        break
 

Failing test case input:
7
bass
btbs
ikdk
licj
asta
kcjk
khbk

Expected output:
asta
bass
btbs
ikdk
kcjk
khbk
licj


Actual output:
bass
btbs
ikdk
licj
asta
kcjk
khbk


Fixed submission (verdict: Accepted):
n = int(input())
s = []
while True:
    try:
        s.append(input())
    except EOFError:
        break

word_counter = {}
for word in s:
    if word in word_counter:
        word_counter[word] += 1
    else:
        word_counter[word] = 0

results = sorted(word_counter.items(), key=lambda x: x[1], reverse=True)
max_v = results[0][1]

pick_ups = [result[0] for result in results if result[1] == max_v]
sorted_pick_ups = sorted(pick_ups)
print(*sorted_pick_ups, sep='\n')
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def poll(s_list):
  s_dict = {}
  for s in s_list:
    if s not in s_dict:
      s_dict[s] = 1
    else:
      s_dict[s] += 1

  max_val = max(s_dict.values())
  max_key = [key for key in s_dict if s_dict[key] == max_val]

  new_s_list = sorted(max_key)
  return new_s_list

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

new_list = poll(s_list)
print(new_list)

Failing test case input:
4
jsgs
uobt
ahmiic
muk

Expected output:
ahmiic
jsgs
muk
uobt


Actual output:
ahmiic, jsgs, muk, uobt

Fixed submission (verdict: Accepted):
def poll(s_list):
  s_dict = {}
  for s in s_list:
    if s not in s_dict:
      s_dict[s] = 1
    else:
      s_dict[s] += 1

  max_val = max(s_dict.values())
  max_key = [key for key in s_dict if s_dict[key] == max_val]

  new_s_list = sorted(max_key)
  return new_s_list

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

new_list = poll(s_list)

for s in new_list:
  print(s)

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = []
count = [0] * n
count[0] = 1

for i in range(n):
    s_e = str(input())
    s.append(s_e)
s.sort()

last = s[0]
s_max = 0

for i in range(1, n):
    if last == s[i]:
        count[i] = count[i-1] + 1
        s_max = max(s_max, count[i])
    else:
        last = s[i]
        count[i] = 1

for i in range(n):
    if s_max == count[i]:
        print(s[i])

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

Expected output:
asta
bats
btbr
ildk
kcjk
khck
kicj


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
s = []
count = [0] * n
count[0] = 1

for i in range(n):
    s_e = str(input())
    s.append(s_e)
s.sort()

last = s[0]
s_max = 1

for i in range(1, n):
    if last == s[i]:
        count[i] = count[i-1] + 1       
    else:
        s_max = max(s_max, count[i-1])
        last = s[i]
        count[i] = 1

s_max = max(s_max, count[n-1])

for i in range(n):
    if s_max == count[i]:
        print(s[i])

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])

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

Expected output:
buffalo

Actual output:
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo
buffalo


Fixed submission (verdict: Accepted):
n=int(input())
S=[]
ans=0
import collections
for i in range(n):
    s=input()
    S.append(s)
S=sorted(S)
c=collections.Counter(S)
ANS=[]
for i in range(n-1):
    if (S[i]!=S[i+1] and ans<c[S[i]]) or i==n-2:
        ans=c[S[i]]
        ANS.append(ans)
inko=""
ans=max(ANS)
for i in range(n):
    if c[S[i]]==ans and S[i]!=inko:
        print(S[i])
        inko=S[i]
Problem: p02773
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
s = list(input() for _ in range(n))
d = {}
for i in range(n):
    if s[i] in d:
        d[s[i]] += 1
    else:
        d[s[i]] = 1
m = d[max(d)]
for s in sorted(k for k in d if d[k] == m):
    print(s)

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

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

m = max(d.values())
for s in sorted(k for k in d if d[k] == m):
    print(s)

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

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


Failing test case input:
4
tgsj
uobt
aimhic
kum

Expected output:
aimhic
kum
tgsj
uobt


Actual output:
kum


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

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

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

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections
from collections import Counter
n=int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)
max = c.most_common()[0][1]
for i in c.items():
    if i[1] == max:
        print(i[0])


Failing test case input:
7
beau
uev
bfet
bed
vte
cet
teeb

Expected output:
beau
bed
bfet
cet
teeb
uev
vte


Actual output:
beau
uev
bfet
bed
vte
cet
teeb


Fixed submission (verdict: Accepted):
import collections
from collections import Counter
n=int(input())
string_list=[input() for i in range(n)]
c = collections.Counter(string_list)
max = c.most_common()[0][1]
list = []

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

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

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)

c = collections.Counter(strs)
maxv = -1
for k , v in c.most_common():
  if v != maxv and maxv != -1:
    break
  print(k)
  maxv = v

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 sys
import collections
N = int(input())
strs = []
for _ in range(N):
  s = input()
  strs.append(s)

c = collections.Counter(strs)
maxv = -1
ans = []
for k , v in c.most_common():
  if v != maxv and maxv != -1:
    break
  ans.append(k)
  maxv = v
for a in sorted(ans):
  print(a)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

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


counter = Counter(S)

mostnum = 0
ans = []
for c in counter.most_common():
    if mostnum < c[1]:
        mostnum = c[1]
        ans.append(c[0])
    else:
        break

ans.sort()

for a in ans:
    print(a)

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

Expected output:
afau
bdg
beet
bfet
ete
tdv
tew


Actual output:
afau


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

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


counter = Counter(S)

mostnum = 0
ans = []
for c in counter.most_common():
    if mostnum <= c[1]:
        mostnum = c[1]
        ans.append(c[0])
    else:
        break

ans.sort()

for a in ans:
    print(a)

Problem: p02773
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
D = {}
for n in range(N):
    w = input()
    if w not in D:
        D[w] = 0
    else:
        D[w] += 1
d = sorted(D.items(),key=lambda x:-x[1])
m = d[0][1]
for (key, value) in d:
    if value == m:
        print(key)
    else:
        exit()

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

Expected output:
bfau
bfet
dgb
etc
teeb
tev
veu


Actual output:
bfau
veu
bfet
dgb
tev
etc
teeb


Fixed submission (verdict: Accepted):
N = int(input())
D = {}
for n in range(N):
    w = input()
    if w not in D:
        D[w] = 1
    else:
        D[w] += 1
m = max(D.values())
l = []
for (key, value) in D.items():
    if value == m:
        l.append(key)
for s in sorted(l):
	print(s)

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

n=int(input())
s=[ input() for i in range(n)]
dick=Counter(s)
dick=dick.most_common()
print(dick)

p=dick[0][1]

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

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

Expected output:
afau
beet
bfet
bgd
etc
tev
udv


Actual output:
[('afau', 1), ('udv', 1), ('bfet', 1), ('bgd', 1), ('tev', 1), ('etc', 1), ('beet', 1)]
afau
beet
bfet
bgd
etc
tev
udv


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

n=int(input())
s=[ input() for i in range(n)]
dick=Counter(s)
dick=dick.most_common()


p=dick[0][1]

s=[]
for k,i in dick:
  if i==p:
    s.append(k)
  else:
    break
ss=sorted(s)
for i in ss:
  print(i)
Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

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

print_list = []
count = []
S_max = 0

S_common = S.most_common()


values, counts = zip(*S_common)
values = sorted(values)


for i in range(len(values)):
	if counts[0] == counts[i]:
		print(values[i])


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

Expected output:
beet
vet

Actual output:
beat
bed


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

S_common = S.most_common()

for i in range(len(S_common)):
	if S_common[0][1] == S_common[i][1]:
		S_print.append(S_common[i][0])

S_print_new = sorted(S_print)

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

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
S = []
for i in range(N):
    S.append(input())
vote = {}
for j in S:
    if j not in vote:
        vote[j] = 1
    else:
        vote[j] += 1
most = set()
highNo = 0
for k in vote:
    if vote[k] > highNo:
        most.clear()
        most.add(k)
        highNo = vote[k]
    elif vote[k] == highNo:
        most.add(k)
for h in most:
    print(h)

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:
fufbblo
plaffvb
omafftb
ouafflb
buofamf
alofeub
buffalo
omaefub


Fixed submission (verdict: Accepted):
N = int(input())
S = []
for i in range(N):
    S.append(input())
vote = {}
for j in S:
    if j not in vote:
        vote[j] = 1
    else:
        vote[j] += 1
most = set()
highNo = 0
for k in vote:
    if vote[k] > highNo:
        most.clear()
        most.add(k)
        highNo = vote[k]
    elif vote[k] == highNo:
        most.add(k)
most = list(most)


def sortLexo(givenList):
    givenList.sort()
    for i in givenList:
        print(i)
sortLexo(most)

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.items())
for l in range(len(count)):
    if max(count)==count[l]:
        print(values[l])

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

Expected output:
beau
bfd
bfet
sec
teeb
uev
vte


Actual output:
beau
uev
bfet
bfd
vte
sec
teeb


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())
s=[input() for _ in range(n)]



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

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


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

Expected output:
asta
bass
btbs
ikdk
kcjk
khck
kicj


Actual output:
bass
btbs
ikdk
kicj
asta
kcjk
khck


Fixed submission (verdict: Accepted):
n=int(input())
s=[input() for _ in range(n)]
 
 
 
count={}
for i in range(n):
    if s[i] not in count:
        count[s[i]] = 1
    else:
        count[s[i]] += 1
 
max = max(count.values())
ans = []
for word in count:
    if count[word] == max:
        ans.append(word)

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

Problem: p02773
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
s = [input() for i in range(n)]
d = {}
for i in s:
    if i in d.keys():
        d[i]=d[i]+1
    else:
        d[i]=1
d_sorted = sorted(d.items(), key=lambda x:x[1])
d_name = [x[0] for x in d_sorted if x[1] == d_sorted[-1][0]]
d_name.sort()
print("\n".join(d_name))

Failing test case input:
7
beau
uev
bfet
bed
vte
cet
teeb

Expected output:
beau
bed
bfet
cet
teeb
uev
vte


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
s = [input() for i in range(n)]
d = {}
for i in s:
    if i in d.keys():
        d[i]=d[i]+1
    else:
        d[i]=1
d_sorted = sorted(d.items(), key=lambda x:x[1])
d_name = [x[0] for x in d_sorted if x[1] == d_sorted[-1][1]]
d_name.sort()
print("\n".join(d_name))

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)
max_num = list(c.values())[0]
d = []
for key,value in c.items():
  if value == max_num:
    d.append(key)

for i in sorted(d):
  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):
import collections

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

c = collections.Counter(s)
max_num = max(c.values())
d = []
for key,value in c.items():
  if value == max_num:
    d.append(key)

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

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

d = {}
for s in S:
  if s in d:
    d[s] += 1
  else:
    d[s] = 1

ans = 0
for i in d.values():
  if ans < i:
    ans = i

for k, v in d.items():
  if ans == v:
    print(k)

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

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


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


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

d = {}
for s in S:
  if s in d:
    d[s] += 1
  else:
    d[s] = 1

list = []
max = max(d.values())
for k, v in d.items():
  if max == v:
    list.append(k)

list.sort()
for str in list:
  print(str)
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
max_s = [s[0] for s in s_counter.items() if s[1] == max]
for i in [s for s in S if s in max_s]:
    print(i)

Failing test case input:
4
ihsu
taou
michia
luk

Expected output:
ihsu
luk
michia
taou


Actual output:
ihsu
taou
michia
luk


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

N = int(sys.stdin.readline())
S = [None]*N
counter = {}
for i in range(N):
    tmp = input()
    if not tmp in counter:
        counter[tmp] = 0
    else:
        counter[tmp] += 1

counter_sorted = sorted(counter.items(), reverse = True)
tmp = counter_sorted[0][1]

output = []
L = len(counter)
for i in range(L):
    if tmp == counter_sorted[i][1]:
        output.append(counter_sorted[i][0])
    else:
        break

output = sorted(output)
for i in output:
    print(i)

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

Expected output:
beet


Actual output:
bet
vet
veu


Fixed submission (verdict: Accepted):
import sys

N = int(input())
S = [None]*N
counter = {}
for i in range(N):
    tmp = input()
    if tmp in counter:
        counter[tmp] += 1
    else:
        counter[tmp] = 1


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

tmp = counter_sorted[0][1]
output = []
L = len(counter)
for i in range(L):
    if tmp == counter_sorted[i][1]:
        output.append(counter_sorted[i][0])
    else:
        break


output = sorted(output)
for i in output:
    print(i)

Problem: p02773
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import collections
N = int(input())
S = {}
for i in range(N):
    si = input()
    if si in S:
        S[si] += 1
    else:
        S[si] = 1

m = max(S.values())
for i in S:
    if S[i] == m:
        print(i)


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):
import collections
N = int(input())
S = {}
for i in range(N):
    si = input()
    if si in S:
        S[si] += 1
    else:
        S[si] = 1

m = max(S.values())
for i in sorted(S.items()):
    
    
    if i[1] == m:
        print(i[0])