peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
if n<=2:print(1);exit()
ans=1
chk=0
left=0
while chk<n-2:
  if (l[left]-l[chk+1])*(l[chk+1]-l[chk+2])<0:ans+=1;chk+=2;left=chk
  else:chk+=1
print(ans)
# Judge status: Accepted
n = int(input())
w = list(map(int,input().split()))


for i in range(n):
    a = sum(w[:i+1])
    b = sum(w[i+1:])
    if i == 0:
        s = abs(a-b)
    else:
        if abs(a-b) < s:
            s = abs(a-b)

print(s)
# Judge status: Wrong Answer
n, p = map(int, input().split())
a = list(map(int, input().split()))

jug = True
for i in range(n):
    a[i] % 2 == 1
    jug = False
    break

if jug:
    if p == 0:
        print(2 ** n)
    elif P == 1:
        print(0)
else:
    print(2 ** (n - 1))
# Judge status: Accepted
n,m=map(int,input().split())
acount=0
wcount=0
a=[False]*n
w=[0]*n
for i in range(m):
  p,m=input().split()
  p=int(p)
  if m=="AC":
    if a[p-1]==False:
      acount+=1
      a[p-1]=True
  else:
    if a[p-1]==False:
      w[p-1]+=1
      
for i in range(n):
  if a[i-1]==1:
    wcount+=w[i-1]
    
print(acount,wcount)
# Judge status: Accepted
import collections
n=int(input())
A=list(map(int,input().split()))
if A[0]!=0:
  print(0)
  exit()
mod=998244353
C=[0]*n
for i in range(n):
  C[A[i]]+=1
ans=1
if C[0]!=1:
  print(0)
  exit()
for i in range(n-1):
  ans=ans*pow(C[i],C[i+1],mod)%mod
print(ans)
# Judge status: Wrong Answer
x= int(input())
y= [int(i) for i in input().split()]
z= [int(i) for i in input().split()]

a=int(y[0])
b=int(z[x-1])
t=0

ans=a+b
del y[0]
del z[x-1]

while t==0:
	if sum(y)==0 or sum(z)==0:
		t=1
	elif sum(y)>=sum(z):
		ans=ans+int(y[0])
		del y[0]
		del z[0]
	else:
		ans=ans+(sum(z))
		t=1

print(ans)
# Judge status: Wrong Answer
n=int(input())
A=list(map(int,input().split()))
A.append(A[0])
B=[]
C=[]

def xor(C):
  total=0
  for i in range(1,len(C)):
    total^=C[i]
  return total

for i in range(n):
  B.append(A[i]^A[i+1])

for i in range(1,100000):
  C.append(i)
  p=i
  for j in range(n-1):
    C.append(B[j]^p)
    p^=B[j]
  if xor(C)==A[0]:
    break
  else:
    C.clear()

print(C)
# Judge status: Wrong Answer
n = map(int, input().split())
alist = list(map(int, input().split()))
m = max(alist)
sbn = 10**10
for a in alist:
    if abs(m/2 - a) < sbn:
        ans = a
        sbn = abs(m/2 - a)
print(m, ans)
# Judge status: Accepted
A,B,C = map(int,input().split())
if A+B+C>21:
  ans = 'bust'
else:
  ans = 'win'
print(ans)
# Judge status: Wrong Answer
import math
import itertools

n = int(input())
mod = 0
if (n-1)%2 != 0:
    mod = 1

b = math.ceil((n-1)**0.5)
cnt = 0

for i in range(1,b+1):
    cnt += math.floor((n-1)/i)

print(cnt*2-n+mod)
# Judge status: Wrong Answer
lst = list(map(int, input().split()))
ans = 0

max_ = -1
argmax = None
for i in range(3):
    if lst[i] > max_:
        max_ = lst[i]
        argmax = i

lst.pop(i)
ans = int(str(max_) + '0')
for l in lst:
    ans += l
