peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
x,n = map(int,input().split())

if n == 0:
  print(x)
  exit()

p = list(map(int,input().split()))

x1,x2 = x,x
for i in range(1000):
  x1 -= 1
  x2 += 1
  if x1 not in p:
    print(x1)
    exit()
  if x2 not in p:
    print(x2)
    exit()
# Judge status: Accepted
def LI():
    return list(map(int, input().split()))


N, P = LI()
A = LI()
gu = 0
ki = 0
for i in range(N):
    if A[i] % 2 == 0:
        gu += 1
    else:
        ki += 1


if ki == 0:
    if P == 0:
        ans = 2**N
    else:
        ans = 0
else:
    ans = 2**(N-1)
print(ans)
# Judge status: Accepted
import sys
input=sys.stdin.readline
K=int(input())
A,B=map(int,input().split())
for i in range(1001):
  s=i*K
  if A<=s and s<=B:
    print("OK")
    break
  if 1000<s:
    print("NG")
    break
# Judge status: Wrong Answer
n = int(input())
b = list(map(int, input().split()))
b.reverse()
a = [0]*(n-1)
a[0] = b[0]
for i in range(1,n-1):
	if b[i] > b[i-1]:
		a[i] = b[i-1]
	else:
		a[i] = b[i]
print (sum(a)+a[-1])
# Judge status: Wrong Answer
x1, x2, x3, x4, x5 = map(int, input().split())
if x1 == 0:
  print(1)
if x2 == 0:
  print(2)
if x3 == 0:
  print(3)
if x4 == 0:
  print(4)
else:
  print(5)
# Judge status: Accepted
stng = input()
lets = {1}
ans = "yes"
for i in stng:
  if i in lets:
    ans = "no"
  else:
    lets.add(i)
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline

n, d = map(int, input().split())
x = []
cnt = 0
ans = 0
for i in range(n):
    x_memo = list(map(int, input().split()))
    x.append(x_memo)

for i in range(n - 1):
    for j in range(i + 1, n):
        cnt = 0
        for k in range(d):
            cnt += abs(x[i][k] - x[j][k]) ** 2
        cnt = cnt ** 0.5
        if cnt.is_integer():
            ans += 1

print(ans)
# Judge status: Accepted
import sys
S = input()

for i, s in enumerate(S):
    if i%2==0:
        if s not in ["R", "U", "D"]:
            print("No")
            sys.exit()
    else:
        if s not in ["L", "U", "D"]:
            print("No")
            sys.exit()

print("Yes")
# Judge status: Wrong Answer
a,b=map(int, input().split())

if a >= 10:
    print(b)
else:
    print(b-100*(10 - a))
# Judge status: Wrong Answer
x,y = map(int,input().split())
if 0 <= x < y or x < y <= 0:
    print(abs(y-x))
elif 0 <= y < x or y < x <= 0:
    print(abs(x-y) + 2)
elif x < y:
    if y < abs(x):
        print(abs(x)-y + 1)
    else:
        print(y-abs(x) + 1)
else:
    if x < abs(y):
        print(abs(y)-x + 1)
    else:
        print(x-abs(y) + 1)
# Judge status: Wrong Answer
k = int(input())
s = input()

if len(s)<=k:
    print(s)
else:
    print(s[:k],'...')
# Judge status: Accepted
import math

N = int(input())

primes = {}
i = 2
sqrt_N = math.floor(math.sqrt(N))
while i <= sqrt_N:
	if N % i == 0:
		if i in primes:
			primes[i] += 1
		else:
			primes[i] = 1
		N //= i
		sqrt_N = math.floor(math.sqrt(N))
	else:
		i += 1

if N != 1:
	if N in primes:
		primes[N] += 1
	else:
		primes[N] = 1

count = 0
for c in primes.values():
	i = 1
	while i <= c:
		count += 1
		c -= i
		i += 1
print(count)
# Judge status: Accepted
c = input()
s = input()
cl = list(c)
sl = list(s)

cr = list(reversed(cl))

if sl == cr:
    print("YES")

else:
    print("NO")
