Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline

N, X, D = map(int, input().split())

C = {}
Que = {}
for l in range(N+1):
    start = l*X//D + l*(l-1)//2
    end = start + l*(N-l)
    key = l*X%D
    if key in Que:
        Que[key].append((start, end))
        C[key] += [start, end, start+1, end+1, start-1, end-1]
    else:
        Que[key] = [(start, end)]
        C[key] = [start, end, start+1, end+1, start-1, end-1]


ans = 0
for key, List in C.items():
    ind_to_co = sorted(list(set(List)))
    co_to_ind = {a:i for i, a in enumerate(ind_to_co)}

    Imos = [0]*(len(ind_to_co)+1)
    for start, end in Que[key]:
        Imos[co_to_ind[start]] += 1
        Imos[co_to_ind[end+1]] -= 1

    for i in range(len(ind_to_co)-1):
        a = ind_to_co[i]; b = ind_to_co[i+1]
        Imos[i+1] += Imos[i]
        if Imos[i+1] > 0 and Imos[i] > 0:
            ans += b-a
        elif Imos[i] > 0:
            ans += 1
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, X, D = map(int, input().split())

if D == 0:
    ans = N+1 if X != 0 else 1
else:
    C = {}
    Que = {}
    for l in range(N+1):
        start = l*X//D + l*(l-1)//2
        end = start + l*(N-l)
        key = l*X%D
        if key in Que:
            Que[key].append((start, end))
            C[key] += [start, end, start+1, end+1, start-1, end-1]
        else:
            Que[key] = [(start, end)]
            C[key] = [start, end, start+1, end+1, start-1, end-1]


    ans = 0
    for key, List in C.items():
        ind_to_co = sorted(list(set(List)))
        co_to_ind = {a:i for i, a in enumerate(ind_to_co)}

        Imos = [0]*(len(ind_to_co)+1)
        for start, end in Que[key]:
            Imos[co_to_ind[start]] += 1
            Imos[co_to_ind[end+1]] -= 1

        for i in range(len(ind_to_co)-1):
            a = ind_to_co[i]; b = ind_to_co[i+1]
            Imos[i+1] += Imos[i]
            if Imos[i+1] > 0 and Imos[i] > 0:
                ans += b-a
            elif Imos[i] > 0:
                ans += 1
print(ans)
r D x = map(int, input.split())
for i in range(10):
  x = r * x - D
  print(x)

### FIXED CODE ###

r, D, x = map(int, input().split())
for i in range(10):
  x = r * x - D
  print(x)
A = list(input())
N, ans = len(A), 0

for i in range(1, N-1):
    j = 1
    while i-j >= 0 and i+j-1 < N:
        if A[i-j] == A[i+j-1]:
            ans += 1
        j += 1

    j = 1
    while i-j >= 0 and i+j < N:
        if A[i-j] == A[i+j]:
            ans += 1
        j += 1

if A[-1] == A[-2]:
    ans += 1