print(ans)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
num = 0
for i in range(len(p)):
  if p[i] != i+1:
    num += 1
if num < 2:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
from itertools import permutations

D = [int(input()) for _ in range(5)]
ans = 650

for d in list(permutations(D)):
  sum = 0
  for i in range(5):
    sum += d[i]
    if (i != 4):
      if D[i] % 10 > 0:
        sum += 10 - (D[i] % 10)
      else:
        sum += 0
  if sum < ans:    
    ans = sum

print(ans)
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for i in range(n)]
mx = max(a)
mxi = a.index(mx)
mx2 = a[:mxi] + a[mxi+1:]

for i in range(n):
    if i == mxi: print(mx2) 
    else: print(mx)
# Judge status: Accepted
import math
a,b=map(int,input().split())
print(math.ceil((b+a)/2))
# Judge status: Accepted
S_ = input()
T = input()
len_s, len_t = len(S_), len(T)
i = len_s - len_t
ans = "UNRESTORABLE"
while i != -1:
    isAns = True
    for j in range(len_t):
        if S_[i + j] != '?' and S_[i + j] != T[j]:
            isAns = False
            break
    if isAns:
        ans = S_[:i] + T + S_[i + len_t:]
        ans = ''.join([c if c != '?' else 'a' for c in ans])
        break
    i -= 1
print(ans)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
s=0
for i in range(N):
  if A[i]>=B[i]:
    s+=B[i]
  if A[i]<B[i]:
    if (B[i]-A[i])>=A[i+1]:
      s=s+A[i]+A[i+1]
    if (B[i]-A[i])<A[i+1]:
      s=s+B[i]
      A[i+1]=A[i+1]-(B[i]-A[i])
print(s)
# Judge status: Accepted
from collections import defaultdict
n = int(input())
d = defaultdict(int)
A = list(map(int,input().split()))

for a in A:
    if d[a] == 1:
        print('NO')
        exit()
    else:
        d[a] += 1

print('YES')
# Judge status: Accepted
n, m = map(int,input().split())
a = list(map(int, input().split()))
bc = []
for i in range(m):
    bc.append(list(map(int, input().split())))

a.sort()
bc = sorted(bc, key=lambda x:x[1])
bc.reverse()

cnt = 0
p = 0
for i in range(n):
    if p == m:
        break
    if a[i] < bc[p][1]:
        a[i] = bc[p][1]
        cnt += 1
    if cnt == bc[p][0]:
        p += 1
        cnt = 0
print(sum(a))
# Judge status: Wrong Answer
N = int(input())
h = [int(i) for i in input().split()]
dp = [10**5 for _ in range(N)]
dp[0] = 0
for i in range(N-1):
    if dp[i+1] > dp[i] + abs(h[i] -h[i+1]):
        dp[i+1] = dp[i] + abs(h[i] -h[i+1])
    if i != N-2:
        if dp[i+2] > dp[i] + abs(h[i] -h[i+2]):
            dp[i+2] = dp[i] + abs(h[i] -h[i+2])
print(dp[N-1])
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

mb=format(max(a),'b')
arr=[0]*len(mb)

for i in range(n):
    b=format(a[i],'b')
    for j in range(len(b)):
        if b[-j-1]=='1':
            arr[j]+=1

ans=0

for i in range(len(mb)):
    ans+=arr[i]*(n-arr[i])*(2**i)
print(ans%mod)
# Judge status: Accepted
n = int(input())
cnt = [0]*n
for i in range(n):
    a = int(input())
    cnt[i] += a

ans = 0
for i, j in zip(range(n-1), range(1, n)):
    x, y = cnt[i], cnt[j]
    z = x//2
    cnt[i] -= 2*z
    ans += z
    if cnt[i] == 0:
        continue
    if 0 < y:
        ans += 1
        cnt[i] -= 1
        cnt[j] -= 1
else:
    ans += cnt[-1]//2