# Judge status: Wrong Answer
N = int(input())
a = [list(map(int, input().split())) for i in range(N)]
dp = [[0 for i in range(3)] for j in range(N)]
dp[0] = a[0]

for i in range(N - 1):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + a[i + 1][k])

print(max(dp[N - 1]))
# Judge status: Accepted
N,M=map(int,input().split())
R=[0]*50
for i in range(M):
  a,b=map(int,input().split())
  R[a-1]+=1
  R[b-1]+=1
for i in range(N):
  print(R[i])
# Judge status: Accepted
N = int(input())
S = list(input())

for i in range(len(S)):
  S[i] = chr(65+(ord(S[i])-65+N)%26)

    
print("".join(map(str,S)))
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
D = int(str(A) + str(B)) + C
E = A + int(str(B) + str(C))
print(max(D, E))
# Judge status: Wrong Answer
x = int(input())
if x<=400 and 599<=x:
  print(8)
if x<=600 and 799<=x:
  print(7)

if x<=800 and 999<=x:
  print(6)

if x<=1000 and 1199<=x:
  print(5)

if x<=1200 and 1399<=x:
  print(4)

if x<=1400 and 1599<=x:
  print(3)

if x<=1500 and 1799<=x:
  print(2)

if x<=1600 and 1999<=x:
  print(1)
exit()
# Judge status: Wrong Answer
n,k = map(int,input().split())
listA = list(map(int,input().split()))

kouho = [1]
ikisaki = listA[0]
while ikisaki not in kouho:
    kouho.append(ikisaki)
    ikisaki = listA[ikisaki-1]

index = kouho.index(ikisaki)
loop = len(kouho) - index
amari = (k-index)%loop
print(kouho[index + amari])
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))
l.sort()
print(sum(l[n::2]))
# Judge status: Accepted
n, k = map(int, input().split())
H = sorted([int(input()) for _ in range(n)])

ans = 1100100100
for i in range(n-k+1):
    ans = min(ans, H[i+k-1] - H[i])
print(ans)
# Judge status: Wrong Answer
S = list(input())
S.append("end")
S.append("end")
S.append("end")


i = 1
ans = 0

while S[i] != "end":
    if S[i] != S[i - 1]:
        del(S[i - 1])
        del(S[i - 1])
        i -= 1
        ans += 2
    else:
        i += 1
print(ans)
# Judge status: Accepted
import sys
from collections import *

N,M=map(int,input().split())
adj=[[] for _ in range(N+1)]
for ln in sys.stdin:
    A,B=map(int,ln.split())
    adj[A].append(B)
    adj[B].append(A)

ans=[0]*(N+1)
ans[1]=1
que=deque([1])
while que:
    A=que.popleft()
    for B in adj[A]:
        if ans[B]==0:
            ans[B]=A
            que.append(B)

print('Yes')
for i in range(2,N+1):
    print(ans[i])
# Judge status: Accepted
K, N = map(int, input().split())
Alst = list(map(int, input().split()))
zero = Alst[0] + K
M = 0
now = Alst[0]
for i in Alst:
    dis = i - now
    if dis > M:
        M = dis
    now = i

last = zero - now
if last > M:
    M = last

print(K - M)
# Judge status: Accepted
n,m,a,b = map(int,input().split())

x = list(map(int,input().split()))
x = max(x)

y = list(map(int,input().split()))
y = min(y)
i = x
ans = ''


for i in range(a+1,b):
  # X<z<yという区間を満たしていない ので誤りその条件を付け加えるなら...
  if x<i and i<=y:
    ans = 1
if ans:
  print('No War')
else:
  print('War')
# Judge status: Accepted
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))

pos = [0 for i in range(n+1)]
pos[0] = 1 - a[0]
for i in range(n):
    pos[i+1] = pos[i] * 2 - a[i+1]

for i in range(n+1):
    if pos[i] < 0:
        print(-1)
        exit()

cnt = a[-1]
memo = 0
for i in range(n-1, -1, -1):
    cnt += min(pos[i], memo + a[i+1]) + a[i]
    memo = min(pos[i], memo + a[i+1])


