Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
num = 1
num1 = 0
N = input()
H = list(map(int, input().split())
for i in range(1,N) :
  if H[i] >= H[i-1] :
    num += 1
  else :
    num1 += 1
print(a)

Fixed submission:
N = int(input())
H = list(map(int, input().split()))

cnt = 0
for i in range(len(H)):
    if (max(H[0:i+1]) == H[i]):
        cnt += 1

print(cnt)

Buggy python submission (verdict: Runtime Error):
num = 1
num1 = 0
N = int(input())
H = list(map(int, input.split())
for i in range(1,N):
  if H[i] >= H[i-1]:
    num += 1
  else :
    num1 += 1
print(a)
         

Fixed submission:
N = int(input())
H = list(map(int, input().split()))

cnt = 0
for i in range(len(H)):
    if (max(H[0:i+1]) == H[i]):
        cnt += 1

print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input.split())
a = 1
f = 0
for i in range(1 , N):
  if H[i] > H[i-1] :
         a += 1
  else :
         f += 1
print(a)
         
         

Fixed submission:
N = int(input())
H = list(map(int, input().split()))

cnt = 0
for i in range(len(H)):
    if (max(H[0:i+1]) == H[i]):
        cnt += 1

print(cnt)

Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input.split())
count = 1
f = 0
for i in range(1 , N):
  if H[i] > H[i-1] :
         count += 1
  else :
         f += 1
print(count)
         
         
     
         

Fixed submission:
N = int(input())
H = list(map(int, input().split()))

cnt = 0
for i in range(len(H)):
    if (max(H[0:i+1]) == H[i]):
        cnt += 1

print(cnt)
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
d = []
for i in range(100) :
  if a % i == 0 and b % i == 0 :
    d.append(i)
d.sort(reverse = True)
print(d[k-1])

Fixed submission:
a,b,k = map(int,input().split())
d = []
for i in range(1 ,101) :
  if a % i == 0 and b % i == 0 :
    d.append(i)
d.sort(reverse = True)
print(d[k-1])
Buggy python submission (verdict: Runtime Error):
a = input()
date = list(a)
year = int(date[0])*1000 + int(date[1])*100 + int(date[2])*10 + int(date[3])
mon = int(date[4])*10 + int(date[5])
day = int(date[6])*10 + int(date[7])
if year < 2019 and mon < 5 :
  print("Heise")
else :
  print("TBD")
 


Fixed submission:
a = input()
date = list(a)
year = int(date[0])*1000 + int(date[1])*100 + int(date[2])*10 + int(date[3])
mon = int(date[5])*10 + int(date[6])
day = int(date[8])*10 + int(date[9])
if year < 2019 or mon < 5 :
  print("Heisei")
else :
  print("TBD")
Buggy python submission (verdict: Runtime Error):
N = int(input())
monsters = list(map(int, input().split()))
def gcd(a, b):
	if b > 0 :
      return gcd(b , a % b)
    else :
      return x
if len(monster) == 1 :
	print(monster[0])
else :
    mon = gcd(monster[0], monster[1])
    if len(monster) >= 2
    for i in range(2 , N) :
      mon = gcd(mon, monster[i])
print(mon)
    
    
    
     


Fixed submission:
N = int(input())
monster = list(map(int, input().split()))
def gcd(a, b):
	if b > 0 :
		return gcd(b, a % b)
	else:
		return a
if len(monster) == 1 :
	print(monster[0])
else:
	mon = gcd(monster[0], monster[1])
	if len(monster) != 2 :
		for i in range(2, N) :
			mon = gcd(mon, monster[i])
print(mon)
Buggy python submission (verdict: Runtime Error):
N=int(input())
if N < 1000 :
  print(f"ABC{N}")