print(ans)
# Judge status: Accepted
import math
from fractions import gcd

a,b = map(int,input().split())
g = gcd(a,b)
gr = int(math.ceil(math.sqrt(g)))

facs = [1]
i = 2
while i*i <= g:
    if g == 1:
        break
    if g % i == 0:
        facs.append(i)
        while g % i == 0:
            g //= i
    i += 1
if g != 1:
    facs.append(g)

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

P=sorted(A)
cnt=0

for i in range(n):
    if A[i] != P[i]:
        cnt += 1

print("YES" if cnt <= 2 else "NO")
# Judge status: Accepted
n,m=map(int,input().split())
a=[[int(i) for i in input().split()]for i in range(m)]
b=[False]*n
for i in a:
    if i[1]==n:
        b[i[0]-1]=True
for i in a:
    if i[0]==1 and b[i[1]-1]==True :
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')
# Judge status: Accepted
s = list(input())

if "7" in s:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n, l = map(int, input().split())
list = []
for i in range(n) :
    s = input()
    list.append(s)
list.sort()
print("".join(list))
# Judge status: Accepted
w=dict(SUN=7,MON=6,TUE=5,WED=4,THU=3,FRI=2,SAT=1)
print(w[input()])
# Judge status: Accepted
a, b = map(int, input().split())
ans = max(a+b, 2*a-1, 2*b-1)
print(ans)
# Judge status: Accepted
list=[]

N=input()
for i in range(int(N)):
  s=input();
  list.append(s)
kind=len(set(list))
print(kind)
# Judge status: Accepted
n,m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()

cb = []
for _ in range(m):
    b, c = [int(i) for i in input().split()]
    cb.append([c, b])
cb.sort(reverse=1)

i = 0
j = 0
for k in range(n):
    a[k] = max(a[k], cb[i][0])
    j += 1
    if j == cb[i][1]:
        i += 1
        j = 0
    if i == m:
        break
print(sum(a))
# Judge status: Accepted
n,x=map(int,input().split())
a=list(map(int,input().split()))
cnt=0
if a[0]>=x:
    cnt+=a[0]-x
    a[0]=x
for i in range(n-1):
    if a[i]+a[i+1]>x:
        temp=a[i]+a[i+1]-x
        #print(a[i+1],temp)
        a[i+1]-=temp
        cnt+=temp

print(cnt)
# Judge status: Accepted
# -*- coding: utf-8 -*-

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

if len(set(l)) == 2:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import math

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

n = math.ceil(a / d)
m = math.ceil(c / b)

if n >= m:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
abc = [list(map(int, input().split())) for _ in range(N)]

dp = [[0] * 3 for _ in range(N+1)]

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

print(max(dp[N]))
# Judge status: Accepted
N,M=map(int,input().split())
A=[int(input()) for i in range(M)]
for i in range(M-1):
    if A[i+1]-A[i]==1:
        print(0)
        exit()
kaidan=[1]*(N+1)
for i in A:
    kaidan[i]=0
for i in range(2,N+1):
    if kaidan[i]!=0:
        kaidan[i]=(kaidan[i-1]+kaidan[i-2])%(10**9+7)
print(kaidan[-1])
# Judge status: Wrong Answer
n=int(input())
p=1
for i in range(1,n+1):
    p=p*i
p//10*9+7
print(p)
# Judge status: Accepted
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
from collections import deque

def main():
    s = IS()
    dq = deque()
    dq.append(s[0])
    cnt = 0
    for i in range(1, len(s)):
        if len(dq) == 0: dq.append(s[i]); continue
        a = dq[-1]
        b = s[i]
        if a == b: dq.append(b)
        else: dq.pop(); cnt += 2
    print(cnt)

if __name__ == '__main__':
    main()
# Judge status: Accepted
A, B, C = map(int, input().split())

if A + B >= C:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import numpy as np
n, m = map(int, input().split())
k = [0] * n
for i in range(n):
    k[i] = list(map(int, input().split()))
