Harryxun/stf_run huggingface dataset:
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

li = list(map(int, input().split()))
n = li[0]
m = li[1]

print(combinations_count(m, 2)+combinations_count(n, 2))


### FIXED CODE ###

import math


def combinations_count(n, r):
    try:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    except ValueError:
        return 0
    

li = list(map(int, input().split()))
n = li[0]
m = li[1]

print(combinations_count(m, 2)+combinations_count(n, 2))
N = list(map(int, input().split()))
if (N[0]+N[1])%2==0:
    print((N[0]+N[1])//2)
else:
    print(()(N[0]+N[1])//2)+1)


### FIXED CODE ###

N = list(map(int, input().split()))
d = N[0]+N[1]
if d%2==0:
    print(d//2)
else:
    print(d//2+1)
n, k = map(int,input().split())
p = list(map(int,input().split()))

ans = 0
for i in range(n-k+1):
    e = 0
    for j in range(0,k):
        e += (0.5*(p[i+j]+1))
    ans = max(ans,e)
print(ans)


### FIXED CODE ###

s, t = map(str,input().split())
a, b = map(int,input().split())
u = str(input())

if u == s:
    print(a-1,b)
else:
    print(a,b-1)
t = list(input())
n = len(t)
if n == 1:
  if t == '?':
    t = 'D'
elif n == 2:
  if t != 'PD' or t != 'DP':
    if t == '??':
      t = 'PD'
    else:
      for i in range(2):
        if t[i] == '?':
          t[i] = 'D'
  else:
    t = 'PD'
else:
  for i in range(n):
    if t[i] != '?':
      continue
    else:
      # if i == 0:
      #   if t[i+1] != 'P':
      #     t[i] = 'D'
      #     continue
      #   else:
      #     t[i] = 'P'
      #     continue
      # else:
      #   t[i] = 'D'
      t[i] = 'D'

if t = 'D'*n:
  t = 'P' + 'D'*n
print(''.join(t))


### FIXED CODE ###

t = list(input())
n = len(t)
for i in range(n):
  if t[i] == '?':
    t[i] = 'D'
print(''.join(t))
S = input()
print("Yes" if S[4] == S[5] and S[6] == S[7] else "No")

### FIXED CODE ###

S = input()
print("Yes" if S[2] == S[3] and S[4] == S[5] else "No")
import math
from functools import reduce

def lcm(a, b):
    return (a * b) // math.gcd(a,  b)

def lcm_list(li):
    return reduce(lcm, li, 1)

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


i = lcm_list(a) -1
print(sum([i%j for j in a]))


### FIXED CODE ###

import sys
sys.setrecursionlimit(30000)

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm(a, b):
    return (a * b) // gcd(a, b)

def lcm_list(li):
    if len(li) == 2:
        return lcm(li[0], li[1])

    else:
        li = [lcm(li[0], li[1])] + li[2:]
        return lcm_list(li)

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


i = max(lcm_list(a) - 1, 1)
print(sum([i % j for j in a]))
l=input()
for i in range(len(l)):
    if l[i]==l[i+1]:
        print('Bad')
        break
else:
    print('Good')

### FIXED CODE ###

l=input()
for i in range(len(l)-1):
    if l[i]==l[i+1]:
        print('Bad')
        break
else:
    print('Good')
O=input()
E=input()
for i in range (len(O)):
    s+=O[i]+E[i]
print(s)


### FIXED CODE ###

O=input()
E=input()
s=''
if len(O)==len(E):
    for i in range (len(O)):
        s+=O[i]+E[i]
else:
    for i in range (len(O)-1):
        s+=O[i]+E[i]
    s+=O[-1]
print(s)
in=input()
print("ABC{}".format(in))

### FIXED CODE ###

x=input("")
print("ABC{}".format(x))
N=int(input())
A=list(map(int,input().split()))
from collections import Counter
two=0
a=Counter(A)
for k,v in a.items():
  if v==2:
    two=k
LR=[]
for i in range(N+1):
  if A[i]==two:
    LR.append(i)
L=LR[0]
R=LR[1]
mod=10**9+7
P=[1 for i in range(10**6+1)]
for i in range(10**6):
  P[i+1]=P[i]*(i+1)%mod
L+=1
R+=1
def comb(a,b):
  if a>=b:
    return P[a]*pow(P[a-b],mod-2,mod)*pow(P[b],mod-2,mod)%mod
  else:
    return 0

for i in range(1,N+2):
  print((comb(N+1,i)-comb(N+L-R,i-1))%mo

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
from collections import Counter
two=0
a=Counter(A)
for k,v in a.items():
  if v==2:
    two=k
LR=[]
for i in range(N+1):
  if A[i]==two:
    LR.append(i)
L=LR[0]
R=LR[1]
mod=10**9+7
P=[1 for i in range(10**6+1)]
for i in range(10**6):
  P[i+1]=P[i]*(i+1)%mod
L+=1
R+=1
def comb(a,b):
  if a>=b:
    return P[a]*pow(P[a-b],mod-2,mod)*pow(P[b],mod-2,mod)%mod
  else:
    return 0

for i in range(1,N+2):
  print((comb(N+1,i)-comb(N+L-R,i-1))%mod)
from collections import Counter

n = int(input())
v = list(map(int, input().split()))
cnt_o = Counter(v[::2]).most_common(2)
cnt_e = Counter(v[1::2]).most_common(2)

mo = cnt_o[0][0]
me = cnt_e[0][0]
if mo == me:
    print(n - cnt_o[0][1] - cnt_e[0][1])
else:
    del1 = cnt_o[0][1] - cnt_o[1][1]
    del2 = cnt_e[0][1] - cnt_e[1][1]
    print(n - cnt_o[0][1] - cnt_e[0][1] + min(del1, del2))

### FIXED CODE ###

n = int(input())
v = list(map(int, input().split()))

app = {}
for i, j in zip(v[::2], v[1::2]):
    if i not in app:
        app[i] = [1, 0]
    else:
        app[i][0] += 1
    if j not in app:
        app[j] = [0, 1]
    else:
        app[j][1] += 1

max_o = [0, 0]
secmax_o = [0, 0]
max_e = [0, 0]
secmax_e = [0, 0]
for i in app:
    if app[i][0] > max_o[1]:
        secmax_o = max_o[:]
        max_o = [i, app[i][0]]
    elif app[i][0] > secmax_o[1]:
        secmax_o = [i, app[i][0]]
    if app[i][1] > max_e[1]:
        secmax_e = max_e[:]
        max_e = [i, app[i][1]]
    elif app[i][1] > secmax_e[1]:
        secmax_e = [i, app[i][1]]

if max_o[0] != max_e[0]:
    print(n - max_o[1] - max_e[1])
else:
    del0 = max_o[1] - secmax_o[1]
    del1 = max_e[1] - secmax_e[1]
    print(n + min(del0, del1) - max_o[1] - max_e[1])
# -*- coding: utf-8 -*-

"""
計算式は以下のように示される
C_n = (1/n)*(1+C_(n-1)) + ((n-1)/n)*C_(n-1)  =  C_(n-1)+(1/n)
"""

import math,sys
sys.setrecursionlimit(10000)
N = int(input())
X = list(map(int, input().split()))

def calc(n):
    if n==1:
        return 1.0
    return calc(n-1)+(1.0/n)

ev = sum( list( map(lambda i: ((X[i]-X[i-1])*calc(i)), list(range(1,N)) )))

print(int(ev*math.factorial(N-1)%(10**9+7)))
#%(10**9+7)

### FIXED CODE ###

# -*- coding: utf-8 -*-

mod = 10**9 +7
N = int(input())
X = list(map(int, input().split()))

factorial=[1]
for i in range(1,N):
    factorial.append(factorial[-1] *i %mod)

ans=0
for i in range(1,N):
    ans = (ans*i + (X[-1]-X[i-1])*factorial[i-1]) %mod

print(ans)
def main():
    N, K = map(int, input().split())
    res = K * (K -1)**(N-1)

    print(res)

if __name__ == "__main__":
    main()

### FIXED CODE ###



def main():
    # 状態がループする
    A, B, C = map(int, input().split())
    flag = False
    for i in range(1, B+1):
        if i * A % B == C:
            flag = True
    if flag:print("YES")
    else:print("NO")


if __name__ == "__main__":
    main()
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
c = [1] * N
s = [C[P[i]-1] for i in range(N)]
m = [[0] * (N+1) for i in range(N)]
for i in range(N):
    m[i][1] = (C[P[i]-1])
for i in range(N):
    j = i
    while P[j]-1 != i:
        j = P[j]-1
        c[i] += 1
        s[i] += C[P[j]-1]
        if  c[i] <= K:
            if s[i] > m[i][c[i]-1]:
                m[i][c[i]] = s[i]
            else:
                m[i][c[i]] = m[i][c[i]-1]
print(c)
print(s)
print(m)
ans = min(C)
for i in range(N):
    if s[i] > 0:
        if  s[i] * (K//c[i]) + m[i][K%c[i]] > ans:
            ans = s[i] * (K//c[i]) + m[i][K%c[i]]
    else:
        if max(m[i][1:c[i]]) > ans:
            ans = max(m[i][1:c[i]])
print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
P, C = [list(map(int, input().split())) for _ in range(2)]
c = [1] * N
m = [[0] * (N+1) for i in range(N)]
for i in range(N):
    m[i][1] = (C[P[i]-1])
ans = max(C)
for i in range(N):
    j = i
    while P[j]-1 != i:
        j = P[j]-1
        c[i] += 1
        m[i][c[i]] = m[i][c[i]-1] + C[P[j]-1]
    if m[i][c[i]] > 0:
        ans = max(ans, m[i][c[i]] * (K//c[i]-1) + max(m[i] + [m[i][c[i]] + m[i][j+1] for j in range(K%c[i])]))
    else:
        ans = max(ans, max(m[i][1:min(c[i],K)+1]))
print(ans)
x = list(int(input())
for i in range(len(x)):
    for a in x:
        if x == 0:
            break
print("Case {0}: {1}".format(i,a))

### FIXED CODE ###

import sys
a = 1

for i in sys.stdin:
        x = i.strip()
        if x == "0":
                break;
        print("Case {0}: {1}".format(a,x))
        a += 1
x, y = map(int, input().split())
x = str(x)
print(int(x, y))

### FIXED CODE ###

n, k = map(int, input().split())
def digits(N, K):
    if (int(N/K)):
        return digits(int(N/K), K) + str(N%K)
    return str(N%K)
print(len(digits(n, k)))
import math

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

x = [X] + list(map(int, input().split()))
x.sort()

dic = []

for i in range(1, len(x)):
    tmp = x[i] - x[i - 1]
    if tmp not in dic:
        dic.append(tmp)

dic.sort()
ans = dic[0]

for i in range(1, len(dic)):
    ans = min(ans, math.gcd(dic[i], dic[i - 1]))

print(ans)

### FIXED CODE ###

import fractions

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

x = [X] + list(map(int, input().split()))
x.sort()

dic = []

for i in range(len(x) - 1):
    tmp = x[i + 1] - x[i]
    if tmp not in dic:
        dic.append(tmp)

ans = max(dic)

for i in range(len(dic) - 1):
    ans = min(ans, fractions.gcd(dic[i], dic[i + 1]))

print(ans)
s = input()
t = input()
if len(s)+1 = len(t):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

s = input()
t = input()
if len(s)+1 == len(t) and s == t[:-1]:
  print("Yes")
else:
  print("No")
def university(xxx, pattern):
    tate = 0
    yoko = 1
    for current_tate in range(8-xxx[tate]+1):
        for current_yoko in range(8-xxx[yoko]+1):
            if absolutely_fantastic(current_tate, current_yoko):
                return True

def absolutely_fantastic(current_tate, current_yoko):
    tate = 0
    yoko = 1
    run = []
    for add_tate in range(xxx[tate]):
        for add_yoko in range(xxx[yoko]):
            run.append(mapppp[current_tate+add_tate][current_yoko+add_yoko])
    if run == pattern:
        print xxx[2]
        return True

A = {(2,2,'A'):[1,1,1,1]}
B = {(4,1,'B'):[1,1,1,1]}
C = {(1,4,'C'):[1,1,1,1]}
D = {(3,2,'D'):[0,1,1,1,1,0]}
E = {(2,3,'E'):[1,1,0,0,1,1]}
F = {(3,2,'F'):[1,0,1,1,0,1]}
G = {(2,3,'G'):[0,1,1,1,1,0]}
lis = [A,B,C,D,E,F,G]
mapppp = []
while True:
    input_line = raw_input()
    if input_line:
        yoko = [int(char) for char in input_line]
        mapppp.append(yoko)
    else:
        for XXX in lis:
            flag = False
            for xxx, pattern in XXX.items():
                if university(xxx, pattern):
                    flag = True
                    break
            if flag == True:
                break

### FIXED CODE ###

# -*- coding: utf-8 -*-
figures = {
    'A': [['1', '1'], ['1', '1']],
    'B': [['1'], ['1'], ['1'], ['1']],
    'C': [['1', '1', '1', '1']],
    'D': [['0', '1'], ['1', '1'], ['1', '0']],
    'E': [['1', '1', '0'], ['0', '1', '1']],
    'F': [['1', '0'], ['1', '1'], ['0', '1']],
    'G': [['0', '1', '1'], ['1', '1', '0']],
}


def f1(lines):
    for n, figure in figures.items():
        found = f2(lines, figure)
        if found:
            print(n)
            break


def f2(lines, figure):
    height = len(figure)
    width = len(figure[0])
    for h in range(8 - height + 1):
        for w in range(8 - width + 1):
            found = f3(lines, figure, height, width, h, w)
            if found:
                return True


def f3(lines, figure, height, width, h, w):
    _figure = [[lines[h+_h][w+_w] for _w in range(width)]
               for _h in range(height)]
    if figure == _figure:
        return True


try:
    while True:
        f1([list(input()) for _ in range(8)])
        input()
except EOFError:
    pass
m=0
if m==0:
  while  n==0:
    u=e**5-w**5
    if u>x:
      r+=1
      w=r
      e=r+1
    if x==u:
      print(e,end=" ")
      print(w)
      n+=1
    else:
      e+=1

### FIXED CODE ###

x=int(input())
m=0
for i in range(500):
  for k in range(500):
    w=i**5
    e=k**5
    r=k**5*-1
    if w-e==x:
      print(i,end=" ")
      print(k)
      m+=1
      break
    elif w-r==x:
      print(i,end=" ")
      print(k*-1)
      m+=1
      break
  if m==1:
    break
N,K=map(int,input().split())
S=input()
new_S= S.lower(K)
print(new_S)

### FIXED CODE ###

N,K = list(map(int,input().split()))
S = input()
print(S[:K-1]+S[K-1].lower()+S[K:])
N, M=map(int, input().split())
mod=10**9+7
pre=-1
hole=[]
for i in range(M):
  a=int(input())
  hole.append(a-1-pre)
  pre=a
hole.append(N-pre)

  

dp=[0]*(N+1)
dp[1]=1
dp[2]=1
for i in range(3,N+1):
  dp[i]=(dp[i-1]+dp[i-2])%mod
if len(hole)==1:
  print(dp[N])
  
#print(dp)
#print(hole)
ans=1
for h in hole:
  ans*=dp[h]
  ans%=mod
  
print(ans)

### FIXED CODE ###

N, M=map(int, input().split())
mod=10**9+7
pre=-1
hole=[]
for i in range(M):
  a=int(input())
  hole.append(a-1-pre)
  pre=a
hole.append(N-pre)

  

dp=[0]*(N+3)
dp[1]=1
dp[2]=1
for i in range(3,N+3):
  dp[i]=(dp[i-1]+dp[i-2])%mod

  
#print(dp)
#print(hole)
ans=1
for h in hole:
  ans*=dp[h]
  ans%=mod
  
print(ans)
a, b = map(int, input().split())
numbers = list(range(a, b + 1))
if a <= 0:
    if 0 <= b or a == 0 or b == 0:
        print("Zero")
        exit()
    if len(numbers) % 2 != 0:
        print("Negative")
    else:
        print("Positive")
else:
    print("Positive")


### FIXED CODE ###

a, b = map(int, input().split())
if 0 < a <= b:
    print("Positive")

elif a <= b < 0:
    if (b - a + 1) % 2 == 0:
        print("Positive")

    else:
        print("Negative")
elif a <= 0 <= b:
    print("Zero")
a = [list(map(str(input().split())))]
while True:
  h = int(len(a)/2)
  for i in range(h-1):
    if all(a[i]==a[i+h]):
      print(len(a))
      exit()
  a[:-1]

### FIXED CODE ###

n = input()
num = len(n)-2
for i in range(num,0,-2):
  f = int(i/2)
  if n[:f]==n[f:i]:
    print(i)
    break
N, M = map(int,input().split())
X = sorted(list(map(int,input().split())))

tmp = [abs(X[i+1] - X[i]) for i in range(M-1)]
if(tmp != []):
  tmp.remove([max(tmp) for _ in range(N-1)]
  print(sum(tmp))
else:
  print(0)

### FIXED CODE ###

N, M = map(int,input().split())
X = sorted(list(map(int,input().split())))

tmp = sorted([X[i+1] - X[i] for i in range(M-1)])
if(tmp != []):
  if(len(tmp) == 1):
    print(*tmp)
  elif(N == 1):
    print(sum(tmp))
  else:
    print(sum(tmp[:-(N-1)]))
else:
  print(0)
A = list(map(int, input().split()))
print(for i in range(A[0] * 2-1): A[1]-A[0] + i)

### FIXED CODE ###

A = list(map(int, input().split()))
for i in range(A[0] * 2 -2):
  print(A[1]-A[0] + i+1, end=' ')
print(A[1]+ A[0] -1 )
n=int(input())
a=list(map(int,input().split()))
cnt=10**9
for i in range(n):
  k=0
  while (a-1):
    if a%2==0:
      a=a//2
      k+=1
    else:break
  cnt=min(cnt,k)    
print(cnt)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
  k=0
  while 1:
    if a[i]%2==0:
      a[i]=a[i]//2
      k+=1
    else:break
  cnt+=k    
print(cnt)
S = list(input())

R = []

for i, ch in enumerate(S):
    if ch != 'B':
        R.append(ch)
    elif len(R) > 0:
        del R[i - 1]


print(''.join(R))


### FIXED CODE ###

S = list(input())

L = []

for i, ch in enumerate(S):
    if ch != 'B':
        L.append(ch)
    elif len(L) > 0:
        L = L[:-1]

print(''.join(L))
x,y,z=map(int,input().split())
print(x,y,z)
a[0]=z
a[1]=x*y
print(min(a))

### FIXED CODE ###

x,y,z=map(int,input().split())
print(min(x*y,z))
S = input()
Q = int(input())
head = True # True: left side is head
for i in range(Q):
  Query_i = list(map(str, input().split()))
  if Query_i[0]=='1':
    head = not head
  elif Query_i[1] == '1' and head:
    S = Query_i[2] + S
  elif Query_i[1] == '1' and not head:
    S = S + Query_i[2]
  elif Query_i[1] == '2' and head:
    S = S + Query_i[2]
  else Query_i[1] == '2' and not head:
    S = Query_i[2] + S
  if not head:
    S = S[::-1]
print(S)

### FIXED CODE ###

# input
S = input()
# judge and print
if S[0]==S[1] and S[1]==S[2]:
  print('No')
else:
  print('Yes')
a,b,c,d = map(raw_input().split())
m = a*c
n = a*d
o = b*c
p = b*d
if(m>n and m>o and m>p):
    print(m)
elif (n>m and n>o and n>p):
    print(n)
elif (o> m and o>n and o>p):
    print(o)
else:
    print(p)

### FIXED CODE ###

a,b,c,d = map(int, input().split())
m = a*c
n = a*d
o = b*c
p = b*d
if(m>n and m>o and m>p):
    print(m)
elif (n>m and n>o and n>p):
    print(n)
elif (o> m and o>n and o>p):
    print(o)
else:
    print(p)
h,w = map(int,input().split())
a=[input() for i in range(h)]
b=[]
c=[]
for i in a:
  if "#" in i:
    b.append(i)
for i in range(w):
  for j in range(len(b)):
    if b[j][i] == "#":
      break
    elif j = h-1:
      for k in b:
        del k[j]
print(b)

### FIXED CODE ###

h,w = map(int,input().split())
a=[list(input()) for i in range(h)]
b=[]
dl=[]
for i in a:
  if "#" in i:
    b.append(i)
for j in range(w):
  for i in range(len(b)):
    if b[i][j] == "#":
      break
    elif i == len(b)-1:
      dl.append(j)
dl.sort(reverse=True)
for i in dl:
  for j in range(len(b)):
    del b[j][i]
for c in b:
  print(*c,sep="")
import fractions
from sys import stdin
data = [int(x) for x in stdin.readline().rstrip().split()]
acc_gcd = fractions.gcd(data[0],data[1])
for i in data:
    acc_gcd = fractions.gcd(acc_gcd,i)
print(acc_gcd)

### FIXED CODE ###

import fractions
from sys import stdin
N = int(stdin.readline().rstrip())
data = [int(x) for x in stdin.readline().rstrip().split()]
l_gcd = [0] * (len(data) + 1)
r_gcd = [0] * (len(data) + 1)
for ind,(i,j) in enumerate(zip(data,reversed(data))):
    l_gcd[ind + 1] = fractions.gcd(l_gcd[ind],i)
    r_gcd[ind + 1] = fractions.gcd(r_gcd[ind],j)
r_gcd = list(reversed(r_gcd))
ans = 0
for k in range(N):
    ans = max(fractions.gcd(l_gcd[k],r_gcd[k+1]),ans)
print(ans)
n = int(input())
A = list(map(int,input().split()))
l = [[0,0],[0,0],[0,0]]
flag = 0
for i in range(n):
  x = A[i]
  for j in range(3):
    if l[j] == [0,0]:
      l[j] = [x,1]
      break
    if x == l[j][0]:
      l[j][1] += 1
      break
  else:
    break
a = l[0][1]
b = l[1][1]
c = l[2][1]
aa = l[0][0]
bb = l[1][0]
cc = l[2][0]
if n % 3 == 0:
  m = n // 3
  if a == m:
    if b == m and c == m:
      if aa ^ bb ^ cc == 0:
        flag = 1
  if a == 2 * m and b == m:
    if bb == 0:
      flag = 1
  if a == m and b == 2 * m:
    if aa == 0:
      flag = 1
else:
  if a == n and aa == 0:
    flag = 1
if a == m and b == 2 * m:
  print('Yes')

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
s = 0
for i in range(n):
  s ^= a[i]
if s == 0:
  print('Yes')
else:
  print('No')
s = int(input())
a, b = s//100, s%100
boos = int(input())
a, b = s//100, s%100
p = bool(1 <= a <= 12)
q = bool(1 <= b <= 12)
if p & q:
    print("AMBIGUOUS")
elif p:
    print("MMYY")
elif q:
    print("YYMM")
else:
    print("NA")

### FIXED CODE ###

s = int(input())
a, b = s//100, s%100
p = bool(1 <= a <= 12)
q = bool(1 <= b <= 12)
if p & q:
    print("AMBIGUOUS")
elif p:
    print("MMYY")
elif q:
    print("YYMM")
else:
    print("NA")
x = input()
hights_str = input()

low_limit = int(x.split(" ")[1]
hights = map(int, hights_str.split(" "))

count = 0
for hight in hights:
    if hight >= low_limit:
        count += 1

print(count)

### FIXED CODE ###


x = input()
hights_str = input()

low_limit = int(x.split(" ")[1])
hights = map(int, hights_str.split(" "))

count = 0
for hight in hights:
    if hight >= low_limit:
        count += 1

print(count)
import collections
n=int(input())
s=input().split()
c=collections.Counter(s)
k=list(c.most_common())
cnt=0
for i in range(n):
    if k[i][1]>cnt:
        cnt=k[i][1]
        l=[k[i][0]]
    elif k[i][1]==cnt:
        l.append(k[i][0])
    else:
        break 
for i in l:
    print(i)

### FIXED CODE ###

import collections

N=int(input())
S=[]
for i in range(N):
	S.append(input())
M=collections.Counter(S)
A=max(M.values())
tmp=[]
for i,j in M.items():
	if j==A:
		tmp.append(i)
ans=sorted(tmp)
for i in range(len(ans)):
	print(ans[i])
n = int(input())

allcount = 0

for i in range(1,n+1):
  count = 0
  vans = i
  while True:
    if i%2 == 1:
      break
    elif i%2 == 0:
      count += 1
      i //= 2

  if count > allcount:
    allcount = count
    ans = vans

print(ans)

### FIXED CODE ###

n = int(input())

allcount = 0
if n == 1:
  print(1)
  exit()
for i in range(1,n+1):
  count = 0
  vans = i
  while True:
    if i%2 == 1:
      break
    elif i%2 == 0:
      count += 1
      i //= 2

  if count > allcount:
    allcount = count
    ans = vans

print(ans)
#!/usr/bin/python3
# -*- coding: utf-8 -*-
def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
def list_euclid(int_list):
    ans = int_list[0]
    for i in range(1,len(int_list)):
        ans = euclid(ans, int_list[i])
        if ans == 1:
            return ans
    return ans
n = int(input())
a = list(map(int, input().split()))
a.sort()
max = 0
b_int = 0
if n < 5:
  for i in range(0,n):
    if b_int == a[0]:
      p = a.pop(0)
      a.append(p)
    else:
      p = a.pop(0)
      b_int = p
      x = list_euclid(a)
      if max < x:
        max = x
      a.append(p)
else:
  for i in range(0,n):
    if b_int == a[0]:
      p = a.pop(0)
      a.append(p)
    else:
      p = a.pop(0)
      b_int = p
      k = n // 2
      x = 0
      y = list_euclid(a[0:k])
      if y == 1:
        x = 1
      else:
        z = list_euclid(a[k:n-1])
        x = euclid(y, z)
      if max < x:
        max = x
        a.append(p)
print(max)

### FIXED CODE ###

#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
def gcd(a, b): #最大公約数
  while b:
    a, b = b, a % b
  return int(a)
    
n = int(input())
a = list(map(int, input().split()))
if n==2:
  print(max(a))
  sys.exit(0)
elif n==3:
  lis = [gcd(a[0], a[1]), gcd(a[1], a[2]), gcd(a[2], a[0])]
  print(max(lis))
  sys.exit(0)
tmp_unused = gcd(a[0], a[1])
tmp_used = max(a[0], a[1])
#print("used=", tmp_used, "unused=", tmp_unused)
for i in range(2,n):
  #print(a[i])
  tmp_used = max(tmp_unused, gcd(tmp_used, a[i]))
  tmp_unused = gcd(tmp_unused, a[i])
  
  #print("used=", tmp_used, "unused=", tmp_unused)
print(tmp_used)
N, M, K = map(int, input().split())
A = [int(s) for s in input().split()]
B = [int(s) for s in input().split()]

time = 0
maxBooks = 0
for i in range(N):
  if K - time >= A[i]:
    time += A[i]
    maxBooks += 1
  else:
    break

A_count = maxBooks
nowBooks = maxBooks

for i in range(M):
  if K - time >= B[i]:
    time += B[i]
    nowBooks += 1
  else:
    if A_count < 0:
      break
    while K - time < B[i]:
      time -= A[A_count]
      A_count -= 1
      nowBooks -= 1
    time += B[i]
    nowBooks += 1
  if maxBooks < nowBooks:
    maxBooks = nowBooks
    
print(maxBooks)

### FIXED CODE ###

N, M, K = map(int, input().split())
A = [int(s) for s in input().split()]
B = [int(s) for s in input().split()]

time = 0
maxBooks = 0

for i in range(N):
  if K - time >= A[i]:
    time += A[i]
    maxBooks += 1
  else:
    break

A_count = maxBooks - 1
nowBooks = maxBooks

for i in range(M):
  time += B[i]
  nowBooks += 1
  
  while K < time:
    if A_count < 0:
      nowBooks = 0
      break
    time -= A[A_count]
    A_count -= 1
    nowBooks -= 1
      
  if maxBooks < nowBooks:
    maxBooks = nowBooks
    
print(maxBooks)
n = int(input().split())
A = list(map(int, input().split()))
A_sort = sorted(A, reverse=True)
print(*A)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
ans = [0]*n
for i in range(n):
  ans[A[i]-1] = i+1
print(*ans)
n=int(input())
sys.setrecursionlimit(10 ** 6)
h=list(map(int,input().split()))
cos={0:0,1:abs(h[1]-h[0])}
def cost(x):
  if x not in cos:
    d1=cost(x-1)+abs(h[x]-h[x-1])
    d2=cost(x-2)+abs(h[x]-h[x-2])
    cos[x]=min(d1,d2)
    return cos[x]
  else:
    return cos[x]
  
print(cost(n-1))

### FIXED CODE ###

n=int(input())
import sys
sys.setrecursionlimit(10 ** 6)
h=list(map(int,input().split()))
cos={0:0,1:abs(h[1]-h[0])}
def cost(x):
  if x not in cos:
    d1=cost(x-1)+abs(h[x]-h[x-1])
    d2=cost(x-2)+abs(h[x]-h[x-2])
    cos[x]=min(d1,d2)
    return cos[x]
  else:
    return cos[x]
  
print(cost(n-1))