print(cnt)
# Judge status: Wrong Answer
N=int(input())
input_list=map(int,input().split(" "))

max_input=max(input_list)
Sum_input=sum(input_list)-max_input
if max_input<Sum_input:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
x = int(input())
 
num = 0
for i in range(a):
  for j in range(b):
    for k in range(c):
      if 500 * i + 100 * j + 50 * k == x:
        num += 1
 
print(num)
# Judge status: Accepted
X = int(input())

n_500 = X // 500

num = X - n_500 * 500

n_5 = num // 5

print(n_500 * 1000 + n_5 * 5)
# Judge status: Accepted
d=int(input())
c=list(map(int,input().split()))
c_days=[0]*26
for i in range(d):
    s=list(map(int,input().split()))
    #最大満足度を選択
    c_low=[c[x]*(i+1-c_days[x]) for x in range(26)]
    c_max=[s[x]-c_low[x] for x in range(26)]
    n=c_max.index(max(c_max))
    c_days[n]=i+1
    print(n+1)
# Judge status: Accepted
a,b = map(int,input().split())

if a*b%2==0:
  print("Even")
else:
  print("Odd")
# Judge status: Wrong Answer
n = int(input())
cnt = 0
p = 0
for i in range(n):
    cnt += i
    if cnt >= n:
        p = i
        break
print(p)
# Judge status: Accepted
X = int(input())