b = np.zeros((n, m))
for i in range(n):
    w = k[i]
    for j in range(len(w)):
        b[i, int(w[j])-1] = 1
print(sum(b.sum(axis=0) == n))
# Judge status: Accepted
def check(string2):
	N = len(string2)
	rev = string2[::-1]
	for i in range((N//2)+1):
		if(rev[i]!=string2[i]):
			return False
	return True


string = input()
n = len(string)
n-=1
str1 = string[0:int((n)/2)]
# print(str1)
str2 = string[int((n)/2)+1:n+1]
# print(str2)
if check(str1) and check(str2) and check(string):
	print("Yes")
else:
	print("No")
# Judge status: Wrong Answer
from collections import Counter
n=int(input())
s=[ input() for i in range(n)]
alf=list("abcdefghijklmnopqrstuvwxyz")
ans=dict()
for i in alf:
  ans[i]=1000
for i in s:
  sl=list(i)
  sl=Counter(sl)
  for j in alf:
    if not sl[j]:
      ans[j]=0
    elif ans[j]>sl[j]:
      ans[j]=sl[j]
s=""
for i in ans:
  if ans[i]!=0:
    s+=str((i*ans[i]))
print(s)
# Judge status: Accepted
import numpy as np

n = int(input())
a = np.array(input().split(), dtype=int)

ans = 0
MOD = 10**9+7

k = max(a)
j = 0
while k:
    bits = (a>>j)&1
    one = np.count_nonzero(bits)
    ans += (one%MOD)*((n-one)%MOD)*pow(2,j,MOD)
    ans %= MOD
    j += 1
    k >>= 1

print(ans)
# Judge status: Wrong Answer
from itertools import accumulate


N = int(input())
A = [0] + list(accumulate(map(int, input().split())))
print(A)
min_diff = float("inf")
for i in range(N - 1):
    if abs(A[N] - 2 * A[i + 1]) < min_diff:
        min_diff = abs(A[N] - 2 * A[i + 1])
print(abs(min_diff))
# Judge status: Accepted
c = [list(map(int,input().split())) for _ in range(3)]
b = c[0]
a = [0]
for i in range(1,3):
    a.append(c[i][i]-b[i])
for i in range(3):
    for j in range(3):
        if c[i][j] != a[i] + b[j]:
            print('No')
            exit()
print('Yes')
# Judge status: Accepted
l=[]
l.append(list(map(int,input().split())))
l.append(list(map(int,input().split())))
l.append(list(map(int,input().split())))
for i in range(2):
  if l[i][1]-l[i][0]!=l[i+1][1]-l[i+1][0] or l[i][2]-l[i][1]!=l[i+1][2]-l[i+1][1]:
    print('No')
    break
  if i==1:
    print('Yes')
# Judge status: Accepted
a,v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if a < b:
    if a + v * t >= b + w * t :
        print("YES")
    else:
        print("NO")
else : 
    if a - v * t <= b - w * t :
        print("YES")
    else:
        print("NO")
# Judge status: Wrong Answer
a,b = map(int,input().split())

if a > 8 and b> 8:
  print(":(")
else:
  print("Yay!")
# Judge status: Accepted
import sys

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

number = N-1
while True:
    number += 1
    ng = False
    for i in range(K):
        if Ds[i] in str(number):
            ng = True
            break

    if ng == False:
        print(number)
        sys.exit(0)
# Judge status: Accepted
N=int(input())
S=input()

ans=0
max_ans=0
for i in range(N):
    if(S[i]=='I'):
        ans+=1
    else:
        ans-=1
    max_ans=max(max_ans,ans)

print(max_ans)
# Judge status: Accepted
w, h, x, y = map(int, input().split())
m = 1 if x == w/2 and y == h/2 else 0
print(w*h/2, m)
# Judge status: Accepted
N = int(input())
A = int(input())

print('Yes' if N % 500 <= A else 'No')
# Judge status: Wrong Answer
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())


n = int(input())
digi = len(str(n))

ans = 0
for i in range(1,50):
    ans += n//(5**i)//2

print(ans)
# Judge status: Wrong Answer
w,a,b = map(int,input().split())
aw = a+w
bw =b+w
print(min(abs(a-b),abs(b-aw),abs(bw-a),abs(bw-aw)))
# Judge status: Accepted
N = int(input())
ABlist = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])
now = 0
for a, b in ABlist:
    now += a
    if now <= b:
        continue
    else:
        print("No")
        break
