peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import collections

n,k,q = map(int,input().split())
pt = [int(input()) for i in range(q)]
ans = collections.Counter(pt)

for i in range(n):
    if k-q+ans[i+1] >= 1:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
n = int(input())
al =[ int(input()) for i in range(n)]
sal = sorted(al, reverse = True)
for i in al:
    if i ==sal[0]:
        print(sal[1])
    else:
        print(sal[0])
# Judge status: Accepted
N=int(input())
L=[]

for i in range(N+1):
  if i==0:
    L.append(2)
  elif i==1:
    L.append(1)
  else:
    L.append(L[-2]+L[-1])

print(L[-1])
# Judge status: Accepted
def divisore(n):
    divisors=[]
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            divisors.append(i)
            if i!=n//i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors

n,m=map(int,input().split())
l=divisore(m)
for i in l:
 if m/n>=i:
  print(i)
  exit()
# Judge status: Accepted
a, b, c = map(int, input().split())
print('YES' if (b - a) == (c - b) else 'NO')
# Judge status: Accepted
h = int(input())

for i in range(50):
    if 2 ** i <= h:
        continue
    else:
        break

ans = 0

for j in range(i):
    ans += 2 ** j

print(ans)
# Judge status: Accepted
s, t = input().split(' ')
a, b = map(int, input().split())
u = input()
if s == u: a -= 1
if t == u: b -= 1
print(a, b)
# Judge status: Accepted
# coding: utf-8
# Your code here!

N, M = map(int, input().rstrip().split())
A = input()

count = 0
for i in range(N-1):
    if A[i] == A[i+1]:
        count += 1
        
print(min(count + 2 * M, N - 1))
# Judge status: Accepted
n = int(input())
p = list(map(int,input().split()))
q = sorted(p)
ans = 0
for i in range(n):
  if p[i] != q[i]:
    ans += 1
if ans == 2:
  print('YES')
elif ans == 0:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
a, b = map(int, input().split())
print("a-1" if a>b else "a")
# Judge status: Accepted
a, b = map(int,input().split())
x = (a + b) /2
if x % 1 != 0:
  x = int(x) +1
else:
  x = int(x)
print(x)
# Judge status: Accepted
import math

h = int(input())
atk = 0
for i in range(int(math.log2(h)) + 1):
    atk += 2 ** i

print(atk)
# Judge status: Accepted
S = input()
n = False
e = False
s = False
w = False
for _s in S:
    if _s == 'N':
        n = True
    if _s == 'E':
        e = True
    if _s == 'S':
        s = True
    if _s == 'W':
        w = True
if (n and s and e and w) or (n and s and not e and not w) or (not n and not s and e and w):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
i = 1
x = int(input())
while True:
  if (360 * i) % x == 0:
    print(360 * i // x)
    break
  i += 1
# Judge status: Accepted
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a * b // gcd(a, b)
x, y = map(int, input().split())
print(lcm(x, y))
# Judge status: Accepted
N,R = map(int,input().split())

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

print(len(Base_10_to_n(N, R)))
# Judge status: Accepted
n=int(input())
a=list(map(int, input().split()))
ans=[0 for i in range(n)]
for i in a:
    ans[i-1]+=1
for i in ans:
    print(i)
# Judge status: Accepted
import sys
S=input()
K=int(input())
ans=''
i=0
while True:
    ans=S[i]
    if(K==(i+1)):
        print(ans)
        sys.exit()
    elif(ans=='1'):
        i+=1
    else:
        print(ans)
        sys.exit()
# Judge status: Accepted
n=int(input())
def prime_factor(n):
  ass=[]
  for i in range(2,int(n**0.5)+1):
    while n%i==0:ass.append(i);n//=i
  if n!=1:ass.append(n)
  return ass
d=prime_factor(n)
from collections import Counter
ans=0
c=Counter(d)
for i in c:
  m=c[i]
  mm=1
  while mm<=m:
    m-=mm
    mm+=1
    ans+=1
print(ans)
# Judge status: Accepted
from decimal import *

a, b = map(float, input().split())

a = Decimal(str(a))
b = Decimal(str(b))
b *= Decimal(str(100))
ans = a * b
ans //= Decimal(str(100))

print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split(' ')))
b = [a[i] + i for i in range(n)]
c = [j - a[j] for j in range(n)]
d = dict()
ans = 0
for i in range(n):
  if d.get(b[i]) is None:
    d.setdefault(b[i],1)
  else:
    d[b[i]] += 1
  if d.get(c[i]) is not None:
    ans += d[c[i]]