print(N*(N-1)//2 + 1 - ans)

### FIXED CODE ###

import collections

A = list(input())
N, ans = len(A), 0

c = collections.Counter(A)
for x in list(c.keys()):
    ans += c[x] * (c[x] - 1) // 2

print(N*(N-1)//2 + 1 - ans)
a,b,c = map(int, input().split().sort())
n=sorted([a,b,c])
print "{0} {1} {2}".format.(n[0],n[1],n[2])

### FIXED CODE ###

n = list(map(int, input().split()))
n.sort()
print (n[0],n[1],n[2])
a=[0]*4
for i in range(4):
  a[i]=int(input())
print(min(a[2])+min(a[2:4]))

### FIXED CODE ###

a=[0]*4
for i in range(4):
  a[i]=int(input())
print(min(a[:2]) + min(a[2:4]))
def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1
d=[]
n=10**5+1
for i in range(2,n):
    if prime_t(i):
        d.append(i)
 
q=int(input())
for i in range(q):
    ans=0
    l,r=map(int,input().split())
    for j in range(l,r+1,2):
        if (j in d and (j+1)//2 in d): ans+=1
    print(ans)
def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1
d=[]
n=10**5+1
for i in range(2,n):
    if prime_t(i):
        d.append(i)

q=int(input())
for i in range(q):
    ans=0
    l,r=map(int,input().split())
    for j in range(l,r+1,2):
        if (j in d and (j+1)//2 in d): ans+=1
    print(ans)


### FIXED CODE ###

def prime_t(t):
    i=2
    while i**2<=t:
        if t%i==0:
            return 0
        i+=1
    return 1
d=set([])
n=10**5+1
p=[0]*(10**5+1)
for i in range(2,n):
    if prime_t(i):
        d.add(i)
    if (i in d and (i+1)//2 in d): p[i]=p[i-1]+1
    else: p[i]=p[i-1]

q=int(input())
for i in range(q):
    ans=0
    l,r=map(int,input().split())
    print(p[r]-p[l-1])
h,w = map(int,input().split(" "))
s = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
    tmp = list(input())
    for j in range(w):
        s[i][j] = tmp[j]
def search(array,x,y,i,j):
            if i>=0 and i<=x-1 and j>=0 and j<=y-1 and array[i][j] != "#":
                return 1+search2(array,x,y,i-1,j)+search3(array,x,y,i+1,j)+search4(array,x,y,i,j+1)+search5(array,x,y,i,j-1)
            else:
                return 0
def search2(array,x,y,i,j):
            if i>=0 and i<=x-1 and j>=0 and j<=y-1 and array[i][j] != "#":
                return 1+search2(array,x,y,i-1,j)
            else:
                return 0

def search3(array,x,y,i,j):
            if i>=0 and i<=x-1 and j>=0 and j<=y-1 and array[i][j] != "#":
                return 1+search3(array,x,y,i+1,j)
            else:
                return 0

def search4(array,x,y,i,j):
            if i>=0 and i<=x-1 and j>=0 and j<=y-1 and array[i][j] != "#":
                return 1+search4(array,x,y,i,j+1)
            else:
                return 0

def search5(array,x,y,i,j):
            if i>=0 and i<=x-1 and j>=0 and j<=y-1 and array[i][j] != "#":
                return 1+search5(array,x,y,i,j-1)
            else:
                return 0

            



max = 1
for i in range(h):
    for j in range(w):
        a = search(s,h,w,i,j)
        if max<a: 
            max= a
print(max)

### FIXED CODE ###

h,w = map(int,input().split(" "))
s = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
    tmp = list(input())
    for j in range(w):
        s[i][j] = tmp[j]

dp1= []
dp2= [[-1 for i in range(w)] for j in range(h)]
dp3=[]
dp4=[[-1 for i in range(w)] for j in range(h)]


for i in range(h):
    dp1.append([])
    dp3.append([])
    for j in range(w):
        dp1[i].append(-1)
        dp3[i].append(-1)

        if s[i][j] == "#":
            dp1[i][j] = 0
        elif j == 0:
            dp1[i][j] = 1
        else:
            dp1[i][j] = 1 + dp1[i][j-1]

        if s[i][w-j-1] == "#":
            dp2[i][w-j-1] = 0
        elif w-j-1 == w-1:
            dp2[i][w-j-1] = 1
        else:
            dp2[i][w-j-1] = 1 + dp2[i][w-j]

        if s[i][j] == "#":
            dp3[i][j] = 0
        elif i == 0:
            dp3[i][j] = 1
        else:
            dp3[i][j] = 1 + dp3[i-1][j]

        if s[h-i-1][j] == "#":
            dp4[h-i-1][j] = 0
        elif h-i-1 == h-1:
            dp4[h-i-1][j] = 1
        else:
            dp4[h-i-1][j] = 1 + dp4[h-i][j]



        

a = 1
for i in range(h):
    for j in range(w):
        a = max(a,dp1[i][j]+dp2[i][j]+dp3[i][j]+dp4[i][j]-3)


print(a)
W, H, N = list(map(int, input().split()))

min_x = 0
min_y = 0
max_x = W
max_y = H

for i in range(N):
    x, y, a = list(map(int, input().split()))
    if a == 1:
        min_x = max(min_x, x)
    if a == 2:
        max_x = min(max_x, x)
    if a == 3:
        min_y = max(min_y, y)
    if a == 4:
        max_y = min(max_y, y)

print(max(0, (max_x - min_x)) * max(0, (max_y - min_y)))

### FIXED CODE ###

L = list(map(int, input().split()))
max_index = L.index(max(L))

X = 0
S = 0

for i in range(3):
    if i == max_index:
        X = L[i]
    else:
        S += L[i]

if X == S:
    print("Yes")
else:
    print("No")
N,M = map(int,input().split())
 
m = []
for i in range(M):
    m.append(list(map(int,input().split())))
for i in range(10**N):
    a = str(i)
    
    if i >= 10**(N-1):
            
        for j in range(M):
            try:
                
                if a[m[j][0]-1] == str(m[j][1]):
                    True
                
                else:
                    break
            except:
                break
                
            if j == M-1:
                print(i)
                exit()
                
if M==0:
    if N == 1:
        print(0)
    else:
        print(10**(N-1))
        
if M==1:
    if N == 1:
        if m == [[1,0]]
            print(0)
            exit()
        
else :
    print(-1)

### FIXED CODE ###

N,M = map(int,input().split())
 
m = []
for i in range(M):
    m.append(list(map(int,input().split())))
for i in range(10**N):
    a = str(i)
    
    if i >= 10**(N-1):
            
        for j in range(M):
            try:
                
                if a[m[j][0]-1] == str(m[j][1]):
                    True
                
                else:
                    break
            except:
                break
                
            if j == M-1:
                print(i)
                exit()
                
if M==0:
    if N == 1:
        print(0)
        
    else:
        print(10**(N-1))
        
    exit()

elif M==1:
    if N == 1:
        m == [[1,0]]
        print(0)
        exit()


print(-1)
a,b=input().split()
if c<d:
  print("<")
elif c==d:
  print("=")
else c>d:
  print(">")


### FIXED CODE ###

a,b=input().split()
if (a<b):
  print("<")
elif (a==b):
  print("=")
else :
  print(">")
while 1:
   x, y = map(int, raw_input().split())
   if x <= y:
      print (x y)
      if x == y == 0:
         break
   if y < x:
      print (y x)
   
   

### FIXED CODE ###

while 1:
   x, y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   elif x > y:
      print '%s %s' % (y,x)
   else:
      print '%s %s' % (x,y)
def n_ary_notation(N, n):
  if N == 0:
    return '0'
  else:
    s = ''
    while N:
      s = str(N % abs(n)) + s
      N -= N % abs(n)
      N //= n
    return s
strL = input()
N = 21
M = 61
K = 2
l = int(strL) - 1
while True:
  K += 1
  L = n_ary_notation(l, K)
  N = len(L) * 2
  M = K * (len(L) - 1)
  for l in L:
    M += int(l) + 1
  if N < 21 and M < 61:
    break
print(N, M)
for i, l in enumerate(L[:-1]):
  k = len(L) - 1 - i
  print(2 * i + 1, 2 * i + 3, int(l) * K ** k)
  for j in range(int(l)):
    print(2 * i + 1, 2 * i + 2, j * K ** k)
for i in range(int(L[-1]) + 1):
  print(2 * len(L) - 1, 2 * len(L), i)
for k in range(len(L) - 1):
  s = 2 * (len(L) - k)
  for i in range(K):
    print(2 * (len(L) - k - 1), 2 * (len(L) - k), i * K ** k)

### FIXED CODE ###

L = int(input())
R = 0
while True:
  R += 1
  if 2 ** R > L:
    R -= 1
    break
N = R + 1
M = 2 * R
_L = L
for r in range(R, 0, -1):
  if _L - 2 ** (r - 1) >= 2 ** R:
    M += 1
    _L -= 2 ** (r - 1)
print(N, M)
for i in range(R):
  print(i + 1, i + 2, 2 ** i)
  print(i + 1, i + 2, 0)
for r in range(R, 0, -1):
  if L - 2 ** (r - 1) >= 2 ** R:
    print(r, N, L - 2 ** (r - 1))
    L -= 2 ** (r - 1)
from scipy.misc import comb
# a = comb(n, r)
#a = comb(n, r, exact=True)

N,K= map(int,input().split())
mod = 10**9+7
#def comb(n, k):
#    m = 1
#    if n< k:
#        m= 0
#    if n < 2 * k:
#        k = n - k
#    for i in range(1, k + 1):
#        m = m * (n - i + 1) / i  %mod  
#    return int(m)
#print(comb(1,2))
R = N-K


for i in range(1,K+1):
    # blue
#    if i == 1:
#        b_div = 2
#    else:
#    print(R,i)
    b_div = comb(K-1,i-1)%mod
    # RED
#    if (R+1)<i:
#        print('0')
#    else:
    r_div = comb(R+1,i)%mod
#        if i == K+1:
#            r_div += comb(R+1,i+1)%mod
        
#        print(b_div,r_div)
    print(int(b_div*r_div)%mod)

### FIXED CODE ###




N,K= map(int,input().split())
mod = 10**9+7
def comb(n,k):
  """power_funcを用いて(nCk) mod p を求める"""
  p = 10**9+7
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p
R = N-K


for i in range(1,K+1):
    # blue
#    if i == 1:
#        b_div = 2
#    else:
#    print(R,i)
    b_div = comb(K-1,i-1)%mod
    # RED
#    if (R+1)<i:
#        print('0')
#    else:
    r_div = comb(R+1,i)%mod
#        if i == K+1:
#            r_div += comb(R+1,i+1)%mod
        
#        print(b_div,r_div)
    print(int(b_div*r_div)%mod)
import numpy as np
h, w = list(map(int, input().split()))
grid = []
for i in range(h):
    temp = list(input())
    if "#" in temp:
        grid.append(temp)
    else:
        h -= 1
i = 0
while i < len(grid[0]):
    for j in range(h):
        if grid[j][i] == "#":
            i += 1
            break
        if j == h - 1:
            for k in range(h):
                del grid[k][i]
for i in range(len(grid[0])):
    print("".join(grid[i]))

### FIXED CODE ###

h, w = list(map(int, input().split()))
grid = []
for i in range(h):
    temp = list(input())
    if "#" in temp:
        grid.append(temp)
    else:
        h -= 1
i = 0
while i < len(grid[0]):
    for j in range(h):
        if grid[j][i] == "#":
            i += 1
            break
        if j == h - 1:
            for k in range(h):
                del grid[k][i]
for i in range(h):
    print("".join(grid[i]))
a, b = map(int, input())
if a == 1:
  a = 14
if b == 1:
  b = 14
if a > b:
  print('Alice')
elif a == b:
  print('Draw')
else:
  print('Bob')

### FIXED CODE ###

a, b = map(int, input().split())
if a == 1:
  a = 14
if b == 1:
  b = 14
if a > b:
  print('Alice')
elif a == b:
  print('Draw')
else:
  print('Bob')
n = int(input)
print((n//2)+(n%2))

### FIXED CODE ###

N = int(input())
A = N + 1

if N % 2 == 0:
  print(N // 2)
else:
  print(A // 2)
#!/usr/bin/env python3
import sys

from scipy.special import comb

sys.setrecursionlimit(10 ** 7)

MOD = 1000000007  # type: int

def solve(N: int, K: int):
    choices = N - K + 1
    for i in range(K):
        print(int(comb(choices, i + 1) * comb(K - 1, i)) % MOD)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import math
import sys
from functools import lru_cache

sys.setrecursionlimit(10 ** 7)

MOD = 1000000007  # type: int


@lru_cache(10000)
def combinations_count(n, r):
    if n - r < 0:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def solve(N: int, K: int):
    choices = N - K + 1
    for i in range(K):
        print(int(combinations_count(choices, i + 1) * combinations_count(K - 1, i)) % MOD)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()
n = int(input())
p = [input() for i in range(n)]

c = collections.Counter(p)
m = c.most_common()
most = m[0][1]

answer = []

answer.append(m[0][0])

for i in range(len(m)-1):
    if m[i+1][1] == most:
        answer.append(m[i+1][0])
    else:
        break

for output in sorted(answer):
    print(output)

### FIXED CODE ###

import collections

def main():
    n = int(input())
    p = [input() for i in range(n)]

    c = collections.Counter(p)
    m = c.most_common()
    most = m[0][1]

    answer = []

    answer.append(m[0][0])

    for i in range(len(m)-1):
        if m[i+1][1] == most:
            answer.append(m[i+1][0])
        else:
            break

    for output in sorted(answer):
        print(output)
    return


main()
N = int(input())
W = [list(input()) for _ in range(N)]
ans = 'Yes'
W_set = set(W)
if len(W) == len(W_set):
  for i in range(1, N - 1):
    if W[i][0] != W[i-1][-1]:
      ans = 'No'
      break
else:
  ans = 'No'
print(ans)

### FIXED CODE ###

N = int(input())
W = [input() for _ in range(N)]
ans = 'Yes'
W_set = set(W)
if len(W) == len(W_set):
  for i in range(1, N):
    if W[i][0] != W[i-1][-1]:
      ans = 'No'
      break
else:
  ans = 'No'
print(ans)
S=input()
K=int(input())

i=1
count=0
N=len(S)
while i<N:
    if S[i]==S[i-1]:
        count+=1
        if i==N-1:
            S+='A'
        i+=1
    i+=1

if S[0]==S[-1]:
    if S[0]==S[1]:
        print(count*K--(K-1)//2)
    else:
        print(count*K+(K-1))
else:
    print(count*K)

### FIXED CODE ###

S=input()
K=int(input())

i=1
count1=0
while i<len(S):
    if S[i]==S[i-1]:
        count1+=1
        i+=1
    i+=1

ss=S*2
i=1
count2=0
while i<len(ss):
    if ss[i]==ss[i-1]:
        count2+=1
        i+=1
    i+=1

if 2*count1+1==count2 and len(set(S))!=1:
    print(K*count1+(K-1))
else:
    print(K*count2//2)
n = int(input())
A = int(input())
B = int(input())

if n == 1:
    print("Hello World")
if n == 2:
    print(A + B)


### FIXED CODE ###

n = int(input())

if n == 1:
    print("Hello World")
if n == 2:
    a = int(input())
    b = int(input())
    print(a + b)
h,w,m=map(int,input().split())
hlist=[0]*(h+1)
wlist=[0]*(w+1)

cnt=[[False]*(w+1) for i in range(h+1)]
for i in range(m):
  a,b=map(int,input().split())
  hlist[a]+=1
  wlist[b]+=1
  cnt[a][b]=True
  
hcnt,wcnt=0,0
for i in range(1,h+1):
  hcnt=max(hcnt,hlist[i])
  
for i in range(1,w+1):
  wcnt=max(wcnt,wlist[i])

hh,ww=[],[]

for i in range(1,h+1):
  if hlist[i]==hcnt:
    hh+=[i]

for i in range(1,h+1):
  if wlist[i]==wcnt:
    ww+=[i]

ans=0

for i in hh:
  for j in ww:
    if cnt[i][j]==False:
      print(hcnt+wcnt)
      exit()
  
print(hcnt+wcnt-1)

### FIXED CODE ###

h,w,m=map(int,input().split())
hlist=[0]*(h+1)
wlist=[0]*(w+1)
cnt=set()


for i in range(m):
  a,b=map(int,input().split())
  hlist[a]+=1
  wlist[b]+=1
  cnt.add((a,b))


hcnt,wcnt=max(hlist),max(wlist)


hhh=[i for i,v in enumerate(hlist) if v==hcnt]
www=[i for i,v in enumerate(wlist) if v==wcnt]


for i in hhh:
  for j in www:
    if not (i,j) in cnt:
      print(hcnt+wcnt)
      exit()


print(hcnt+wcnt-1)
N = int(input())
S = soted([int(input()) for _ in range(N)])

m = 0
for s in S:
  if s % 10 != 0 and m == 0:
    m = s
    break
ans = sum(S)
if ans % 10 != 0:
  print(ans)
elif m != 0:
  print(ans-m)
else:
  print(0)

### FIXED CODE ###

N = int(input())
S = sorted([int(input()) for _ in range(N)])
 
m = 0
for s in S:
  if s % 10 != 0 and m == 0:
    m = s
    break
ans = sum(S)
if ans % 10 != 0:
  print(ans)
elif m != 0:
  print(ans-m)
else:
  print(0)
int x,y ;
x=input();
y=x^3 ;
print y ;

### FIXED CODE ###

x=input();
y=x*x*x ;
print y ;
a,b,c=int(input().split())
print(min(a*n,b))

### FIXED CODE ###

n,a,b=map(int,input().split())
print(min(b,a*n))
r = int(input())
g = int(input())
b = int(input())

total = 100*r + 10*g + b

if total % 4 == 0:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

r,g,b=map(int, input().split())

A = 10*g + b

if A % 4 == 0:
    print("YES")
else:
    print("NO")
from collections import deque

N, K = map(int, input().split())
A = list(map(int, input().split()))
mod = pow(10,9)+7

A.sort(reverse=True)

deque = deque()
for a in A:
    deque.append(a)

ans = 1
cnt = 0
if K%2 == 1:
    ans *= deque.popleft()
    cnt += 1
    
if ans <= 0:
    for i in range(K-1):
        ans *= deque.popleft()
        ans %= mod
else:
    while cnt < K:
        x1 = deque.popleft()
        x2 = deque.popleft()
        deque.appendleft(x2)
        deque.appendleft(x1)
        y1 = deque.pop()
        y2 = deque.pop()
        if x1*x2 < y1*y2:
            ans *= y1*y2
            ans %= mod
            cnt += 2
        else:
            ans *= x1*x2
            ans %= mod
            x1 = deque.popleft()
            x2 = deque.popleft()
            deque.append(y2)
            deque.append(y1)
            cnt += 2
            
print(ans)

### FIXED CODE ###

from collections import deque

N, K = map(int, input().split())
A = list(map(int, input().split()))
mod = pow(10,9)+7

A.sort(reverse=True)

deque = deque()
for a in A:
    deque.append(a)

ans = 1
cnt = 0
if K%2 == 1:
    ans *= deque.popleft()
    cnt += 1
    
if ans <= 0:
    for i in range(K-1):
        ans *= deque.popleft()
        ans %= mod
else:
    while cnt < K:
        x1 = deque.popleft()
        x2 = deque.popleft()
        deque.appendleft(x2)
        deque.appendleft(x1)
        y1 = deque.pop()
        y2 = deque.pop()
        if x1*x2 < y1*y2:
            ans *= y1*y2
            ans %= mod
            cnt += 2
        else:
            ans *= x1*x2
            ans %= mod
            if deque:
                x1 = deque.popleft()
            if deque:
                x2 = deque.popleft()
            deque.append(y2)
            deque.append(y1)
            cnt += 2
            
print(ans)
def isDivBy9(n): 
    if (n == 0 or n == 9): 
        return True
    if (n < 9): 
        return False

    # If n is greater than 9, 
    # then recur for [floor(n / 9) - n % 8] 
    return isDivBy9((int)(n>>3) - (int)(n&7)) 

N = int(input())

if(isDivBy9(N)):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

def check(st) : 
  
    # Compute sum of digits 
    n = len(st) 
    digitSum = 0
      
    for i in range(0,n) : 
        digitSum = digitSum + (int)(st[i]) 
  
    # Check if sum of digits 
    # is divisible by 9. 
    return (digitSum % 9 == 0) 
  
# Driver code 
x = input()
st= str(x)
  
if(check(st)) : 
    print("Yes") 
else :  
    print("No")
l = [input() for i in range(n)]
l.sort()
i = 0
count = 1
ans = []
max = 1
while i < n-1:
  if l[i] == l[i+1]:
    count += 1
    i += 1
    if count >= max:
      max = count
    if i == n-1:
      ans.append([l[n-1], count])

  else:
      ans.append([l[i],count])
      count = 1
      i += 1

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





### FIXED CODE ###

n = int(input())
l = [str(input()) for i in range(n)]
l.sort()
i = 0
count = 1
ans = []
max = 1
while i < n-1:
  if l[i] == l[i+1]:
    count += 1
    i += 1
    if count >= max:
      max = count
    if i == n-1:
      ans.append([l[n-1], count])

  else:
      ans.append([l[i],count])
      count = 1
      i += 1

if max == 1:
  ans.append([l[n-1], 1])
      
for i in ans:
  if i[1] == max:
    print(i[0])