peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
A,B,C = map(int,input().split())
if A%2 == B%2 == C%2 ==1:
    print(A*B*C//max(A,B,C))
else:
    print(0)
# Judge status: Accepted
x, y = map(int, input().split())

dic = {'A': [1, 3, 5, 7, 8, 10, 12], 'B': [4, 6, 9, 11], 'C': [2]}

gx = 0
gy = 0
for key, value in dic.items():
    if x in value:
        gx = key
    if y in value:
        gy = key
ans = 'Yes' if gx == gy else 'No'
print(ans)
# Judge status: Accepted
N,K=map(int,input().split())
A=list(map(int,input().split()))

s=(N-K)
print(s//(K-1) + (s%(K-1)>=1)*1 + 1)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans1=sum(b)
ans2=0
for i in range(n-1):
    if a[i+1]-a[i]==1:
        ans2+=c[a[i]-1]
print(ans1+ans2)
# Judge status: Accepted
import sys
readline = sys.stdin.readline

def main():
  N = int(readline())
  line = readline().split()
  R = {}
  L = {}
  for i in range(N):
    r = int(line[i]) + i + 1
    l = i + 1 - int(line[i])
    if r in R:
      R[r] += 1
    else:
      R[r] = 1
    if l in L:
      L[l] += 1
    else:
      L[l] = 1
  cnt = 0
  for i in R:
    if i in L:
      cnt += R[i] * L[i]
  print(cnt)
  
if __name__ == '__main__':
  main()
# Judge status: Accepted
# -*- coding: utf-8 -*-
# 整数の入力
s = input()

words = ["dream", "dreamer", "erase", "eraser"]

def check():
    tmp = s
    while(True):
      current_len = len(tmp)
      for w in words:
        if tmp.endswith(w):
          tmp = tmp[:-len(w)]
      if len(tmp) == 0:
          return "YES"

      if current_len == len(tmp):
          return "NO"

print(check())
# Judge status: Accepted
#ABC 164B

a, b, c, d = list(map(int, input().split()))

while True:
    c -= b
    if c<=0:
        print('Yes')
        exit()
    a -= d
    if a<=0:
        print('No')
        exit()
# Judge status: Wrong Answer
s = input()
ans = ""
for i in range(len(s)):
  if s[i] == 'B' and len(ans) != 0:
    ans = ans[0:len(ans)]
  else:
    ans += s[i]
    
print(ans)
# Judge status: Accepted
from collections import deque

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

cur = 1
d = deque([S])

for _ in range(Q):
    ins = input().split()
    if len(ins) == 1:
        cur = 2 if cur == 1 else 1
    else:
        _, f, c = ins
        f = int(f)
        if cur == f == 1 or cur == f == 2:
            d.appendleft(c)
        else:
            d.append(c)

if cur == 1:
    print("".join(d))
else:
    temp = "".join(d)
    print(temp[::-1])
# Judge status: Wrong Answer
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key = lambda x:x[1])

c = sum([i for i,j in ab])
abmax = max([j for i,j in ab])

ab.reverse()
ans = "Yes"
x = c + 0
for i,j in ab:
    x -= i
    if x <= j:
        continue
    else:
        ans = "No"
        break

print(ans)
# Judge status: Accepted
n = int(input())

ans = 0

for i in range(n):
    if (i+1)%3 != 0 and (i+1)%5 !=0:
        ans = ans + i +1
print(ans)
# Judge status: Accepted
S = int(input())
if S==1 or S==2:
    print(0)
else:
    dp = [0 for S in range(S+1)]
    dp[0]=1
    for i in range(3,S+1):
        dp[i]=sum(dp[:i-2])
    dp = list(map(lambda x:x%1000000007,dp))
    print(dp[S])
# Judge status: Accepted
from sys import stdin
input = stdin.readline
 
from itertools import accumulate
from bisect import bisect_left
 
N, K = map(int, input().split())
 
memo = [0] * 100010
for _ in range(N):
    a, b = map(int, input().split())
    memo[a] += b
 
print(bisect_left(list(accumulate(memo)), K))
# Judge status: Accepted
s = input()
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        print('Bad')
        exit()
print('Good')
# Judge status: Wrong Answer
N=int(input())
S=input()
print(S[N:len(S)]+S[-len(S):-len(S)+N])
# Judge status: Accepted
h, w = [int(i) for i in input().split()]
 
if h == 1 or w == 1:
  print(1)
elif h % 2 == 0:
  print((h // 2) * w)
else:
  if w % 2 == 0:
    print((w // 2) * h)
  else:
    print((w//2 + 1) * (h//2 + 1) + (w//2) * (h//2))
# Judge status: Wrong Answer
n=int(input())
ans=0
l=[x for x in range(1,n+1)]
for i in range(1,n+1):
  z=i
  for j in range(0,n,i):
    ans+=z
    z+=i
print(ans)
# Judge status: Wrong Answer
N = int(input())

num = N%1000 + N//1000

print("ABD"+str(num))
# Judge status: Accepted
from collections import Counter

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

l = []
counter = 0

for k in range(K):
    d = int(input())
    A = map(int, input().split())
    l.extend(A)

for i in range(1,N+1):
    if Counter(l)[i]==0:
        counter += 1
    else:
        continue

print(counter)
# Judge status: Accepted
n = int(input())
w = list(map(int, input().split()))

w_sort = sorted(w)
# print(w_sort)

min_abs = 9999999999
for i in range(1, n):
    w1 = w[0:i]
    w2 = w[i:]
    
    # print(w1)
    # print(w2)
    
    abs_w1w2 = abs(sum(w1) - sum(w2))
    if abs_w1w2 < min_abs:
        min_abs = abs_w1w2
        
print(min_abs)
# Judge status: Accepted
N = int(input())
H = list(map(int,input().split()))

maxh = 10 ** 10
for i in range(len(H) - 1, -1, -1):
  if H[i] > maxh + 1:
    print("No")
    break
  if H[i] == maxh + 1:
    maxh = H[i] - 1
  else:
    maxh = H[i]
else:
  print("Yes")
# Judge status: Wrong Answer
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [1e7]*N
dp[0] = 0

for i in range(1, N):
    for j in range(1, K+1):
        if i-j >= 0:
            dp[i] = min(dp[i], dp[i-j]+abs(h[i]-h[i-j]))

print(dp[-1])
# Judge status: Accepted
def main():
    n = int(input())
    for i in range(n, 1000):
        if len(set(list(str(i)))) == 1:
            print(i)
            exit()


main()
# Judge status: Wrong Answer
a1 = [int(x) for x in input().split()]
a2 = [int(x) for x in input().split()]
a3 = [int(x) for x in input().split()]
n = int(input())
b = []
for _ in range(n):
    b.append(input())
res = 0
for x in b:
    if int(x) in a1 or int(x) in a2 or int(x) in a3:
        res+=1
if res>=3:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
def main():
    N, K = map(int,input().split())
    AB = [list(map(int,input().split())) for _ in range(N)]
    S = []
    for ab in AB:
        for _ in range(ab[1]):
            S.append(ab[0])
    print(S[K-1])
            

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b = map(int,input().split())
cnt = 0
for i in range(b-a):
    c = str(a+i)
    if c[0]==c[4] and c[1]==c[3]:
        cnt += 1
print(cnt)
# Judge status: Accepted
# -*- coding: utf-8 -*-
H, A = map(int, input().split())
ans = H // A
if H % A == 0:
  print(ans)
else:
  print(ans + 1)
# Judge status: Accepted
n=int(input())
hon=[2,4,5,7,9]
pon=[0,1,6,8]
if n%10 in hon:
    print('hon')
elif n%10 in pon:
    print('pon')
else:
    print('bon')
# Judge status: Accepted
a, b = map(int, input().split())
S = input()

if "-" in S[:a] or  "-" in S[a+1:]:
    print("No")
elif "-" == S[a]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import math
n = int(input())
for i in range(n, 2**n):
  cnt = 0
  for j in range(2, n):
    if i%j==0:
      cnt += 1
  if cnt ==0:
    print(i)
    break;
# Judge status: Accepted
x, y = map(int, input().split())

ans = 0

while x <= y:
    x *= 2
    ans += 1

print(ans)
# Judge status: Accepted
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product

def resolve():
    n=int(input())
    print('Yes' if n in [4*x+7*y for x in range(101) for y in range(101)] else 'No')


resolve()
# Judge status: Wrong Answer
H, _ = map(int, input().split(" "))
print("Yes" if sum(map(int, input().split(" "))) <= H else "No")
# Judge status: Accepted
s = input()
ans = ""
for i in s:
  if i == "B":
    ans = ans[:-1]
  else:
    ans += i
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
ans = []
for i in range(n):
  if i%2 == 0:
    ans.append(a[i])
  else:
    ans.insert(0,a[i])
if n%2 == 0:
  pass
else:
  ans[::-1]
for an in ans:
  print(an,end=' ')
# Judge status: Accepted
a,b,c = map(int, input().split())

A = [a,b,c]
A.sort()
if A[0]+A[1] == A[2]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

x, y = 0, 0
for i in range(n):
    dif = b[i] - a[i]
    if dif > 0:
        x += dif // 2
    else:
        y += -dif

print("Yes" if x >= y else "No")
# Judge status: Accepted
# input
a_n, b_n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [input().split() for i in range(m)]

# calc
min_price = min(a) + min(b)
for p in x:
   tmp_price = int(a[int(p[0])-1]) + int(b[int(p[1])-1]) - int(p[2])
   if tmp_price < min_price:
       min_price = tmp_price
print(min_price)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
N = int(input())
print((N // 10) ** 2 + N % 10 + 8)
# Judge status: Accepted
from math import gcd
def division(n):
    if n < 2:
        return [1]
    prime_factors = [1]
    for i in range(2,int(n**0.5)+1):
        while n % i == 0:
            prime_factors.append(i)
            n //= i
    if n > 1:
        prime_factors.append(n)
    return prime_factors

a,b = map(int,input().split())
d = set(division(gcd(a,b)))
print(len(d))
# Judge status: Wrong Answer
S = int(input())
x,y = 10**9,1

if S > 10**9:
    print(0,0,x,y,10**18-S,10**9)
else:
    print(0,0,x,y,S,0)
# Judge status: Wrong Answer
X = int(input())

if X < 1000:
  print('ABC' + str(X).zfill(3))
else:
  X = X % 999
  print('ABD' + str(X).zfill(3))
# Judge status: Accepted
n,a,b = [int(i) for i in input().split()]
if (b - a)%2:
  print((b-a)//2 + 1 + min(a-1,n-b))
else:
  print((b-a)//2)
# Judge status: Accepted
a,b=map(int,input().split())
if b==100:
  b+=1

print(b*(100**a))
# Judge status: Accepted
n = input()
dp = [0, 10000]
for d in map(int, reversed(n)):
    dp = [min(d + dp[0], d + 1 + dp[1]), min(10 - d + dp[0], 9 - d + dp[1])]
print(min(dp[0], 1 + dp[1]))
# Judge status: Accepted
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("Bob")
else:
    print("Draw")
# Judge status: Accepted
N = int(input())
B = list(map(int,input().split()))

A = [0]*N
A[0] = B[0]
A[-1] = B[-1]

for i in range(1,N-1):
    A[i] = min(B[i-1],B[i])
    
print(sum(A))
# Judge status: Accepted
import fractions
def lcm(x, y):
  return (x * y) // fractions.gcd(x, y)

A,B,C,D=map(int,input().split())
E=lcm(C,D)

tmp1 = B//C-A//C
if A%C==0:
  tmp1 +=1

tmp2 = B//D-A//D
if A%D==0:
  tmp2 +=1

tmp3 = B//E-A//E
if A%E==0:
  tmp3 +=1

print((B-A+1)-tmp1-tmp2+tmp3)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
cnt = sum(b)
for i in range(n):
  if i<=n-2 and (a[i+1] - a[i] == 1):
    cnt += c[a[i]-1]
print(cnt)
# Judge status: Wrong Answer
N,M=list(map(int, input().split()))
K=M-2*N
if K>=0:
  print(N+K//3)
else:
  print(min(N, M//2))
# Judge status: Wrong Answer
N=int(input())
c=4
d=7
ans=0
ans2=0
ans3="No"
for i in range(15):
    ans=d*i
    if ans !=N:
        for j in range(26):
            ans2=ans+c*j
            if ans2==N:
                ans3="Yes"

    else :
        ans3="Yes"

print(ans3)
# Judge status: Wrong Answer
pi = 3.14159265

r = int(input())

x = r*r*pi

print(x)
# Judge status: Accepted
x = list(map(int, input().split()))

for i in range(5):
    if x[i] == 0:
        print(i + 1)
        break
# Judge status: Accepted
a,b = map(int,input().split())
if (a + b)%2 == 0:
    print((a+b)//2)
    
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
d = dict()
for i in a:
    if i not in d:
        d[i] = 1

    else:
        d[i] += 1
count = 0
for key, value in d.items():
    if int(key) > value:
        count += int(value)
    elif int(key) < value:
        count += value - int(key)

print(count)
# Judge status: Wrong Answer
L, R, d = map(int, input().split())
RL = R - L
if RL % 2 == 0:
    print(RL // d)
else:
    print((RL+1) // d)
# Judge status: Wrong Answer
a = int(input())
b = int(input())
c = int(input())
x = int(input())

c = 0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if (500 * i) + (100 * j) + (50 * k) == x:
                c = c + 1

print(c)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
A=[a,b,c]
A.sort()
print(A)
k=A[0]+(A[2]-A[1])
print(A[2]-A[1])
print(k)
if (A[2]-k)%2==0:
    print(A[2]-A[1]+(A[2]-k)//2)
else:
    print(A[2]-A[1]+(A[2]-k)//2+2)
# Judge status: Accepted
n, m, k = [int(i) for i in input().split()]
grid = [0]

# O(nm)

for i in range(n + 1):
    for j in range(m + 1):
        black = (i * m) + (n - 2 * i) * j
        if black == k:
            print("Yes")
            quit()
print("No")
# Judge status: Accepted
n,x = map(int,input().split())
a = list(map(int,input().split()))
ans = 0
if a[0] > x:
    ans = a[0]-x
    a[0] = x
for i in range(1,n):
    temp = a[i-1] + a[i]
    if temp > x:
        a[i] -= temp-x
        ans += temp-x
print(ans)
# Judge status: Wrong Answer
n=int(input())
A=list(map(int,input().split()))
cnt=0
for m in range(n):
    a=A[m]
    while a%2==0:
        cnt+=1
        a/=2
print(cnt)
# Judge status: Accepted
n, k = list(map(int, input().split(" ")))
ans = n % k
if ans > 0:
    print(1)
else:
    print(0)
# Judge status: Wrong Answer
x=int(input())
data=[x//100+1,x//101+1,x//102+1,x//103+1,x//104+1]
for i in range(data[0]):
  for j in range(data[1]):
    for k in range(data[2]):
      for l in range(data[3]):
        for m in range(data[4]):
          if (x-(100*i+101*j+102*k+103*l+104*m))%105==0:
            print(1)
            exit()
print(0)
# Judge status: Wrong Answer
from collections import Counter
S = input()
work = list(Counter(S).values())
a = work[0]
b = work[1] if len(work)>1 else 0
c = work[2] if len(work)>2 else 0
result = "YES"
if (a > b + 1 or a > c + 1):
    result = "NO"
print(result)
# Judge status: Accepted
S = input()
arr = [0]*(len(S) + 1)
cn = 0
for i in range(len(S)):
    if S[i] == "<":
        cn += 1
    else:
        cn = 0
    arr[i+1] = cn
cn = 0
for i in range(len(S)-1, -1, -1):
    if S[i] == ">":
        cn += 1
    else:
        cn = 0
    arr[i] = max(arr[i], cn)
# print(arr)
print(sum(arr))
# Judge status: Accepted
X,Y,Z=map(int,input().split())
t=X
X=Y
Y=t
t=X
X=Z
Z=t
print(X,Y,Z)
# Judge status: Accepted
def main():
    platform_count, jumping_power = [int(x) for x in input().split()]
    platforms = [int(x) for x in input().split()]
    dp = [0]
    for i in range(1, platform_count):
        indexes = (i - x for x in range(1, jumping_power + 1) if i - x >= 0)
        dp.append(
            min(abs(platforms[i] - platforms[before]) + dp[before]
                for before in indexes))
    print(dp[platform_count - 1])


if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b = map(int, input().split())
takahashi = a - 1
if b >= a:
    takahashi += 1
print(takahashi)
# Judge status: Wrong Answer
n = int(input())
s = str(input())
r, g, b = map(s.count, "RGB")
ans = r*g*b
for i in range(n-2):
    for j in range(i, n-1):
        k = 2*j - i
        if k < n and s[i] != s[j] != s[k]:
            ans -= 1
print(ans)
# Judge status: Accepted
a,b,h = (int(input()) for i in range(3))
print(((a+b)*h)//2)
# Judge status: Wrong Answer
n = int(input())
X = list(map(int, input().split()))
dist = 1000000000
d = 0
for i in range(X[0], X[n - 1]):
	for x in X:
		d += (x - i) * (x - i)
	if d < dist:
		dist = d
	d = 0
print(dist)
# Judge status: Wrong Answer
n = int(input())

ans = 0

ans += (n // 500)*1000
n -= 500*(n // 500)
ans += (n % 5)*5
print(ans)
# Judge status: Accepted
N,M=map(int,input().split())
A=0
PE=0
PRO=[[] for i in range(N)]
for i in range(M):
  P,S=input().split()
  P=int(P)-1
  PRO[P].append(S)
#print(PRO)
for i in range(N):
  tmp=0
  for j in range(len(PRO[i])):
    flag=False
    if PRO[i][j]=='AC':
      A+=1
      flag=True
    if PRO[i][j]=='WA':
      tmp+=1
    if flag:
      PE+=tmp
      break
print(A,PE)
# Judge status: Accepted
N,K = map(int,input().split())
cnt = [0]*(N-K+2)

cnt_all = 0
mod = 1000000007

for i in range(K,N+2):
    cnt[i-K] = i*N - i*(i-1) + 1

for i in range(N-K+2):
    cnt_all += cnt[i]

print(cnt_all % mod)
# Judge status: Wrong Answer
N, C, K = map(int, input().split())
bus_count = -1
waiting_count = 0
time_limit = -1
for _ in range(N):
    T = int(input())
    if time_limit < T:
        bus_count += 1
        waiting_count = 0
        time_limit = 0
    waiting_count += 1
    if waiting_count == 1:
        time_limit = T + K
    elif waiting_count == 3:
        bus_count += 1
        waiting_count = 0
        time_limit = 0
print(bus_count)
# Judge status: Accepted
S = input()

for i in range(1, len(S)):
    S = S[:-1]
    if len(S) % 2 == 1:
        continue
    if S[:len(S)//2] == S[len(S)//2:]:
        break

print(len(S))
# Judge status: Accepted
A, B, C, K = map(int, input().split())

m = A - B
n = B - A

if (K % 2 == 0):
    if m > 10**18:
        print('Unfair')
    print(m)
else:
    if (n > 10**18):
        print('Unfair')
    print(n)
# Judge status: Accepted
n = input()
n = n[::-1]
n += '0'
cnt = 0
tmp = 0
for i in range(len(n)):
    a = int(n[i])
    a += tmp
    if a == 5:
        cnt += a
        if int(n[i + 1]) >= 5:
            tmp = 1
        else:
            tmp = 0
    elif a < 5:
        cnt += a
        tmp = 0
    else:
        cnt += 10 - a
        tmp = 1
print(cnt)
# Judge status: Accepted
a, b, c = map(int, input().split())
print('Yes' if a+b>=c else 'No')
# Judge status: Wrong Answer
n=int(input())
a=[input() for i in range(n)]
t=max(a)
s=a.index(t)
a.pop(s)
u=max(a)
for i in range(n):
  if i==s:
    print(u)
  else:
    print(t)
# Judge status: Accepted
X = int(input())

if 400 <= X < 600:
    print(8)
elif 600 <= X < 800:
    print(7)
elif 800 <= X < 1000:
    print(6)
elif 1000 <= X < 1200:
    print(5)
elif 1200 <= X < 1400:
    print(4)
elif 1400 <= X < 1600:
    print(3)
elif 1600 <= X < 1800:
    print(2)
elif 1800 <= X < 2000:
    print(1)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if b*2==a+c:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n = int(input())
s = list(input())

ans = 0
for i in range(n-1):
  x = s[:i+1]
  y = s[i+1:]
  count = 0
  
  for j in range(len(x)):
    if x[j] in y:
      count += 1
  if ans <= count:
    ans = count
    
    
print(count)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N,K=map(int,input().split())
import numpy as np
hights=np.array(list(map(int,input().split())))
steps=np.array([10**10]*N)
steps[0]=0
for i in range(N-1):
    gaps=hights[i+1:i+K+1]-hights[i]
    gaps=np.abs(gaps)
    gaps+=steps[i]
    steps[i+1:i+K+1]=np.minimum(steps[i+1:i+K+1],gaps)
print(steps[-1])
# Judge status: Accepted
from collections import Counter

n = int(input())
A = list(map(int, input().split()))
q = int(input())

A_dic = Counter(A)
A_sum = sum(A)

for _ in range(q):
    b, c = map(int, input().split())
    tmp = A_dic[b]
    A_dic[c] += tmp
    A_dic[b] = 0
    A_sum += tmp * (c-b)
    print(A_sum)
# Judge status: Accepted
S = input()
T = input()
lenS = len(S)
lenT = len(T)
ans = "UNRESTORABLE"
for i in range(lenS-lenT,-1,-1):
    subS = S[i:i+lenT]
    for j in range(lenT):
        if subS[j] != T[j] and subS[j] != "?":
            break
    else:
        ans = S[:i]+T+S[i+lenT:]
        ans = ans.replace("?","a")
        break

print(ans)
# Judge status: Wrong Answer
n = int(input())
AB =[]
total = 0
ans = "Yes"

for i in range(n):
  ab = list(map(int,input().split()))
  AB.append(ab)
  
AB_sorted_second = AB.sort(key=lambda x: x[1])  

for i in range(n):
  if total <= AB[i][1]:
    total += AB[i][0]
  else:
    ans = "No"
    break
    
if total > AB[n-1][1]:
  ans = "No"

print(ans)
# Judge status: Accepted
n, w = map(int, input().split())
a = [[int(i) for i in input().split(" ")] for j in range(n)]
dp = [[0]*(w+1) for i in range(n+1)]
for i in range(1, n+1):
    w_, v_ = a[i-1]
    for j in range(1, w+1):
        if j < w_:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j-w_]+v_, dp[i-1][j])
print(dp[n][w])
# Judge status: Wrong Answer
n = input()

sum=0
for i in range(int(n)):
    if i%3 != 0 and i%5 != 0:
        sum+=i

print(sum)
# Judge status: Accepted
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = iil()

ans = 30

for i in A:
    num = i
    count = 0
    while num%2 == 0:
        num //=2
        count += 1
    ans = min(ans,count)

print(ans)
# Judge status: Accepted
import math
x,y=map(int,input().split())
ans=0
while x<=y:
    x*=2
    ans+=1
print(ans)
# Judge status: Wrong Answer

n = int(input())

x = []
for i in range(n):
    x1,y1=[int(i) for i in input().split()]
    x.append([x1,y1])

x.sort()

remove = 0
flag = True

while(1):
    flag = True
    
    for k in range(n-1):
      if (x[k+1][0] - x[k][0]) < x[k][1] + x[k+1][1] and x[k+1][0]>0 and x[k][0]>0:
        remove +=1
        x[k+1][0] = -1
       	flag =False
        k -=1

    if flag == True:
        break
    
print (n -remove)
# Judge status: Accepted
#!/usr/bin/env python3
import re
s = input()


while True:
    # s = re.sub('dream$|dreamer$|erase$|eraser$','',s)

    l = len(s)
    if s.rfind('dream') == l-5:
        s = s[:-5]
    elif s.rfind('dreamer') == l-7:
        s = s[:-7]
    elif s.rfind('erase') == l-5:
        s = s[:-5]
    elif s.rfind('eraser') == l-6:
        s = s[:-6]
    else:
        break
        
if len(s)==0:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
S = 0
for i in range(N):
    S ^= a[i]

ans = [0] * N

for i in range(N):
    ans[i] = S ^ a[i]

print(' '.join(map(str, ans)))
# Judge status: Accepted
from collections import Counter # 重複個数のカウント: Counter(num_list)

def main():
    n = int(input())
    num_list = list(map(int, input().split()))

    ans = 0

    count_dict = Counter(num_list)

    for k, v in count_dict.items():
        if k == v:
            continue
        if k < v:
            ans += v - k
        else:
            ans += v
            
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
ABC = list(map(int, input().split()))
K = int(input())

for _ in range(K):
    ABC[ABC.index(max(ABC))] *= 2
print(sum(ABC))
# Judge status: Accepted
mod = 10**9+7

n = int(input())
S = input()

alp = [chr(i) for i in range(97, 97+26)]

cnt = []
for a in alp:
    cnt.append(S.count(a))

ans = 1
for c in cnt:
    if c:
        ans *= (c+1)

print((ans-1)%mod)
# Judge status: Wrong Answer

a, b, x = map(int, input().strip().split())


def func(num1, num2, divide_num):
    ans = (num2 - num1) // divide_num
    if num1 % divide_num == 0:
        ans += 1

    print(ans)


func(num1=a, num2=b, divide_num=x)
# Judge status: Wrong Answer
n,m=map(int,input().split())
gakusei=[]
for i in range(n):
  gakusei.append(list(map(int,input().split())))
check=[]
for j in range(m):
  check.append(list(map(int,input().split())))

for i in range(0,n):
  minkyori=10*10
  keep=0
  for j in range(0,m):
    kyori=abs(gakusei[i][0]-check[j][0])+abs(gakusei[i][1]-check[j][1])
    if kyori<minkyori:
      minkyori=kyori
      keep=j+1
  print(keep)
# Judge status: Wrong Answer
from collections import deque
from collections import Counter
N, X, Y = map(int, input().split())

res = deque()

for x in range(1, N+1):
    for y in range(x + 1, N+1):
        res.append(min([abs(x-y), 1 + abs(X-x) + abs(Y-y), 1 + abs(Y-x) + abs(X-x)]))
resd = Counter(res)

for i in range(1, N):
    if i in resd:
        print(resd[i])
    else:
        print(0)
# Judge status: Accepted
k,x = map(int, input().split())
if k*500 < x:
    print('No')
else:
    print('Yes')