print(ans)
# Judge status: Wrong Answer
N = int(input())
r = set()
for i in range(N):
    r |= set(input())

print(len(r))
# Judge status: Accepted
N = int(input())

n = N
for i in range(1000):
    if str(n)[0] == str(n)[1] == str(n)[2]:
        ans = n
        break
    n += 1

print(ans)
# Judge status: Wrong Answer
a=list(map(int,input().split()))
a.sort()
mid=1
ans=10**9
for i in range(2):
  mid*=a[i]
  
for i in range(a[-1]//2-1,a[-1]//2+1):
  b=mid*i
  c=mid*(a[-1]-i)
  sa=abs(b-c)
  if ans>sa:
    ans=sa
print(ans)
# Judge status: Accepted
def main():
	x, n = map(int, input().split())
	P = list(map(int, input().split()))
	if n == 0:
		print(x)
		return
	ans = 0
	min_dis = 1000
	for item in range(102):
		if item in P:
			continue
		dis = abs(item - x)
		if min_dis > dis:
			min_dis = dis
			ans = item
	print(ans)
	return

if __name__ == "__main__":
	main()
# Judge status: Accepted
n, k = map(int,input().split())
A = list(map(int, input().split()))
for i in range(n-k):
    print('Yes' if A[i+k]>A[i] else 'No')
# Judge status: Accepted
a,b=map(int,input().split())
s=0
for i in range(b-a):
    s+=i
print(s-a)
# Judge status: Wrong Answer
def func(tmp):
  print(tmp)
  ans = ''
  sub_ans = tmp/26
  if sub_ans >0:
    ans += func(int(sub_ans))

  ans += chr(96 + int(tmp)%26)
    
  return ans

  
tmp = int(input())
print(func(tmp)[1:])
# Judge status: Accepted
from collections import Counter

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

P = []
Q = []

for i in range(N):
    P.append(i + 1 + A[i])
    Q.append(i + 1 - A[i])

P = Counter(P)
Q = Counter(Q)

res = 0

for v, c in P.items():
    if v in Q:
        res += c * Q[v]

print(res)
# Judge status: Wrong Answer
n = int(input())
x = n*800
y = n//15
print(x-y)
# Judge status: Accepted
a, b = input().split()
c = int(a + b)
ans = 1

if int(c ** 0.5) ** 2 == c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
print(N//11*2+(N%11+5)//6)
# Judge status: Accepted
import math

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

n,p = map(int, input().split())
a = list(map(int, input().split()))
res = 0

for i in range(n):
  a[i] = a[i]%2

for i in range((a.count(1)+1)//2):
  res = res + comb(a.count(1), 2*i+1)
if res == 0 and p == 0:
  res = 1
res = res * 2**a.count(0)
print(res)
# Judge status: Accepted
n, k = map(int, input().split())
h = list(map(int, input().split()))

if k >= n:
  print(0)
else:
  h.sort()
  count = 0
  for _ in range(len(h) - k):
    count += h[_]
  print(count)
# Judge status: Accepted
n = int(input())
s = input()
t = input()

if s == t:
	print(n)
	exit()

maxl = 0
for i in range(n):
	sub_s = s[n-i-1:]
	sub_t = t[:i+1]
	if sub_s == sub_t:
		maxl = max(maxl, i + 1)

print(2 * n - maxl)
# Judge status: Wrong Answer
import collections
S=list(str(input()))
cc=collections.Counter(S)

if cc['S']*cc['N']==0:
    print('No')
elif  cc['E']*cc['W']==0:
        print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
N, X, Y = map(int, input().split())

d = [[-1 for n in range(N)] for n in range(N)]
for i in range(N):
  for j in range(i + 1, N):
    d[i][j] = min([abs((i + 1) - (j + 1)), abs(X - (i + 1)) + 1 + abs(Y - (j + 1)), abs(Y - (i + 1)) + 1 + abs(X - (j + 1))])

answer = [0 for n in range(N - 1)]
for i in range(N):
  for j in range(N):
    if d[i][j] != - 1:
      answer[d[i][j] - 1] += 1
print(answer)
for i in range(len(answer)):
  print(answer[i])
# Judge status: Accepted
a,b,c = map(lambda x:int(x),input().split())
reps = 0
while a%2==0 and b%2==0 and c%2==0:
  if (a==b==c):
    reps = -1
    break
  at=a
  bt=b
  ct=c
  a = int(bt/2+ct/2)
  b = int(at/2+ct/2)
  c = int(at/2+bt/2)
  reps += 1
print(reps)
# Judge status: Accepted
N,M = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]
A = sorted(AB,key=lambda x:x[0])
ans = 0

for i in range(N):
    buy = min(M,A[i][1])
    ans += buy * A[i][0]
    M -= buy
print(ans)
# Judge status: Accepted
from collections import Counter 
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
input_list = lambda : list(map(int,input().split()))

n=int(input())

a=[]
for j in range(n):
    v,i=input().split()
    i=int(i)
    a.append([v,i,j])
a.sort(key=lambda x:(x[0],-x[1]))
for each in a:
    print(each[2]+1)
# Judge status: Accepted
a, b = map(int, input().split())

N = b - a
print((N * (N + 1) // 2) - b)
# Judge status: Wrong Answer
#D
a,b,n = map(int,input().split())

print(min(n,b-1))
# Judge status: Accepted
A,B,M = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
xyc = [list(map(int,input().split())) for _ in range(M)]
pay = 0
min_pay = 0
for i in range(M):
  pay = a[xyc[i][0]-1] + b[xyc[i][1]-1] - xyc[i][2]
  if i == 0:
    min_pay = pay
  min_pay = min(min_pay,pay)
min_pay = min(min_pay,min(a)+min(b))
print(min_pay)
# Judge status: Wrong Answer
N,x = map(int,input().rstrip().split(" "))
ans = 0
A = list(map(int,input().rstrip().split(" ")))
for i in range(N -1):
    k = max(A[i] + A[i + 1] - x,0)
    ans += k
    A[i+1] -= k
print(ans)
# Judge status: Accepted
N=int(input())
A=[0]*5
for i in range(5):
  A[i]=int(input())

print(-(-N//min(A))+4)
# Judge status: Wrong Answer
S = input()
ec = 0
c = {}
for each in S:
    try:
        c[each] += 1
        if c[each] % 2 == 0:
            ec -= 1
        else:
            ec += 1
    except:
        c[each] = 1
        ec += 1
if (ec == 0):
    print("YES")
else:
    print("NO")
# Judge status: Accepted
h,n=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(n)]
inf=10**9
dp=[inf]*(h+10**5)
dp[0]=0
#dp[i]=モンスターの体力をi減らすのに魔力が最低でいくつ必要か
for i in range(h):
    for a,b in l:
        dp[i+a]=min(dp[i+a],dp[i]+b)
ans=10**9
for i in range(10**5):
    ans=min(ans,dp[i+h])
print(ans)
# Judge status: Wrong Answer
x = int(input())

deposit = 100
year = 0

while deposit < x:
    deposit = int(deposit * 1.01)
    year += 1

print(year)
# Judge status: Wrong Answer
def resolve():
    S = list(input())

    ans = 0
    for i in range(1, len(S)):
        if (S[i - 1] == S[i]):
            ans += 1

            if S[i] == '0':
                S[i] = '1'
            else:
                S[i] = '0'

    print(ans)
# Judge status: Accepted
from math import factorial
import copy
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
Mp = copy.copy(P)
Mq = copy.copy(Q)
Lp = 0
Lq = 0
for i in range(N):
  if P[i] == min(Mp) and i != N:
    Mp.remove(P[i])
  else:
    Lp += factorial(len(Mp)-1)*(sum(x<P[i] for x in Mp))
    Mp.remove(P[i]) 
  if Q[i] == min(Mq) and i != N:
    Mq.remove(Q[i])
  else:
    Lq += factorial(len(Mq)-1)*(sum(x<Q[i] for x in Mq))
    Mq.remove(Q[i])
print(abs(Lp-Lq))
# Judge status: Wrong Answer
s=input()
print("Sunny" if s=="Rainy" else "Cloud" if s=="Sunny" else "Rainy")
# Judge status: Accepted
from collections import Counter
n=int(input())
s=[Counter(list(input())) for _ in range(n)]
c=s[0]
for i in range(1,n):
  c&=s[i]
ans=''
for i in sorted(c.items(),key=lambda x:x[0]):
  ans+=i[0]*i[1]
print(ans)
# Judge status: Wrong Answer
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [i-1 for i in A]

loc = 0
history = []

for current_idx in range(K):
    loc = A[loc]
    if loc in history:
        hist_idx = history.index(loc)
        syuuki = current_idx - hist_idx
        loc = history[hist_idx + ((K - current_idx) % syuuki)]
        break
    history.append(loc)
        
print(loc+1)
# Judge status: Wrong Answer
d, t, s = map(int, input().split())

time = d/s

if t > time:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
# coding: utf-8
#n = int(input())
x, y = map(int,input().split())
#A = list(map(int,input().split()))
#ans = 0
ans = 0

if x < y:
    ans += abs(abs(x)-abs(y))
else:
    if x<0 and y<0:
        ans += abs(abs(x)-abs(y)) + 2
    elif x>0 and y<0:
        ans+=1
        ans+=abs(abs(x)-abs(y))
    elif x>0 and y>0:
        ans+=1
        ans+=abs(x+y)
    else:
        ans = abs(x-y)
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())
if n>=2 and m>=2:
    print((m-2)*(n-2))
elif n==1:
    if m==1:
        print(1)
    else:
        print(m-2)
elif m==1:
    if n==1:
        print(1)
    else:
        print(n-2)
# Judge status: Wrong Answer
from itertools import permutations
Q, H, S, D = map(int, input().split())
N = int(input())

ans = 0
s = [(Q, 0.25), (H, 0.5), (S, 1.0), (D, 2.0)]

ans = float("inf")
for x in permutations(s):
    tmp = 0
    n = N
    for a, b in x:
        tmp += (n // b)*a
        n %= b
    ans = min(ans, tmp)
print(int(ans))
# Judge status: Wrong Answer
import math
n, d = map(int, input().split())
xy = [list(map(int, input().split())) for _ in range(n)]
print(xy)
count = 0

for i in range(n):
    count = count + 1 if math.sqrt(xy[i][0]**2 + xy[i][1]**2) <= d else count

print(count)
# Judge status: Wrong Answer
list=[1, 1, 1, 1, 1]
for i in range(1, 7):
  list.append(6**i)
for j in range(1, 7):
  list.append(9**i)
# Judge status: Wrong Answer
S=input()
if("AAA"==S or S=="BBB"):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a<=k:
  print("Yay!")
else:
  print(":(")
# Judge status: Accepted
S = str(input())
num = len(S) // 2
ans = 0

for i in range(num):
  if S[i] != S[-1-i]:
    ans += 1
  else:
    pass
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    A, B = map(int, input().split())
    print((A + B) % 24)


if __name__ == "__main__":
    main()
# Judge status: Accepted
S = [input() for n in range(int(input()))]
for s in ["AC","WA","TLE","RE"]:
  print(s,"x",S.count(s))
# Judge status: Accepted
n, m, x, y = map(int, input().split())
xn = list(map(int, input().split()))
ym = list(map(int, input().split()))

xn = max(xn)
ym = min(ym)

for z in range(x+1,y+1):
    if xn< z <=ym:
        print('No War')
        exit()
print('War')
# Judge status: Accepted
a = list(map(int,input().split()))

a.sort()

if a[2] == 0:
    print(0)
    exit()
m = a[0]*a[1]
n = a[2]//2
print(abs(m*n-m*(a[2]-n)))
# Judge status: Wrong Answer
n = int(input())
if n % 2 == 1:
    print(n * (n // 2))
else:
    print((n * n - n) / 2)
# Judge status: Accepted
n = int(input())
s = input()
x = 0

for i in range(1, n):
    a,b = set(s[:i]), set(s[i:])
    if max(len(a),len(b))-max(len(a-b),len(b-a))>x:
        x = max(len(a),len(b))-max(len(a-b),len(b-a))

print(x)
# Judge status: Accepted
from math import sqrt
n=int(input())
t=0
i=2
while i*i<=n:
  if n%i==0:
    c=0
    while n%i==0:
      n//=i
      c+=1
    t+=(int(sqrt(8*c+1))-1)//2
  i+=1
if n>1:
  t+=1
print(t)
# Judge status: Wrong Answer
S=list(input())
s=0 #取り除いたキューブの数
i=0 
while len(set(S))!=len(S):
  if S[i]==S[i+1]==0 or S[i]==S[i+1]==1:
    s=s
    i+=1
  else:
    s+=2
    del S[i:i+2]
    i=0
print(s)
# Judge status: Wrong Answer
C = input()
letters = "abcdefghijklmnopqrstuvwz"
list_letters = list(letters)
print(list_letters[letters.find(C)])
# Judge status: Wrong Answer
from collections import Counter
n=int(input())
cnt=0
ans=[]
for i in range(2,int((2*n)**0.5)+1):
    for j in range(2,int((2*n)**0.5)+1):
        for k in range(2,int((2*n)**0.5)+1):
            if (i*i + j*j + k*k)%2==0 and (i*i + j*j + k*k)<=2*n and (i+j-k>1) and (i+k-j>1) and (k+j-i>1):
                ans.append((i*i + j*j + k*k)//2)
ans.sort()
A=Counter(ans)
for i in range(n):
    print(A[i])
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())

#高橋　→　青木
# takahashi = a // d
# aoki = c // b


# if takahashi  <= aoki:
#     print('Yes')
# else:
#    print('No')

takahashi = a
aoki = c

for _ in range(100):
    takahashi -= d
    aoki -= d
    if takahashi <= 0:
        print('No')
        break
    elif aoki <= 0:
        print('Yes')
        break
# Judge status: Wrong Answer
from bisect import bisect_left

n=int(input())
a=list(map(int,input().split()))
a.sort()

maxi=a[-1]
tmp=maxi//2
idx=bisect_left(a,tmp)
if idx==n-1:
  idx -=1

print(maxi,a[idx])
# Judge status: Wrong Answer
X=input()
ans = len(X)
def chk(X,a,b):
    if X[a]=="S" and X[b]=='T':
        return chk(X,a-1,b+1)+2
    else:
        return 0
for i in range(len(X)-1):
    ans -= chk(X,i,i+1)
print(ans)
# Judge status: Wrong Answer
X,Y = map(int,input().split())

#2z + 4(X-z) = Y
#-2z = Y - 4X
z = 2*X - 0.5*Y

if(0 < z and z.is_integer()):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
n, m = map(int, input().strip().split())
ans = n * (n - 1) // 2 + m * (m - 1) // 2
print(ans)
# Judge status: Wrong Answer
N , K =map(int,input().split())
A_n =list(map(int,input().split()))

zero = [0 for i in range(N)]
for i in range(min(K,41)):
    B_n = zero
    for j in range(N):
        B_n[max(0 ,j -A_n[j]):min(N ,j + A_n[j]+1)] = map(lambda x : x+1,B_n[max(0 ,j -A_n[j]):min(N ,j + A_n[j]+1)])
    A_n = B_n
print(" ".join(map(str,B_n)))
# Judge status: Accepted
N = int(input())
l = list(map(int,input().split()))

S = sum(l)

M = max(l)

if S - M > M:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, k = map(int, input().split())
S = list(input())

S[k - 1] = S[k - 1].lower()
print("".join(S))
# Judge status: Wrong Answer
S = int(input())
i = 0
ans = 0
mod = 10 ** 9 + 7
    
def comb(n, k):
  de = 1
  nu = 1
  for i in range(k):
    de *= (n - i) % mod
    nu *= (i + 1) % mod
  nu = pow(nu, -1, mod)
  return de * nu
  
while 1:
  S -= 3
  if S <= 0:
    if S == 0:
      S += 1
    print(ans)
    exit()
  ans += comb(S+i, i)
  ans = ans % mod
  i += 1
# Judge status: Accepted
n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print(''.join(s))
# Judge status: Accepted

def gcd(x, y):
  #assert x >= y
  return gcd(y, x%y) if y else x
 

N, X = [int(i) for i in input().split()]
Xn = [int(i) for i in input().split()]

dx =[abs(x-X) for x in Xn]

gcd_num = dx[0]
for x in dx:
  a, b = (gcd_num, x) if gcd_num > x else (x, gcd_num)
  gcd_num = gcd(a, b)
print(gcd_num)
# Judge status: Wrong Answer
N, M, X, Y = map(int, input().split())
X = [int(i) for i in input().split()]
Y = [int(i) for i in input().split()]

if min(Y) - max(X) > 1:
    print("No War")
else:
    print("War")
# Judge status: Wrong Answer
S=list(input())
l=sorted(list(set(S)))
for (i,j) in zip(range(len(l)),range(97,97+26)):
        if chr(j) !=l[i]:
            print(chr(j))
            exit()
        elif chr(j) == 'z':
            print('None')
            exit()
print('None')
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
l=[]
for i in range(N):
    if A[i]%2==0:
        l.append(A[i])
flag=True
for i in range(len(l)):
    if l[i]%3==0 or l[i]%5==0:
        pass
    else:
        flag=False
if flag:
    print("APPROVED")
else:
    print("DENIED")
# Judge status: Wrong Answer
from bisect import bisect

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
R_B = [0]*(M+1)
i = 0
while i < M:
  R_B[i+1] = R_B[i]+B[i]
  i += 1 
ans = 0
i = 0
while i < N and K >= A[i]:
  K -= A[i]
  idx = bisect(R_B, K)
  ans = max(ans, i+idx)
  R_B = R_B[:idx+1]
  i += 1
print(ans)
# Judge status: Wrong Answer
def chmin(a, b): return b if a > b else a


def chmax(a, b): return a if a > b else b


"""もらうDP"""
import math

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

dp = list([math.inf for i in range(N)])  # dpテーブル
dp[0] = 0
for i in range(N):
    dp[i] = chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]))
    if i > 1:
        dp[i] = chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]))

print(dp[N-1])
print(dp)
# Judge status: Wrong Answer
x, a, b = map(int, input().split())
if abs(a - x) >= abs(b - x):
  print('A')
else:
  print('B')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
amax = max(a)
ans = 0
numlist = [0] * amax

for i in range(n):
    if numlist[a[i]-1] != 0:
        numlist[a[i]-1] = 2
        continue
    else:
        for j in range(1, amax // a[i] + 1):
            numlist[a[i] * j - 1] += 1
for i in range(n):
    if numlist[a[i]-1] == 1:
        ans += 1
        
print(ans)
# Judge status: Accepted
##C
X = int(input())
##素数かどうか判定
from math import sqrt
def is_prime(n):
    for i in range(2, int(sqrt(n))):
        if n % i == 0:
            return False
    else:
        return True

while (not is_prime(X)):
    X += 1

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

gcd_list = []
i = 1
while i < a ** (1/2)+1:
    if a % i == 0 and b % i == 0:
        j = 2
        appender = True
        while j <= i ** (1/2):

            if i % j == 0:
                appender = False
                break
            j += 1
        
        if appender: gcd_list.append(i)
            
    i += 1

print(len(gcd_list))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

ans = [0]*N
for a in A:
    ans[a-1] += 1

for i in ans:
    print(i)
# Judge status: Accepted
A, B, K = map(int, input().split())
candidate1 = [i for i in range(A, A+K) if i <= B]
candidate2 = [i+1 for i in range(B-K, B) if i+1 >= A]

ans = list(sorted(list(set(candidate1+candidate2))))
ans = [str(ans[i]) for i in range(len(ans))]

print('\n'.join(ans))
# Judge status: Accepted
x,y,z = input().split()
if x == y and x == z:
    print("No")
elif x == y or y == z or x == z:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
X = int(input())

happiness = 0
if X > 1000:
    happiness += (X//1000)*2*1000
    X = X%1000
happiness += (X//5)*5

print(happiness)
# Judge status: Accepted
S = input()

ans = 0
if S[0] == '0':
    ans += S[2::2].count('1')
    ans += S[1::2].count('0')
else:
    ans += S[2::2].count('0')
    ans += S[1::2].count('1')

print(ans)
# Judge status: Wrong Answer
import fractions
n = int(input())
l = list(map(int,input().split()))
if n == 2:
    print(max(l))
    exit()
l.sort()
ans = fractions.gcd(l[0],l[1])
for i in range(2,n):
    ans1 = fractions.gcd(ans,l[i])
    if ans1 < ans:
        print(ans)
        exit()
print(max(fractions.gcd(l[0],l[-1]),fractions.gcd(l[1],l[-1])))
# Judge status: Accepted
print("YES" if list(input())==list(reversed(list(input()))) else "NO")
# Judge status: Accepted
from collections import Counter

n=int(input())
a=Counter(list(map(int,input().split())))
q=int(input())
sm=0
for x in a:
    sm+=x*a[x]

for i in range(q):
    b,c=map(int,input().split())
    if b in a:
        a[c]+=a[b]
        sm+=(c-b)*a[b]
        a[b]=0
    print(sm)
# Judge status: Accepted
S=input()
T=input()
a='No'
for i in range(len(T)):
  if T[i:]+T[:i]==S or T[:i]+T[i:]==S:
    a='Yes'
    break
print(a)
# Judge status: Accepted
mod = 10**9 + 7

n, m = map(int, input().split())
fib = [1] * (n+1)
for i in range(2, n+1):
  fib[i] = (fib[i-1] + fib[i-2]) % mod
count = 1
start = 0
for _ in range(m):
  a = int(input())
  stop = a-1
  if start > stop:
    count = 0
    break
  count = count * fib[stop - start] % mod
  start = a+1
stop = n
count = count * fib[stop - start] % mod
print(count)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    s=input()
    cnt=0
    for i in range(len(s)//2):
        if s[i]!=s[-1-i]:
            cnt+=1
    print(cnt)
resolve()
# Judge status: Wrong Answer
N = int(input())
a = sorted(list(map(int,input().split())))[::-1]
print(sum(a[::2])-sum(a[1::2]))
# Judge status: Wrong Answer
N = int(input())
for s in range(N):
    s = list(input().split())
    
print('AC','x',s.count('AC'))
print('TLE','x',s.count('TLE'))
print('WJ','X',s.count('WJ'))
print('RE','X',s.count('RE'))
# Judge status: Accepted
from collections import Counter as C

_, k = map(int, input().split())
a = [int(i) for i in input().split()]

c = C(a).values()
d = len(c) - k
if 0 < d:
    print(sum(sorted(c)[:d]))
else:
    print(0)