else :
  n = N - 999
  print(f"ABD{n})

Fixed submission:
N=int(input())
if N <= 999 :
  print("ABC")
else :
  print("ABD")
Buggy python submission (verdict: Runtime Error):
if set(input()) == 2:
	print('yes')
else
	print('No')
  


Fixed submission:
if len(set(input())) == 2:
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

for i in range(Q):
	query = input().split()
	if query[0] == '1':
		S = S[::-1]
	else:
		if query[1] == '1':
			S = query[2] + S
		else:
			S = S + query[2]
print(S)

Fixed submission:
from collections import deque

S = deque(input())
Q = int(input())

rev = False
for i in range(Q):
	query = input().split()
	if query[0] == '1':
		rev = not rev
	else:
		if (query[1] == '1' and rev == False) \
		or (query[1] == '2' and rev == True):
			S.appendleft(query[2])
		else:
			S.append(query[2])

if rev:
	S.reverse()

print("".join(S))
Buggy python submission (verdict: Time Limit Exceeded):
x,y,z,k = map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

a.sort(reverse=True),b.sort(reverse=True),c.sort(reverse=True)
ab = []
for i in range(x):
  for j in range(y):
    ab.append(a[i]+b[j])
ab.sort(reverse=True)
ab = ab[0:k]
abc = []
for i in ab:
  for j in c:
    abc.append(i+j)
abc.sort(reverse=True)
abc = abc[0:k]
for i in abc:
  print(i)

Fixed submission:
x,y,z,k = map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

a.sort(reverse=True),b.sort(reverse=True),c.sort(reverse=True)
ab = []
for i in range(x):
  for j in range(y):
    ab.append(a[i]+b[j])
ab.sort(reverse=True)
ab = ab[0:k]
abc = []
for i in ab:
  for j in c:
    abc.append(i+j)
abc.sort(reverse=True)
abc = abc[0:k]
for i in abc:
  print(i)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,q= map(int,input().split())
s = list(input())
td = [input().split() for _ in range(q)]
data = {i :[] for i in list(set(s))}
for j,i in enumerate(s):
  data[i].append(j+1)

ans = np.array([0]+[1]*n+[0])

for i,j in td:
  if i in s:
    temp = ans[data[i[0]]].copy()
    ans[data[i[0]]]=0
    if j=='L':
      ans[np.array(data[i[0]])-1]+=temp
    else:
      ans[np.array(data[i[0]])+1]+=temp
print(n-ans[0]-ans[-1])

Fixed submission:
n,q= map(int,input().split())
s = [0]+list(input())+[0]
td = [input().split() for _ in range(q)]
l,r = 0,n+1
for i,j in td[::-1]:
  if s[l+1]==i and j=='L':
    l+=1
  elif s[l]==i and j=='R':
    l-=1
  if s[r-1]==i and j=='R':
    r-=1
  elif s[r]==i and j=='L':
    r+=1
print(max(0,r-l-1))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,q= map(int,input().split())
s = list(input())
td = [input().split() for _ in range(q)]
data = {i :[] for i in list(set(s))}
for j,i in enumerate(s):
  data[i].append(j+1)

ans = np.array([0]+[1]*n+[0])

for i in td:
  if i[0] in s:
    temp = ans[data[i[0]]].copy()
    ans[data[i[0]]]=0
    if i[1]=='L':
      ans[np.array(data[i[0]])-1]+=temp
    else:
      ans[np.array(data[i[0]])+1]+=temp
  ans[[0,-1]]=0
  
print(ans[1:-1].sum())


Fixed submission:
n,q= map(int,input().split())
s = [0]+list(input())+[0]
td = [input().split() for _ in range(q)]
l,r = 0,n+1
for i,j in td[::-1]:
  if s[l+1]==i and j=='L':
    l+=1
  elif s[l]==i and j=='R':
    l-=1
  if s[r-1]==i and j=='R':
    r-=1
  elif s[r]==i and j=='L':
    r+=1
print(max(0,r-l-1))
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
for k in range(q):
  j = [int(_) for _ in input().split()]
  i = s[j[0]-1:j[1]]
  print(i.count('AC'))


Fixed submission:
n,q = map(int,input().split())
s = input()
lr = [[int(i) for i in input().split()]for _ in range(q)]
dp = [0]*n
f,c = 0,0
for i,j in enumerate(s):
  if f==1 and j=='C':
    c+=1
    f =0
  elif j=='A':
    f = 1
  else:
    f = 0
  dp[i]=c
for i in lr:
  print(dp[i[1]-1]-dp[i[0]-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
lr = [[int(i) for i in input().split()]for _ in range(q)]

for j in lr:
  i = s[j[0]-1:j[1]]
  print(i.count('AC'))

Fixed submission:
n,q = map(int,input().split())
s = input()
lr = [[int(i) for i in input().split()]for _ in range(q)]
dp = [0]*n
f,c = 0,0
for i,j in enumerate(s):
  if f==1 and j=='C':
    c+=1
    f =0
  elif j=='A':
    f = 1
  else:
    f = 0
  dp[i]=c
for i in lr:
  print(dp[i[1]-1]-dp[i[0]-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()
lr = [[int(i) for i in input().split()]for _ in range(q)]
count,ans,f = 0,0,0
for j in lr:
  ans = 0
  f = 0
  for i in s[j[0]-1:j[1]]:
    
    if i =='A':
      f = 1
    elif i =='C' and f==1:
      ans+=1
      f =0
    else:
      f = 0
  print(ans)


Fixed submission:
n,q = map(int,input().split())
s = input()
lr = [[int(i) for i in input().split()]for _ in range(q)]
dp = [0]*n
f,c = 0,0
for i,j in enumerate(s):
  if f==1 and j=='C':
    c+=1
    f =0
  elif j=='A':
    f = 1
  else:
    f = 0
  dp[i]=c
for i in lr:
  print(dp[i[1]-1]-dp[i[0]-1])
Buggy python submission (verdict: Time Limit Exceeded):
a,b = map(int,input().split())
ans = [i for i in range(a,b+1)]
c=ans[0]
for i in ans[1:]:
  c = c^i
  
print(c)

Fixed submission:
a,b = map(int,input().split())

def calc(i):
  ans = [0 for _ in range(40)]
  i += 1
  for j in range(1,41):
    
    loop = 2**j
    c = (i//loop)*(loop/2)
    c += max(0,(i%loop)-(loop/2))
    if c%2 == 1:
      ans[-j]+=1
  ans = int(''.join(str(_) for _ in ans),2)
  return ans

if a<1:
  print(calc(b))
else:
  print(calc(a-1)^calc(b))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
a,b,q = map(int,input().split())
s = np.array([-np.inf]+[int(input()) for i in range(a)]+[np.inf])
t = np.array([-np.inf]+[int(input()) for i in range(b)]+[np.inf])
x = np.array([int(input()) for i in range(q)])

def distance(s,t,xi):
  s_ = s-xi
  s_m = s_[s_<=0].max()
  s_p = s_[s_>=0].min()
  t_ = t-xi
  t_m = t_[t_<=0].max()
  t_p = t_[t_>=0].min()
  
  return min(abs(min(s_m,t_m)),abs(t_p-s_m)+min(abs(t_p),abs(s_m))\
         ,abs(max(t_p,s_p)),abs(s_p-t_m)+min(abs(s_p),abs(s_p)))
 
for i in x:
  print(int(distance(s,t,i)))

Fixed submission:
import numpy as np
import bisect
a,b,q = map(int,input().split())
s = np.array([-np.inf]+[int(input()) for i in range(a)]+[np.inf])
t = np.array([-np.inf]+[int(input()) for i in range(b)]+[np.inf])
x = np.array([int(input()) for i in range(q)])


  
def distance(s,t,xi):
  s_ = bisect.bisect_left(s,xi)
  s_m = abs(s[s_-1]-xi)
  s_p = abs(s[s_]-xi)
  t_ = bisect.bisect_left(t,xi)
  t_m = abs(t[t_-1]-xi)
  t_p = abs(t[t_]-xi)
  
  return min(max(s_m,t_m),s_m+t_p+min(s_m,t_p),s_p+t_m+min(s_p,t_m),max(s_p,t_p))
 
for i in x:
  print(int(distance(s,t,i)))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
a,b,q = map(int,input().split())
s = np.array([int(input()) for i in range(a)])
t = np.array([int(input()) for i in range(b)])
x = np.array([int(input()) for i in range(q)])

def distance(s,t,xi):
  s_ = s-xi
  if len(s_[s_<=0])!=0:
    s_m = s_[s_<=0].max()
  else:
    s_m =-np.inf
  if len(s_[s_>=0]) !=0:
    s_p = s_[s_>=0].min()
  else:
    s_p = np.inf
    
  t_ = t-xi
  if len(t_[t_<=0])!=0:
    t_m = t_[t_<=0].max()
  else:
    t_m = -np.inf
  if len(t_[t_>=0]) !=0:
    t_p = t_[t_>=0].min()
  else:
    t_p = np.inf
  return min(abs(min(s_m,t_m)),abs(t_p-s_m)+min(abs(t_p),abs(s_m))\
         ,abs(max(t_p,s_p)),abs(s_p-t_m)+min(abs(s_p),abs(s_p)))
 
for i in x:
  print(distance(s,t,i))

Fixed submission:
import numpy as np
import bisect
a,b,q = map(int,input().split())
s = np.array([-np.inf]+[int(input()) for i in range(a)]+[np.inf])
t = np.array([-np.inf]+[int(input()) for i in range(b)]+[np.inf])
x = np.array([int(input()) for i in range(q)])


  
def distance(s,t,xi):
  s_ = bisect.bisect_left(s,xi)
  s_m = abs(s[s_-1]-xi)
  s_p = abs(s[s_]-xi)
  t_ = bisect.bisect_left(t,xi)
  t_m = abs(t[t_-1]-xi)
  t_p = abs(t[t_]-xi)
  
  return min(max(s_m,t_m),s_m+t_p+min(s_m,t_p),s_p+t_m+min(s_p,t_m),max(s_p,t_p))
 
for i in x:
  print(int(distance(s,t,i)))
Buggy python submission (verdict: Runtime Error):
k,a,b = map(int,input().split())
if b-a <= 2:
  print(k+1)
elif  a+1 >= k:
  print(k+1)
else:
  print(a+int((k+1-a)/2)*max(2,(b-a))+(k+1-a)%2)

Fixed submission:
n,k = map(int,input().split())
m = int(n/2)+n%2
ans = 'YES' if m>=k else 'NO'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()


count = 0

for i,x in enumerate(s):
  if x=='B':
    count += s[i:].count('W')

print(count)

Fixed submission:
s = input()

count = 0
black = 0
for i in s:
  if i=='W':
    count += black
  else:
    black+=1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()

idx = [i for i,x in enumerate(s) if x =='W']


count = 0
for i in idx:
  count += s[0:i].count('B')
  
print(count)

Fixed submission:
s = input()

count = 0
black = 0
for i in s:
  if i=='W':
    count += black
  else:
    black+=1

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
s = input()
S = []
for i in s:
  if i =='B':
    S.append(1)
  else:
    S.append(0)
idx = [i for i,x in enumerate(S) if x ==0]
S = np.array(S)
count = 0
for i in idx:
  count += S[0:i].sum()
  
print(count)

Fixed submission:
s = input()

count = 0
black = 0
for i in s:
  if i=='W':
    count += black
  else:
    black+=1

print(count)
Buggy python submission (verdict: Runtime Error):
n = [int(input()) for i in range(3)]

if n[0] ==1:
    print('Hello World')

else:
    print(n[1]+n[2])

Fixed submission:
n = int(input())

if n ==1:
    print('Hello World')

else:
    ab = [int(input()) for i in range(2)]
    print(ab[0]+ab[1])
Buggy python submission (verdict: Time Limit Exceeded):
s = list(input().rstrip())
k = int(input())
ans_list = []

for i in range(len(s)):
    for j in range(i,len(s)+1):
        a = s[i:j]
        a = "".join(a)
        ans_list.append(a)
        
ans_list = list(set(ans_list))
ans_list.sort()

print(ans_list[k])


Fixed submission:
s = list(input().rstrip())
k = int(input())
ans_list = []

for i in range(len(s)):
    for j in range(i,len(s)+1):
        a = s[i:j]
        if len(a) > k:
            break
        a = "".join(a)
        ans_list.append(a)
        
ans_list = list(set(ans_list))
ans_list.sort()

print(ans_list[k])
Buggy python submission (verdict: Runtime Error):
h,w = map(int, input().split())
k = [list(input()) for i in range(h)]

ans = True
for i in range(1,h):
    for j in range(1,w):
        if k[i][j] == "#" and k[i-1][j] =="." and k[i][j-1] =="." and k[i+1][j] =="." and k[i][j+1] =="." :
            ans = True

if ans:
    print('Yes')

else:
    print('No')

Fixed submission:
h,w = map(int, input().split())
k = [list(input()) for i in range(h)]

ans = True
for i in range(1,h-2):
    for j in range(1,w-2):
        if k[i][j] == "#" and k[i-1][j] =="." and k[i][j-1] =="." and k[i+1][j] =="." and k[i][j+1] =="." :
            ans = False

if ans:
    print('Yes')

else:
    print('No')

Buggy python submission (verdict: Runtime Error):
h,w = map(int, input().split())
k = [list(input()) for i in range(h)]

ans = True
for i in range(h):
    for j in range(w):
        if k[i][j] == "#" and k[i-1][j] =="." and k[i][j-1] =="." and k[i+1][j] =="." and k[i][j+1] =="." :
            ans = True

if ans:
    print('Yes')

else:
    print('No')

Fixed submission:
h,w = map(int, input().split())
k = [list(input()) for i in range(h)]

ans = True
for i in range(1,h-2):
    for j in range(1,w-2):
        if k[i][j] == "#" and k[i-1][j] =="." and k[i][j-1] =="." and k[i+1][j] =="." and k[i][j+1] =="." :
            ans = False

if ans:
    print('Yes')

else:
    print('No')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
col = [0 for i in range(n)]
cnt = 0
for i in range(n):
    if 1 <= a[i] <=399:
        col[i] = "b"
    elif 400<= a[i]<=799:
        col[i] = "c"
    elif 800<= a[i]<=1199:
        col[i] = "d"
    elif 1200<= a[i]<=1599:
        col[i] = "e"
    elif 1600<= a[i]<=1999:
        col[i] = "f"
    elif 2000<= a[i]<=2399:
        col[i] = "g"
    elif 2400<= a[i]<=2799:
        col[i] = "h"
    elif 2800<= a[i]<=3199:
        col[i] = "j"
    else:
        col[i] = "k"
        cnt += 1
colv = list(set(col))
mn =mx = len(colv)
if "k" in colv:
        mn -=1
        mx += cnt-1
        if mn == 0:
            mn =1
        
print(str(mn)+" "+str(mx))

Fixed submission:
rgb = input().split()
ans = "".join(rgb)
ans = int(ans)
if ans%4 == 0:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
100000 1
1 100000


Fixed submission:
n, m = map(int, input().split())
l, r = 0, 100001
for i in range(m):
    x, y = map(int, input().split())
    if l <= x:
        l = x
    if r >= y:
        r = y
print(len([x for x in range(l, r+1)]))
Buggy python submission (verdict: Time Limit Exceeded):
import re


n, q = map(int, input().split())
s = input()
lis = [x.span() for x in re.finditer("AC", s)]
for i in range(q):
    l, r = map(int, input().split())
    cnt = 0
    for j in lis:
        if l-1 <= j[0] and j[1] <= r:
            cnt += 1
    print(cnt)

Fixed submission:
n, q = map(int, input().split())
s = input()
lis = [0]
cnt = 0
for i in range(1, n):
    if s[i-1:i+1] == "AC":
        cnt += 1
        lis.append(cnt)
    else:
        lis.append(cnt)
for i in range(q):
    l, r = map(int, input().split())
    print(lis[r-1] - lis[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int, input().split())
s = input()
for i in range(q):
    l, r = map(int, input().split())
    print(s[l-1:r].count("AC"))

Fixed submission:
n, q = map(int, input().split())
s = input()
lis = [0]
cnt = 0
for i in range(1, n):
    if s[i-1:i+1] == "AC":
        cnt += 1
        lis.append(cnt)
    else:
        lis.append(cnt)
for i in range(q):
    l, r = map(int, input().split())
    print(lis[r-1] - lis[l-1])
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

if aBb%2 == 0:
  print('Even')
else:
  print('Odd')


Fixed submission:
a, b = map(int, input().split())

if (a*b)%2 == 0:
  print('Even')
else:
  print('Odd')

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())

if aBb%2 == 0:
  print('even')
else:
  print('odd')

Fixed submission:
a, b = map(int, input().split())

if (a*b)%2 == 0:
  print('Even')
else:
  print('Odd')
Buggy python submission (verdict: Runtime Error):
n = int(input())
numbers = list(map(int, input().split()))
count = [0]*n

for i in range(n):
  while True:
    if numbers[i]%2 == 1:
  	  break
    numbers[i] = numbers[i]/2
    count[i] += 1
  
print(min(count))

Fixed submission:
s = input()
count = 0

for i in range(3):
  if s[i] == '1':
    count += 1
    
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
numbers = list(map(int, input().split()))
count = [0]*n

for i in range(n):
  if numbers[i]%2 == 1:
    continue
  numbers[i] = numbers[i]/2
  count[i] += 1
  
print(min(count))

Fixed submission:
s = input()
count = 0

for i in range(3):
  if s[i] == '1':
    count += 1
    
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
numbers = list(map(int, input().split()))

res = 0

for i in range(n):
  count = 0
  while True:
    if numbers[i]%2 == 1:
      break
    numbers[i] = numbers[i]/2 
    count += 1
  
  if count > res:
    res = count

print(res)

Fixed submission:
s = input()
count = 0

for i in range(3):
  if s[i] == '1':
    count += 1
    
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
numbers = list(map(int, input().split()))

res = 0

for i in range(n):
  count = 0
  while True:
    if numbers[i]%2 == 1:
      break
    else:
      count += 1
  
  if count > res:
    res = count

print(res)

Fixed submission:
s = input()
count = 0

for i in range(3):
  if s[i] == '1':
    count += 1
    
print(count)
Buggy python submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
string = ''
for i in range(N//(A+B)+A+B):
  string += 'b'*A
  string += 'r'*B
  if len(string) >= N:
    break
str2 = string[0:N]
cnt = str2.count('b')
print(cnt)

Fixed submission:
N,A,B = map(int,input().split())
syou = N//(A+B)
amari = N%(A+B)
ans = A*syou + min(A,amari)
print(ans)

Buggy python submission (verdict: Runtime Error):
N,A,B = map(int,input().split())
string = ''
for i in range(10**100):
  string += 'b'*A
  string += 'r'*B
  if len(string) >= N:
    break
str2 = string[0:N]
cnt = str2.count('b')
print(cnt)

Fixed submission:
N,A,B = map(int,input().split())
syou = N//(A+B)
amari = N%(A+B)
ans = A*syou + min(A,amari)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
slist=[]
cntlist = []
for i in range(N):
  s = input()
  if s in slist:
    cntlist[slist.index(s)] += 1
  else:
    slist.append(s)
    cntlist.append(1)
maxi = max(cntlist)
cntindex = [i for i, x in enumerate(cntlist) if x == maxi]
anslist = []
for i in cntindex:
  anslist.append(slist[i])
anslist.sort()
for ans in anslist:
  print(ans)


Fixed submission:
N = int(input())
sdic={}
for i in range(N):
  s = input()
  if s in sdic:
    sdic[s] += 1
  else:
    sdic[s] = 1
maxi = max(sdic.values())
anslist = [k for k, v in sdic.items() if v == maxi]
anslist.sort()
for ans in anslist:
  print(ans)
Buggy python submission (verdict: Runtime Error):
C = input()
alpha_list = 'abcdefghijklmnopqrstuvwxyz'
if C == alpha_list[i]:
  print(alpha_list[i+1])


Fixed submission:
C = input()
alpha_list = 'abcdefghijklmnopqrstuvwxyz'
for i in range(len(alpha_list)-1):
  if C == alpha_list[i]:
    print(alpha_list[i+1])

Buggy python submission (verdict: Runtime Error):
C = input()
alpha_list = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z]
i = alpha_list.index(C)
print(alpha_list[i+1])

Fixed submission:
C = input()
alpha_list = 'abcdefghijklmnopqrstuvwxyz'
for i in range(len(alpha_list)-1):
  if C == alpha_list[i]:
    print(alpha_list[i+1])
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
check = [0]*(N+1)
ac = 0
penalty = 0
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if check[pi] == -1:
    continue
  if si == 'WA':
    check[pi] += 1
  else:
    ac += 1
    penalty += check[pi]
    check[pi] = -1
print(ac,wa)


Fixed submission:
N,M = map(int,input().split())
check = [0]*N
ac = 0
penalty = 0
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if check[pi-1] == -1:
    continue
  if si == 'WA':
    check[pi-1] += 1
  else:
    ac += 1
    penalty += check[pi-1]
    check[pi-1] = -1
print(ac,penalty)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
check = [0]*N
ac = 0
penalty = 0
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if check[pi-1] == -1:
    continue
  if si == 'WA':
    check[pi-1] += 1
  else:
    ac += 1
    penalty += check[pi-1]
    check[pi-1] = -1
print(ac,wa)


Fixed submission:
N,M = map(int,input().split())
check = [0]*N
ac = 0
penalty = 0
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if check[pi-1] == -1:
    continue
  if si == 'WA':
    check[pi-1] += 1
  else:
    ac += 1
    penalty += check[pi-1]
    check[pi-1] = -1
print(ac,penalty)

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
penalty =0
check = [0]*N
ac = 0
wa = 0
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if check[pi] == -1:
    continue
  if si = 'WA':
    check[pi] += 1
  else:
    ac += 1
    wa += check[pi]
    check[pi] = -1
print(ac,wa)


Fixed submission:
N,M = map(int,input().split())
check = [0]*N
ac = 0
penalty = 0
for i in range(M):
  pi, si = input().split()
  pi = int(pi)
  if check[pi-1] == -1:
    continue
  if si == 'WA':
    check[pi-1] += 1
  else:
    ac += 1
    penalty += check[pi-1]
    check[pi-1] = -1
print(ac,penalty)
Buggy python submission (verdict: Runtime Error):
N,M,V,P = map(int, input().split())
A = list(map(int,input().split()))
A.sort(reverse=True)
count = 0
for i in range (N):
  if i <= P:
    count += 1
  elif A[i] + M < A[P-1]:
    continue
  else:
    sum = M*(P-1) + M*(N-(i+1)) 
    for j in range (P,i-1):
      sum += A[P-1]+M -A[j]
    if sum >= M*V:
      count +=1
print(count)

Fixed submission:
N,A,B = map(int,input().split())
if (B-A)%2 == 0:
  print((B-A)//2)
else:
  print( (B-A)//2 + 1 +min(A-1,N-B) )
Buggy python submission (verdict: Runtime Error):
N = map(int, input())
message = 'No'
for i in range(1,10):
  if N % i == 0 and N/i < 10 :
    message = 'Yes'
    break
print(message)
  
  

Fixed submission:
N = int(input())
message = 'No'
for i in range(1,10):
  if N%i==0 and N/i<10 :
    message = 'Yes'
    break
print(message)