else:
    print("Yes")
# Judge status: Accepted
n = int(input())
s = input()
ans = s.count("R")*s.count("G")*s.count("B")
for i in range(n):
    for d in range(n):
        j = i + d
        k = j + d
        if k >= n:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans -= 1

print(ans)
# Judge status: Wrong Answer
"""
author : halo2halo
date : 29, Jan, 2020
"""

import sys

# import itertools
# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

X, Y, Z = map(int, readline().split())
print(X // (Y + Z))
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))
ans = 10**9
x, y = 0, sum(A)
for i in range(n-1):
    x += A[i]
    y -= A[i]
    ans = min(ans, abs(x-y))
print(ans)
# Judge status: Accepted
N,H = map(int,input().split())
A = []
B = []
for i in range(N):
    a,b = map(int,input().split())
    A.append(a)
    B.append(b)
B.append(0)
a = max(A)
B.sort()
ans = 0
while a <= B[-1] and H > 0:
    b = B.pop()
    H -= b
    ans += 1
H = max(0,H)
last = (H+a-1)//a
ans += last
print(ans)
# Judge status: Accepted
n,k= map(int,input().split())
*A,=map(int,input().split())
l,r=0,10**9
while r-l>1:
    c=(l+r)//2
    if sum(-(-a//c)-1 for a in A)<=k:r=c
    else:l=c
print(r)
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    n = int(input())
    s = list(input())
    if n % 2 == 1:
        print('No')
    else:
        if s[:n//2] == s[n//2:]:
            print('Yes')
        else:
            print('No')
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
import math

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

print(math.ceil( (n - 1) / (k - 1) ))
# Judge status: Accepted
if "".join(sorted(input()))=="abc":
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
S = []
for _ in range(n):
    S.append(int(input()))
ans=0
for i in range(len(S)):
    ans+= S[i] // 2

    if i==len(S)-1:
        break
    if S[i]%2 == 1 and S[i+1] >= 1:
        ans+=1
        S[i+1] -= 1
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
s = input()

cnt_1 = 0
cnt_2 = 0
res = 0
for i in range(n-1):
    if s[i] == 'L' and s[i+1] == 'R':
        cnt_1 += 1
    elif s[i] == 'R' and s[i+1] == 'L':
        cnt_2 += 1
    else:
        res += 1

if min(cnt_1, cnt_2) < k:
    res += min(cnt_1, cnt_2) * 2
    if cnt_1 != cnt_2:
        res += 1
else:
    res += k * 2

print(res)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

import itertools
from math import sqrt

n = int(readline())
xy = [list(map(int, readline().split())) for i in range(n)]
memo = [i for i in range(n)]
z = list(itertools.permutations(memo))
ans = 0
for i in range(len(z)):
    for j in range(n - 1):
        ans += sqrt((xy[z[i][j]][0] - xy[z[i][j + 1]][0]) ** 2 + (xy[z[i][j]][1] - xy[z[i][j + 1]][1]) ** 2)
print(ans / len(z))
# Judge status: Accepted
a, b = map(int, input().split())
res = 0
for i in range(a, b + 1):
    str_i = str(i)
    if str_i[0] == str_i[-1] and str_i[1] == str_i[-2]:
        res += 1

print(res)
# Judge status: Wrong Answer
from scipy.special import comb
import copy

MOD = 10**9+7
s = int(input())
cnt = 0
ans = 1

if s <= 2:
    print(0)
else :
    s = s-3
    while s >= 3:
        s -= 3
        cnt += 1
        if s > 0:
            ans += comb(s+cnt, cnt, exact=True)%MOD
        else :
            ans += 1
    print(ans)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
B=sorted(A)
ans=0
for i in range(N):
  ans+=B[N+2*i]

print(ans)
# Judge status: Wrong Answer
N = int(input())
print(N if N%2 == 0 else N-1)
# Judge status: Accepted
s = input()
k = int(input())
flag = False
 
for i in range(min(len(s), k)):
    if s[i] != '1':
        ans = int(s[i])
        flag = True
        break

if flag == True:
    print(ans)
else:
    print(1)
# Judge status: Accepted
n=int(input())
A=list(map(int,input().split()))
A.sort(reverse=True)
c=1
x=y=0
for i in range(n-1):
    if A[i]==A[i+1]:
        c+=1
        if c==2:
            if x!=0:
                y=A[i]
                break
            else:
                x=A[i]
        if c==4:
            x=y=A[i]
            break
    else:
        c=1
print(x*y)
# Judge status: Accepted
S = input()

cnt = 0
for i in range(int(len(S)/2)):
    if S[i] == S[len(S)-1-i]:
        continue
    else:
        cnt += 1
        #print(i, S[i], S[len(S)-1-i])
print(cnt)
# Judge status: Accepted
def solve():
    N, K = map(int,input().split())
    A = list(map(int,input().split()))

    left = 0
    right = 10 ** 9
    while right - left > 1:
        mid = (right+left) // 2
        cnt = 0
        for a in A:
            cnt += (a-1) // mid
        
        if cnt <= K:
            right = mid
        else:
            left = mid

    print(right)
    
if __name__ == '__main__':
    solve()
# Judge status: Accepted
n = int(input())
ab = [list(map(int,input().split())) for _ in range(n)]

ans = 0

for i in range(n):
    a,b = ab[-i-1]
    ans += -(-(a+ans) // b) * b - (a + ans)

print(ans)
# Judge status: Accepted
S=input()
LEN=len(S)
print(LEN*'x')
# Judge status: Wrong Answer
N, A, B, C, D = [int(_) for _ in input().split()]
S = input()

if "##" in S[A-1:C] or "##" in S[B-1:D]:
    print("No")
elif C < D:
    print("Yes")
elif "..." in S[B-2:D]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
L, R = map(int, input().split())
mod = 2019
ans = float("inf")

for i in range(L, min(R+1, L+mod+1)):
    for j in range(i+1, min(R+1, L+mod+1)):
        ans = min(ans, (i*j)%mod)
print(ans)
# Judge status: Accepted
import math
import collections
n = int(input())

ans = 0

a = []
while n % 2 == 0:
    a.append(2)
    n //= 2
f = 3
while f * f <= n:
    if n % f == 0:
        a.append(f)
        n //= f
    else:
        f += 2
if n != 1:
    a.append(n)

if a == []:
    print(0)
else:
    c = collections.Counter(a)
    for i in c.values():
        m = 1
        while 2*(i+1)>(m+1)*(m+2):
            m += 1
        ans += m
    print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
P = list(map(int, input().split()))


kitaiti = {}

k = 1.0
for i in range(1, 1001):
    kitaiti[i] = k
    k += 0.5

index = 0

for i in range(K):
    index += kitaiti[P[i]]

s = index
ans = index

for i in range(1, len(P)-K+1):
    s = index - kitaiti[P[i-1]] + kitaiti[P[i+K-1]]
    if s > ans: ans = s
    index = s
print(ans)
# Judge status: Wrong Answer
a,b=map(int,input().split())

def prime_factorization(n):
  if n==1:
    return []
  else:
    i=2
    ans=[]
    k=int(n**0.5)+1
    for j in range(2,k+1):
      if n==1: break
      if n%j==0:
        n//=j
        ans.append(j)
        while n%j==0:
          n//=j
    if len(ans):
      return ans
    else:
      return [n]

A=prime_factorization(a)
B=prime_factorization(b)

ans=0
for _a in A:
  if B.count(_a):
    ans+=1
print(ans+1)
# Judge status: Wrong Answer
n, m = map(int, input().split())
a_l = list(map(int, input().split()))
a_l.sort(reverse=True)

m_count = 0

while True:
    a_l[0] //= 2
    m_count += 1
    if m_count == m:
        break
    max_price = a_l[0]
    for j in range(1,n):
        if a_l[j] >= max_price:
            a_l[j] //2
            m_count += 1
        else:
            break
    a_l.sort(reverse=True)

ans = 0
for i in range(n):
    ans += a_l[i]
print(ans)
# Judge status: Accepted
# B - Tax Rate
ans = ':('
N = int(input())
for X in range(1,50000):
    tmp = int(X*1.08+0.000001)
    if tmp==N:
        ans = X
        break
print(ans)
# Judge status: Wrong Answer
food = [input() for _ in range(5)]
if len(set(food)) == 1:
  food_check1 = [int(10-int(food[i][-1])) for i in range(1, len(food))]
  food_check2 = [int(i) for i in food]
  print(sum(food_check1) + sum(food_check2))
else:
  check = [int(i[-1]) for i in food if i[-1] != '0']
  food_check1 = [int(i) for i in food if i[-1] != '0']
  food_check2 = [10-int(str(i)[-1]) for i in food_check1 if int(str(i)[-1]) != min(check)]
  food = [int(i) for i in food]
  print(sum(food)+sum(food_check2))
# Judge status: Accepted
import bisect
N = int(input())
L = sorted(list(map(int,input().split())))
cnt = 0
for i in range(N):
    for j in range(i+1,N):
        cnt += bisect.bisect_left(L,L[i]+L[j])-(j+1)
print(cnt)
# Judge status: Accepted
n, m = map(int, input().split())
a = list(map(lambda x: [int(x),1], input().split()))

for i in range(m):
    b , c = map(int,input().split())
    a.append([c,b])
a.sort(reverse = True)

ans = 0
for x,y in a:
    if y < n:
        ans += x*y
        n = n-y
    elif y >=n:
        ans += x*n
        break
print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
if a<=c<=b or a>=c>=b:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
C = input()

print(chr(ord(C)+1))
# Judge status: Accepted
import math
a, b, c = map(int, input().split())

if c - (a + b) <= 0:
    print("No")
    exit()
if 4 * a * b < (c - (a + b)) ** 2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
X = int(input())

if (X < 599):
    print('8')
elif (X < 799):
    print('7')
elif (X < 999):
    print('6')
elif (X < 1199):
    print('5')
elif (X < 1399):
    print('4')
elif (X < 1599):
    print('3')
elif (X < 1799):
    print('2')
elif (X < 1999):
    print('1')
# Judge status: Accepted
N = input()
N_i = int(N)
N_s = list(N)


for i in range(0,17):
  if N_i < 10 ** i:
    break
flag = True
for j in range(1,i):
  if N_s[j] != "9":
    flag = False
    break

if flag == True:
  # 最上位を除いたすべての桁が9
   print(int(N_s[0])+9*(len(N_s)-1))
else:
   print(int(N_s[0])+9*(len(N_s)-1)-1)
# Judge status: Wrong Answer
S = input()
T = input()
n = len(S)
A = [[S[i],T[i]] for i in range(n)]
for i in range(n-1):
  for j in range(i+1,n):
    if A[i][0] in A[j]:
      if set(A[i]) != set(A[j]):
        print(A[i],A[j])
        print("No")
        exit()
      else:
        pass
    else:
      pass
      
print("Yes")