print(10 - X // 200)
# Judge status: Accepted
N, X = map(int, input().split())
L = list(map(int, input().split()))
d = 0
count = 0
for i in range(N):
  d += L[i]
  if X < d:
    count = i + 1
    break
if count == 0:
  print(N + 1)
else:
  print(count)
# Judge status: Accepted
x,a,b=map(int,input().split())
if abs(x-a)>abs(x-b):
    print("B")
else:
    print("A")
# Judge status: Accepted
import collections

N = int(input())
A = list(map(int, input().split()))
ans = collections.deque()
for i in range(N):
    if N % 2 == 0:
        if i % 2 == 0:
            ans.append(A[i])
        else:
            ans.appendleft(A[i])
    else:
        if i % 2 == 0:
            ans.appendleft(A[i])
        else:
            ans.append(A[i])
print(*ans)
# Judge status: Accepted
s = list(input())

if s.count('R') == 3:
    print(3)
elif s.count('R') == 1:
    print(1)
elif s.count('R') == 0:
    print(0)
else:
    if s[1] == 'R':
        print(2)
    else:
        print(1)
# Judge status: Accepted
N = int(input())

for i in range(26):
  if (N-i*4)% 7 == 0 and N>= i*4:
    print("Yes")
    exit()
print("No")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

box = [0]*N
ans = []
for n in range(N,0,-1):
    c = 0
    for i in range(n,N,n):
        c += box[i-1]
    c %= 2
    if A[n-1] != c:
        box[n-1] = 1
        ans.append(n)
print(len(ans))
if ans:
    print(*ans)
# Judge status: Wrong Answer
n = int(input())
L = list(map(int, input().split()))
cnt = 1
L2 = [''] * (n - 1)
for i in range(n - 1):
    L2[i] = L[i + 1] - L[i]
j = 0
while j < n - 2:
    if L2[j + 1] * L2[j] < 0:
        cnt += 1
        j += 1
    j += 1
print(cnt)
# Judge status: Accepted
a,b=map(int,input().split())
if a>0 and b>0:
    print('Positive')
elif  a<0 and b<0 and (abs(a)-abs(b)+1)%2 != 0:
    print('Negative')
elif a<0 and b<0 and (abs(a)-abs(b)+1)%2==0:
    print('Positive')
else:
    print('Zero')
# Judge status: Accepted
H1, M1, H2, M2, K = map(int, input().split())
print((H2-H1)*60 + (M2-M1) -K)
# Judge status: Wrong Answer
n, k, q = list(map(int, input().split()))
a = [int(input()) for i in range(q)]
p = [k]*n

for i in a:
  for j,val in enumerate(p):
    if j != i:
      p[j] -= 1

      
for n in p:
  if n>0:
    print("Yes")
  else:
    print("No")
# Judge status: Accepted
from collections import Counter
import sys
n=int(input())
a=sorted(list(map(int,input().split())))
 
c=[1 for i in range(10**6+1)]
d = Counter(a)
s = list(set(a))
count = 0
if d[1] == 1:
  print(1)
  sys.exit()
elif d[1] >=2:
  print(0)
  sys.exit()
for x in s:
  t = x * 2
  while t <= 10 ** 6:
    c[t] = 0
    t += x
 
for x in a:
  if d[x] == 1 and c[x] == 1:
    count += 1
print(count)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

passed = [-1] * (n+1)
route = []
v = 1
while passed[v] == -1:
    passed[v] = len(route)
    route.append(v)
    v = a[v-1]

c = len(route) - passed[v]
l = passed[v]

if k < l:
    print(route[k])
else:
    k -= l
    k %= c
    print(route[l+k])
# Judge status: Wrong Answer
S = input()
if int(S[5:6]) <= 4:
  print("Heisei")
else:
  print("TBD")
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

now = 1
hit = 0
for a in A:
    if a != now:
        hit += 1
    else:
        now += 1
if hit == n:
    print(-1)
else:
    print(hit)
# Judge status: Wrong Answer
N,M = [int(i) for i in input().split()]
S = 0

if N >= 2*M:
    S = M // 2
else:
    S = N + (M - 2*N)//4

print(S)
# Judge status: Wrong Answer
n, k = [int(i) for i in input().split()]
import fractions

if k == 1:
  print(0)
else:
  print(fractions.gcd(n, k))
# Judge status: Accepted
n = int(input())
ans =0

for i in range(1,n+1):
    if i % 3 != 0 and i %5 !=0:
        ans += i
print(ans)
# Judge status: Accepted
from collections import Counter
n = int(input())
A = list(map(int, input().split()))

C = Counter(A)

rec = []
squ = []

for a in A:
    if 2 <= C[a]:
        rec.append(a)
    if 4 <= C[a]:
        squ.append(a)
rec = list(set(rec))
squ = list(set(squ))
# print(rec)
# print(squ)

s = 0
if len(squ) != 0:
    s = max(squ)**2

if len(rec) < 2:
    print(s)
else:
    rec.sort(reverse=True)
    print(max(s, rec[0]*rec[1]))
# Judge status: Accepted
a,b =map(int,input().split())
if 1 <= a <=9 and 1 <= b <=9:
		print(a*b)
		
else:
		print(-1)
# Judge status: Wrong Answer
n,k=map(int,input().split())
ab=[list(map(int,input().split())) for _ in range(n)]
l=[]
for i in range(len(ab)):
    for j in range(ab[i][1]):
        l.append(ab[i][0])
l.sort()
print(l[3])
# Judge status: Wrong Answer
l = input().split()
l_int = [int(a) for a in l]
N = l_int[0]
K = l_int[1]

if K > N:
    print(N)
else:
    print(N % K)
# Judge status: Accepted
NK = input().split()
N, K = int(NK[0]), int(NK[1])
S = list(input())

if(S[K-1] == "A"):
    S[K-1] = "a"
elif(S[K-1] == "B"):
    S[K-1] = "b"
elif(S[K-1] == "C"):
    S[K-1] = "c"
        
print("".join(S))
# Judge status: Accepted
import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = []


for i in range(q):
    bci = list(map(int, input().split()))
    bc.append(bci)

cc = collections.Counter(a)
li = cc.most_common()
su = sum(a)

for i in range(q):
    b, c = bc[i]
    if cc[b]:
        num = (c-b)*cc[b]
    else:
        num = 0
    su += num
    print(su)
    if cc[c]:
        cc[c] += cc[b]
    else:
        cc[c] = cc[b]
    cc[b] = 0
# Judge status: Accepted
n, m, k = map(int, input().split())
s = [[0 for i in range(n)]for j in range(m)]
for i in range(n+1):
    for j in range(m+1):
        if (i*m + j*n - 2*i*j) == k:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
s=input()
S=set([i for i in s])
if len(S)==2 and s.count(list(S)[0])==s.count(list(S)[1]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from fractions import gcd
from functools import reduce
n = int(input())
A = list(map(int,input().split()))

mod = 10 ** 9 + 7
lcm = reduce(lambda x,y: x*y//gcd(x,y), A)
# print(lcm)
ans = sum(lcm//x for x in A)
ans %= mod
print(ans)
# Judge status: Accepted
import collections
s = list(input())
s = collections.Counter(s)
a = s["a"]
b = s["b"]
c = s["c"]

if max(a,b,c) - min(a,b,c) <= 1:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
a,b,c,d = map(int,input().split())

l = [a*c, a*d, b*c, b*d]

print(max(l))
# Judge status: Wrong Answer
z = input()
if z[-1]in['s','x','z','ch','sh']:
  print(z+'es')
elif z[-1]=='y'and z[-2]not in['a','e','i','o','u']:
  print(z[:-1]+'ies')
elif z[-2:]=='fe':
  print(z[:-2]+'ves')
elif z[-1]=='f':
  print(z[:-1]+'ves')
elif z[-1]=='o'and z[-2]not in['a','e','i','o','u']:
  print(z[:-1]+'oes')
else:
  print(z+'s')
# Judge status: Accepted
n = str(input())
if n == "0":
  print("1")
else:
  print("0")
# Judge status: Accepted
n = int(input())
a = map(int, input().split())
ans_lst = []
for ai in a:
    if ai == 1 and len(ans_lst) == 0:
        ans_lst.append(1)
    elif len(ans_lst) > 0 and ans_lst[-1] == ai - 1:
        ans_lst.append(ai)
if len(ans_lst) == 0:
    print(-1)
else:
    print(n - len(ans_lst))
# Judge status: Accepted
# 理解するまでが面白い
# 思考5分、実装1分
w,h,x,y = map(int, input().split())

print(w*h/2)

if x == w/2 and y == h/2:
    print('1')
else:
    print('0')
# Judge status: Wrong Answer
n = int(input())

C, S, F = [0] * n, [0] * n, [0] * n

for i in range(n - 1):
    C[i], S[i], F[i] = map(int, input().split())

for i in range(n):
    time = S[i]
    for j in range(i, n - 1):
        if time % F[j] == 0:
            time += C[j]
        elif time < S[j]:
            time = S[j] + C[j]
        else:
            time = time + F[j] - (time % F[j]) + C[j]
    print(time)
# Judge status: Accepted
from collections import Counter
N = int(input())
S = input()

C = Counter(S)
ans = C['R']*C['G']*C['B']

for w in range(1, (N+1)//2+1):
    for i in range(N-(w*2)):
        if S[i]!=S[i+w] and S[i]!=S[i+2*w] and S[i+w]!=S[i+2*w]:
            ans -= 1
print(ans)
# Judge status: Accepted
import math
x, k, d = map(int, input().split())
if k * d <= abs(x):
    print(abs(x) - k * d)
    exit()
if x < 0:
    x = abs(x)
move = math.ceil(x/d)
x = x - d * move
k -= move
if k % 2 == 0:
    print(abs(x))
else:
    x = x + d
    print(abs(x))
# Judge status: Accepted
import sys
from collections import Counter

n, k, q = map(int, sys.stdin.readline().split())
a = map(int, sys.stdin.read().split())
counter = Counter(a)

for i in range(n):
    if k - q + counter[i+1] > 0:
        ans = 'Yes'
    else:
        ans = 'No'
    print(ans)
# Judge status: Accepted
s=input()
print(s[:3]+"8"+s[4:])
# Judge status: Accepted
A, B, C, D = map(int, input().split())

if A <= C:
    if B < C:
        print(0)
    else:
        print(min(B, D) - C)
else:
    if D < A:
        print(0)
    else:
        print(min(B, D) - A)
# Judge status: Accepted
#16
n = int(input())
s = [int(input()) for i in range(n)]

Max = sum(s)
s.sort()

if Max%10 ==0:
    for i in range(n):
        if s[i]%10 != 0:
            Max -= s[i]
        if Max%10 !=0:
            break
if Max%10 == 0:
    Max = 0
    
print(Max)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
d=[0,0,0]
for i in l:
  if i%4==0:d[2]+=1
  elif i%2==0:d[1]+=1
  else:d[0]+=1
f=0
if d[-1]>=n//2:f=1
if d[0]<=d[-1]:f=1
print("Yes" if f else "No")
# Judge status: Accepted
N = int(input())
A = [int(input()) for i in range(5)]
m = min(A)
cnt = (N - 1) // m + 1
print(cnt + 4)
# Judge status: Accepted
n = int(input())
vn =list(map(int, input().split()))

vn.sort()

a = (vn[0]+vn[1])*0.5

for i in range(2, n):
    a = (a+vn[i])*0.5


print(a)
# Judge status: Accepted
import math

N = int(input())

tmp = 10 ** 30
ans = 0
for P in list(map(int,input().split())):
    if P <= tmp:
        tmp = P
        ans += 1

print(ans)
# Judge status: Accepted
x = int(input())
if x<=599:
  ans=8
elif x<=799:
  ans=7
elif x<=999:
  ans=6
elif x<=1199:
  ans=5
elif x<=1399:
  ans=4
elif x<=1599:
  ans=3
elif x<=1799:
  ans=2
elif x<=1999:
  ans=1
print(ans)
# Judge status: Accepted
def main(n, a_b):
    a_b.sort(key=lambda a_b: a_b[1])

    t = 0
    for a, b in a_b:
        t += a
        if t > b:
            print('No')
            return

    print('Yes')


if __name__ == "__main__":
    n = int(input())
    a_b = [list(map(int, input().split())) for _ in range(n)]

    main(n, a_b)
# Judge status: Accepted
n=int(input())
l=[2,1]
for i in range(2,n+1):
    l.append(l[i-1]+l[i-2])
print(l[n])
# Judge status: Accepted
n = input()
ans = 0
for i in n:
    ans += int(i)

ans = "Yes" if ans % 9 == 0 else "No"
print(ans)
# Judge status: Wrong Answer
import itertools
import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int, input().split()))
ans = 0
for L in itertools.permutations(A):
    temp = 0
    for i in range(N-1):
        temp += min(L[i-1], L[i+1])
    ans = max(ans, temp)
print(ans)
# Judge status: Accepted
n = int(input())
ans = 10**9
for i in range(1,n):
    ans_a = 0
    ans_b = 0
    a = str(i)
    b = str(n-i)
    for j in a:
        ans_a += int(j)
    for k in b:
        ans_b += int(k)
    ans = min(ans,ans_a+ans_b)
print(ans)
# Judge status: Wrong Answer
N, K, S = map(int, input().split())
arr = [1 if S > N else S + 1] * N
for i in range(K):
    arr[i] = S
print(arr)
# Judge status: Accepted
import itertools, bisect

N = int(input())
L = list(map(int, input().split()))
L.sort()

ans = 0
for i in range(N):
    for j in range(i+1, N):
        cindex = bisect.bisect_left(L, int(L[i]) + int(L[j]))
        ans += cindex-1 - j

print(ans)
# Judge status: Wrong Answer
#owsiudfhowidhoewifnowienfoeinfo

print(int(float(int(input())**0.5)))
# Judge status: Wrong Answer
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a,b,c=map(int,input().split())
if a<=b<=c or a>=b>=c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S=input()
ans='Good'
for i in range(3):
    if S[i]==S[i+1]:
        ans='Bad'
print(ans)
# Judge status: Accepted
N = int(input())

_dict = {}
max_cnt = 0
for n in range(N):
  _ = input()
  if _ not in _dict:
    _dict[_] = 1
  else:
    _dict[_] += 1
    
  if _dict[_] > max_cnt:
    max_cnt = _dict[_]


ans = [k for k, v in _dict.items() if v == max_cnt]
ans.sort()
for _ in ans:
  print(_)
# Judge status: Accepted
from sys import stdin

c = stdin.readline().rstrip()
a = int(c)
res = a+pow(a,2)+pow(a,3)
print(res)
# Judge status: Accepted
import sys

s=list(input())
t=list(input())


start=[-1]*26
end=[-1]*26

for i in range(len(s)):
    a=ord(s[i])-ord('a')
    b=ord(t[i])-ord('a')
    if(start[a]!=-1 or end[b]!=-1):
        if(start[a]!=b or end[b]!=a):
            print("No")
            sys.exit()
    start[a]=b
    end[b]=a
print("Yes")
# Judge status: Wrong Answer
N,D=map(int,input().split())
cnt=0
for idx in range(N-1):
  X,Y=map(int,input().split())
  if X**2+Y**2<=D**2:
    cnt=cnt+1
print(cnt)
# Judge status: Accepted
N = int(input())
S = [input() for _ in range(N)]

AC = 0
WA = 0
TLE = 0
RE = 0

for s in S:
    if s == 'AC':
        AC += 1
    elif s == 'WA':
        WA += 1
    elif s == 'TLE':
        TLE += 1
    elif s == 'RE':
        RE += 1
    else:
        pass

print('AC x ' + str(AC))
print('WA x ' + str(WA))
print('TLE x ' + str(TLE))
print('RE x ' + str(RE))
# Judge status: Accepted
from math import ceil
n,h=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
  a[i],b[i]=map(int,input().split())
dmax=max(a)
b.sort(reverse=True)
ans=0
for d in b:
  if h<=0:
    print(ans)
    exit()
  if d<dmax:
    break
  h-=d
  ans+=1
if h<=0:
  print(ans)
  exit()
print(ans+ceil(h/dmax))
# Judge status: Wrong Answer
from itertools import product

N = int(input())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a), B.append(b)
A.sort()
B.sort()

if N % 2 == 0:
    print(len(set(a + b for a, b in product(range(A[N // 2 - 1], A[N // 2] + 1), range(B[N // 2 - 1], B[N // 2] + 1)))))
else:
    print(B[N // 2] - A[N // 2] + 1)
# Judge status: Accepted
import sys

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

D = set(map(int, input().split()))

def check(n):
  m = set(str(n))
  for c in m:
    if int(c) in D:
      return False
  return True


for i in range(999999):
  if check(N+i):
    print(N+i)
    sys.exit()
# Judge status: Wrong Answer
from sys import stdin
from collections import deque
input = stdin.readline

s = input()
d = deque([])

for i in s:
    if s != "B":
        d.append(s)
    else:
        if d:
            d.pop()
        else:
            pass

print("".join(d))
# Judge status: Accepted
N, P = map(int, input().split())
A = list(map(int, input().split()))

n = 0
for v in A:
  if v % 2 == 0:
    n += 1
if N == n:
  if P == 0: ans = 2 ** N
  else: ans = 0
else:
  ans = 2 ** (N-1)
print(ans)
# Judge status: Accepted
a,b,c=[int(x) for x in input().split()]
ans = "NO"
for i in range(b):
  if (a*i)%b==c:
    ans="YES"
    
print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
ans = 0
if 2*n >= m:
  print(n)
else:
  ans += n
  m -= 2*n
  ans += m//4
  print(ans)
# Judge status: Wrong Answer
N,M=map(int,input().split())
l=[0]*N
ans=0
for i in range(M):
    s,c=map(int,input().split())
    if l[s-1]==0 or l[s-1]==c:
        l[s-1]=c
    else:
        print(-1)
        exit()
for i in range(N):
    ans+=int(l[i])*(10**(N-i-1))
if N==len(str(ans)):
    print(ans)
else:
    print(-1)
# Judge status: Wrong Answer
import collections
import sys

N = int(input())
s = [sorted(collections.Counter(sys.stdin.readline().rstrip())) for _ in range(N)]

counted = {}
for s_count in s:
    if str(s_count) not in counted:
        counted[str(s_count)] = 1
    else:
        counted[str(s_count)] += 1


count = 0        
for n in counted.values():
    count += n * (n - 1) // 2
            
print(count)
# Judge status: Accepted
a = int(input())
li = []

for i in range(1,10):
  for j in range(1,10):
    li.append(i*j)

if a in li:
  print('Yes')
else:
  print('No')