peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import numpy as np
from sys import stdin


def get_result(data):
    N, M = data[0]
    A = np.array(data[1])
    total = sum(A)
    pop_goods = A[A > total/(4*M)]
    if len(pop_goods) >= M:
        return 'Yes'
    return 'No'


if __name__ == '__main__':
    raw_data = [val.rstrip() for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)
# Judge status: Wrong Answer
N,M = map(int,input().split())
n = M // N
if n < 10**5:
    for i in range(n):
        x = n - i
        if M % x == 0:
            print(x)
            quit()
else:
    for i in range(10**5):
        x = N + i
        if M % x == 0:
            print(M//x)
            quit()
# Judge status: Accepted
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
P = inintl()

ans = 0

for i in range(n-1):
    a = P[i]
    b = P[i+1]
    if a == i+1:
        P[i] = b
        P[i+1] = a
        ans += 1

if P[-1] == n:
    ans += 1

print(ans)
# Judge status: Accepted
n=int(input())
result={'AC':0,'WA':0,'TLE':0,'RE':0}
for _ in range(n):
  result[input()] += 1
for i,j in result.items():
  print(f'{i} x {j}')
# Judge status: Accepted
def chmin(a, b):
    if a > b:
        return b
    else:
        return a

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

# dp table
dp = [float('inf')]*(10**5 + 10)

# 初期条件
dp[0] = 0

for i in range(1,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]))

# ans
print(dp[N-1])
# Judge status: Accepted
s = str(input())
t = str(input())
s = sorted(s)
t = sorted(t, reverse = True)
if(''.join(s) < ''.join(t)):
    print('Yes')
else:
    print('No')
# Judge status: Accepted

C1 =str(input())
C2 =str(input())

if C1[0] == C2[2] and C1[1] == C2[1] and C1[2] == C2[0]:
    print('YES')

else:
    print('NO')
# Judge status: Wrong Answer
h = int(input())
m = 0 # モンスター数
a = 0 # 分裂回数
i = 0 # ループ回数
while True:
    i += 1
    # 攻撃して分裂した
    if h > 1:
        h = int(h/2)
        m += 2
        a += i
        continue
    # 1のモンスターを消滅させるまでの回数
    else:
        print(a+m)
        break
# Judge status: Wrong Answer
A = []
dist = 0
for i in range(5):
    A.append(int(input()))
    if i > 0:
        dist = max(dist,A[i]-A[i-1])
k = int(input())
if dist >= k:
    print(':(')
else:
    print('Yay!')
# Judge status: Wrong Answer
N, P = map(int, input().split())
odd = sum([int(i) % 2 for i in input().split()])
even = N-odd

if P == 1 and odd == 0:
    print(0)
else:
    print(2**even * (2**odd//2))
# Judge status: Accepted
N = int(input())
p = list(map(int,input().split()))
sort_p=sorted(p)
count = 0
for i,j in zip(p,sort_p):
    if(i!=j):
        count+=1
if(count==2 or count==0):
    print('YES')
else:
    print('NO')
# Judge status: Accepted
k,s=map(int,input().split())
from math import factorial
def c(n,r):
  return factorial(n)//factorial(n-r)//factorial(r)
ans=0
for x in range(k+1):
  for y in range(k+1):
    if 0<=s-x-y<=k:
      ans += 1
print(ans)
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
if a*c >= b*d:
    print(a*c)
elif a*d >= b*d:
    print(a*d)
elif b*c >= b*d:
    print(b*c)
else:
    print(b*d)
# Judge status: Accepted
import math
a,b,c,d = map(int,input().split())

a = math.ceil(a/d)
b = math.ceil(c/b)
if a<b:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
n,x=map(int,input().split())
l=[int(x) for x in input().rstrip().split()]
now=0
cnt=1
for i in range(n):
  now+=l[i]
  if x<now:
    break
  cnt+=1
print(cnt)
# Judge status: Accepted
a, b, c = map(int, input().split(" "))

if (a - b) * (b - c) * (c - a) == 0 and not ((a == b) and (a == c)):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N, R = map(int, input().split())

if N >= 10:
	print(R)
else:
	print(R + 100*(10-N))
# Judge status: Accepted
P, Q, R = map(int, input().split())
print(min([P+Q, Q+R, R+P]))
# Judge status: Accepted
a,b,c = map(int,input().split())

print(a*b//2)
# Judge status: Wrong Answer
n = int(input())
ans = 0
for num in range(1, n+1):
    if num%2 == 1:
        continue
    ls = []
    for i in range(1, num+1):
        if num%i == 0:
            ls.append(i)
    if len(ls) == 8:
        ans += 1
print(ans)
# Judge status: Wrong Answer
n,m = map(int,input().split())
lmax, rmin = 0, n

for _ in range(m):
  l,r = map(int,input().split())
  lmax = max(lmax, l)
  rmin = min(rmin, r)

print((rmin-lmax)+1)
# Judge status: Wrong Answer
n=int(input())
x=list(map(int,input().split()))
result=0
for p in range(1,max(x)):
  s=0
  for i in range(0,n):
    s+=(x[i]-p)**2
  if p==1:
    result=s
  else:
    if s<result:
      result=s
print(result)
# Judge status: Accepted
a,b = map(int,input().split())
ans = -1
#print(a,b)
for i in range(1001):
#  print(i,int(i * 0.08),int(i * 0.1))
  if int(i * 0.08) == a and int(i *0.1) == b:
    ans = i
    break
print(ans)
# Judge status: Accepted
import math
x = int(input())
if x <= 11:
    count = 0
    point = 0
    while True:
        point += 6
        count += 1
        if point >= x:
            break
        point += 5
        count += 1
        if point >= x:
            break
    print(count)
else:
    count = math.ceil(x/11)*2
    if count%2 != 0:
        df = 6
    else:
        df = 5
    if count/2 * 11 - df >= x:
        count -= 1
    print(count)
# Judge status: Accepted
import math

a, b, h, m = map(int, input().split())
h=h*60+m

ang=abs(h*0.5-m*6)
if ang > 180:
  ang = 360-ang
if ang==180:
  print(a+b)
elif(ang==0):
  print(abs(b-a))
else:
  ans=(a**2)+(b**2)-(2*a*b*math.cos(math.radians(ang)))
  print(math.sqrt(ans))
# Judge status: Wrong Answer
N=int(input())
can=set()

can.add(1)
i=0
ans=0
while ans<=100000:
  ans=6**i
  can.add(ans)
  i+=1
j=0
ans=0
while ans<=100000:
  ans=9**j
  can.add(ans)
  j+=1

dp=[0]*(N+1)
dp[1]=1

for k in range(2,N+1):
  mini=1000000
  for item in can:
    if k-item>=1:
      mini=min(mini, dp[k-item]+1)
  dp[k]=mini

print(dp[-1])
# Judge status: Wrong Answer
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()))

a,b,c,k = iim()
k = k%2
print(int((a-b)*(-1)**(k-1)))
# Judge status: Accepted
import math


def main():
    hp, attack = (int(i) for i in input().rstrip().split(' '))
    print(str(math.ceil(hp / attack)))


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, M = map(int, input().split())
X = sorted(list(map(int, input().split())))

if N >= M:
    print(0)
else:
    dists = [X[i+1]-X[i] for i in range(M-1)]
    if N == 1:
        print( sum(dists) )
    else:
        print( sum(sorted(dists)[:-(N-1)]) )
# Judge status: Accepted
s = input()
q = int(input())
jun = 1
f = "";t = ""
for _ in range(q):
  
  tmp = input()
  if len(tmp)==1:
    jun = 1 if jun==0 else 0 
  else:
    _,ff,c = tmp.split()
    if jun+int(ff) ==2:
      f = c+f
    else:
      t += c
if jun==1:
  print(f+s+t)
else:
  print((f+s+t)[::-1])
# Judge status: Accepted
A,B = map(int,input().split())

if A == B:
    print("Draw")
    
elif A > B:
    if B == 1:
        print("Bob")
    else:
        print("Alice")
elif B > A:
    if A == 1:
        print("Alice")
    else:
        print("Bob")
# Judge status: Wrong Answer
N, K, S = map(int, input().split())

A = [S for i in range(K)] + [(int(10e9) if S != int(10e9) else 1)
                             for i in range(N - K)]

for i in range(N):
    if i > 0:
        print(' ', end='')
    print(A[i], end='')
# Judge status: Wrong Answer
s = list(input())
n = len(s)-1
count = 0
if s != s[::-1]:
  for i in range(0,n//2):
    if s[i] != s[n-i]:
      count += 1
print(count)
# Judge status: Accepted
#127 a
a,b=map(int,input().split())
kane=[0,int(b/2),b]
ans=1
if a>=13:
    ans=2
elif a<=5:
    ans=0
print(kane[ans])
# Judge status: Accepted
import collections
N = int(input())
A = list(map(int, input().split()))
count = collections.defaultdict(int)
currSum = 0
for a in A:
  count[a] += 1
  currSum += a
Q = int(input())
for _ in range(Q):
  B, C = map(int, input().split())
  currSum += (count[B] * (C - B))
  count[C] += count[B]
  count[B] = 0
  print(currSum)
# Judge status: Accepted
n = int(input())
t = []

for i in range(n):
    a,b = map(int,input().split())
    t.append((a,b))

t = sorted(t,key=lambda x: x[1])

ans = 0
for k,v in t:
    ans += k
    if ans > v:
        print("No")
        exit()

print("Yes")
# Judge status: Accepted
n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))
ans = 0
for i in range(1,n+1):
    ans = max(ans,sum(a1[:i])+sum(a2[(i-1):]))
print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
r,s,p=map(int,input().split())
t=list(input())
 
res=0
for i in range(n):
  if i>k-1 and t[i-k]==t[i]:
    t[i]="n"
  if t[i]=="r":
    res+=p
  elif t[i]=="s":
    res+=r
  elif t[i]=="p":
    res+=s
  
print(res)
# Judge status: Accepted
a, b = map(int,input().split())
print((a+b)%24)
# Judge status: Accepted
K = int(input())
S = input()

if len(S)<=K:
    print(S)
else:
    S = S[:K]+'...'
    print(S)
# Judge status: Accepted
n = int(input())
v_n = list(map(float, input().split()))

v_n = sorted(v_n)

res = (v_n[0] + v_n[1]) / 2
for i in range(2, n):
    res = (v_n[i] + res) / 2

print(res)
# Judge status: Accepted
def main():
    N = int(input())
    *a, = map(int, input().split())

    ctr = [0] * N
    for x in a:
        ctr[x - 1] += 1
    print(*ctr, sep='\n')


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
# Judge status: Wrong Answer
n, k = map(int, input().split())

import math
ans = 0
for i in range(1,n+1):
  if i < k:
    t = int(k/(2*i))
    if t == int(t):
      ans += 1/(2**(t+1))
    else:
      ans += 1/(2**t)
  else:
    ans += 1
  
print(ans/n)
# Judge status: Accepted
W=["Sunny","Cloudy","Rainy"]
S=W.index(input())
print(W[(S+1)%3])
# Judge status: Accepted
tmp = input().split(" ")
print(":(") if int(tmp[0]) > 8 or int(tmp[1]) > 8 else print("Yay!")
# Judge status: Accepted
#from collections import deque,defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7
#R = 998244353

def ddprint(x):
  if DBG:
    print(x)

l,r,d = inm()
sm = 0
for i in range(l,r+1):
    if i%d==0:
        sm += 1
print(sm)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    q, h, s, d = map(int, input().split())
    N = int(input())

    one = min([4*q, 2*h, s])
    print(min((N//2)*d+one*(N % 2), N*one))


resolve()
# Judge status: Wrong Answer
n,k = map(int,input().split())

print(n%k)
# Judge status: Wrong Answer
n,m=map(int,input().split())
AB=[]
for i in range(n):
    a,b=map(int,input().split())
    AB.append((b,a))

AB.sort()

cnt=0
ans=0
for b,a in AB:
    if cnt==m:
        print(ans)
        break
    temp=min(m-cnt,a)
    ans+=b*temp
    cnt+=temp
# Judge status: Accepted
abc = list(map(int,input().split()))
maxnum = max(abc)
parity = maxnum%2
ans = 0
for i in abc:
    if i%2==parity:
        ans+=(maxnum-i)//2+1
    else:
        ans+=(maxnum-1-i)//2
if abc[0]%2==abc[1]%2 and abc[1]%2==abc[2]%2:
    ans-=3
print(ans)
# Judge status: Accepted
S=input()
Y=int(S[:2])
M=int(S[2:])
if Y==0 or Y>12:
    #Y!=MANTH
    if M==0 or M>12:
        print("NA")
    else:
        print("YYMM")
else:
    if M==0 or M>12:
        print("MMYY")
    else:
        print("AMBIGUOUS")
# Judge status: Accepted
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
aa = [-1] * (2*n)
bc = []

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

i = 0
for j in range(m):
    if i >= n:
        break
    for k in range(bc[j][1]):
        aa[i] = bc[j][0]
        i += 1

j = 0
for i in range(n):
    if a[i] < aa[j]:
        a[i] = aa[j]
        j += 1
        
print(sum(a))
# Judge status: Accepted
N,W = map(int,input().split())
dp = [0]*(W+1)
for _ in range(N):
    w,v = map(int,input().split())
    if w > W:
        continue
    else:
        for j in range(w,W+1)[::-1]:
            if dp[j] < dp[j-w]+v:
                dp[j] = dp[j-w]+v
print(dp[W])
# Judge status: Wrong Answer
import numpy as np
import bisect
n = int(input())
A = list(map(int,input().split()))
cs = np.cumsum(A).tolist()
mid = sum(A)//2
idx = bisect.bisect_left(cs, mid)
ans = float('inf')
for i in range(max(1, idx-1), min(idx+2, n)):
    x = A[:i]
    y = A[i:]
    print(x,y)
    sum_x = sum(x)
    sum_y = sum(y)
    ans = min(ans, abs(sum_x - sum_y))
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = [int(x) for x in input().split()]

A = list(set(A))

A.sort()

print(A)

flag = 0

for i in range(1, len(A)):
  list=[]
  for p in range(1, len(A)):
    if A[p] % A[0] == 0:
      list.append(A[p])
  for p in range(len(list)):
    A.remove(list[p])
  flag += 1
  del A[0]
  if len(A) == 1:
    flag += 1
    break
  if len(A) == 0:
    break
  print(A)
    
print(flag)
# Judge status: Wrong Answer
a, b, k = map(int, input().split())

ma = max(a, b)
mi = min(a, b)
ans = []
for i in range(ma // 2, 0, -1):
    if ma % i == 0 and mi % i == 0:
        ans.append(i)
ans.append(1)
print(ans[k - 1])
# Judge status: Accepted
N, K = map(int, input().split())
p = list(map(int, input().split()))

s = []
for i in range(K):
    s.append(p[i])

m = sum(s)
t = m
for i in range(K, N):
    t += p[i] - p[i - K]
    if m < t:
        m = t

m += K

print(m / 2)
# Judge status: Wrong Answer
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
cnt = [0]*(max(a)+1)

for i in range(n):
    cnt[a[i]] += 1

for i in range(len(cnt)-2):
    ans = max(ans,cnt[i]+cnt[i+1]+cnt[i+2])

print(ans)
# Judge status: Wrong Answer
x = int(input())
ans = (x//11)*2

if x%11 == 0:
    print(ans)
elif x%11 <= 5:
    print(ans+1)
else:
    print(ans+2)
# Judge status: Wrong Answer
import math
N,M=map(int,input().split())
S=input().split()
Snum=[]
for i in range(0,N):
  Snum.append(int(S[i]))
Snum.sort
Snum.reverse
for i in range(0,M):
  j=0
  k=math.floor(Snum[0]/2)
  while k<Snum[j] and j<N-1:
    j=j+1
  for l in range(0,j-1):
    Snum[l]=Snum[l+1]
  Snum[j-1]=math.floor(Snum[0]/2)
print(sum(Snum))
# Judge status: Accepted
N,K=map(int,input().split())
D=set(input().split())

while set(str(N))&D:
    N+=1
print(N)
# Judge status: Accepted
n = int(input())
X = list(map(int, input().split()))
res = 0
MOD = int(1e9 + 7)
bit = 0
for n in range(60):
    b1, b0 = 0, 0
    for i in range(len(X)):
       if X[i] & (1 << bit):
           b1 += 1
       else:
           b0 += 1
    res += (b1 * b0 * (1 << bit))
    res = res % MOD
    bit += 1
print(res)
# Judge status: Accepted
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))


import bisect

cum_a = [0]
for a in A:
    cum_a.append(cum_a[-1] + a)

cum = [0]
for b in B:
    cum.append(cum[-1] + b)

ans = 0
for i in range(n + 1):
    t = cum_a[i]
    if t <= k:
        bnum = i
    else:
        bnum = 0
    if t <= k:
        idx = bisect.bisect_right(cum, k - t)
        bnum += idx - 1
    ans = max(ans, bnum)
print(ans)
# Judge status: Accepted
n=int(input())
b=list(map(int,input().split()))
ans=b[0]+b[n-2]
for i in range(1,n-1):
  ans+=min(b[i],b[i-1])
print(ans)
# Judge status: Accepted
n=int(input())
out=0
for i in range (1,n+1):
    if i%3!=0 and i%5!=0:
        out=out+i
print(out)
# Judge status: Wrong Answer
N, A, B = map(int, input().split())
print((B-A)*(N-2) + 1)
# Judge status: Accepted
#K = int(input())
#X = list(map(int, input().split()))
#s = input().split()

S = input()

if (S.isupper()):
    print("A")
else:
    print("a")
# Judge status: Wrong Answer
N = int(input())
cnt = 0
while True:
  if N % 2 <= 1:
    break
  N /= 2
  cnt += 1
  
print(2**int(cnt))
# Judge status: Accepted
A, B = map(int, input().split())
S = input()
print('Yes' if S[:A].isdecimal() and S[A + 1:].isdecimal() and S[A] == '-' else 'No')
# Judge status: Accepted
from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
d = defaultdict(int)
for i in A:
    d[i] += 1
ans = 0
for i in range(10 ** 5):
    ans = max(ans, d[i-1] + d[i] + d[i+1])
print(ans)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

ans = 0
next = 1

for a in a:
    if a == next:
        next += 1
    else:
        ans += 1

if next == 1:
    print(-1)
else:
    print(ans)
# Judge status: Accepted
x = int(input()) - 400
ans = 8 - x//200
print(ans)
# Judge status: Accepted
from itertools import accumulate
N, K = map(int, input().split())
A = list(map(int, input().split()))

def calc_imos(arr):
    imos = [0] * (N + 1)
    for i, a in enumerate(arr):
        l = max(0, i - a)
        r = min(N - 1, i + a)
        imos[l] += 1
        imos[r + 1] -= 1
    new_arr = list(accumulate(imos))[:-1]
    return new_arr


for k in range(K):
    A = calc_imos(A)
    if all([a == N for a in A]):
        print(*([N] * N), sep=' ')
        exit()

print(*A, sep=' ')
# Judge status: Accepted
n = int(input())
a = int(input())
if n%500 <= a:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
data1 = list(map(str, input().split()))
data2 = list(map(str, input().split()))

count = len(data1) - 1
sw = 0
i = 0
j = len(data2)-1
while i <= count:
    if data1[i] == data2[j]:
        sw += 1
    i += 1
    j -= 1
if sw == len(data1):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a,b,c=map(int,input().split())
print("YES" if any((a*i)%b==c for i in range(1,b+1)) else "NO")
# Judge status: Accepted
from collections import defaultdict 
n,m = map(int,input().split())
py = []
for i in range(m):
    p,y = map(int,input().split())
    py.append([p,y])
spy = sorted(py,key=lambda x:x[1])

cnt = [0]*n
id =  defaultdict(int)
for i in spy:
    p,y = i
    cnt[p-1] += 1
    id[(p,y)] = str(p).zfill(6)+str(cnt[p-1]).zfill(6)

for i in py:
    p,y = i
    print(id[(p,y)])
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
for x in X:
    if x <= Y[N // 2 - 1]:
        print(Y[N // 2])
    else:
        print(Y[N // 2 - 1])
# Judge status: Accepted
n = int(input())
rli = list(map(int,input().split()))
ali = []
for i in range(n-1):
    ali.append(abs(sum(rli[:(i+1)])-sum(rli[(i+1):])))
print(min(ali))
# Judge status: Accepted
n = int(input())
if n == 1:
    print(0)
else:
    print(1)
# Judge status: Accepted
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
mod=10**9+7

x,y=MI()
ans=1

a=x
for i in range(1000):
    a=a*2
    if a>y:
        break
    ans+=1
    
print(ans)
# Judge status: Accepted
import math
n = int(input())
c = [0]*(n-1)
s = [0]*(n-1)
f = [0]*(n-1)
for i in range(n-1):
  ci,si,fi = map(int,input().split())
  c[i] = ci
  s[i] = si
  f[i] = fi
for i in range(n-1):
  x = s[i]
  for j in range(i,n-2):
    x += c[j]
    x = max(s[j+1],math.ceil(x/f[j+1])*f[j+1])
  x += c[n-2]
  print(x)
print(0)
# Judge status: Accepted
import fractions
A,B=map(int,input().split())
print(A*B//fractions.gcd(A,B))
# Judge status: Wrong Answer
r, g, b, = map(int, input().split())

if (r * 100 + g *10 + b) % 4 == 0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
l=list(map(int ,input().split()))
four=0
two=0
one=0

for i in range(n):
	if l[i]%2==0:
		if l[i]==2:
			two+=1
		else:
			four+=1

	elif l[i]==1:
		one+=1
odd=n-(four+two+one)

if four>=n//2:
	print('Yes')
elif two>=2:
    if n==two:
        print("Yes")
    elif (n-(four+two))/2<=four:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Accepted
#!/usr/bin/env python3
import sys


def solve(A: int, B: int, C: int):
    x = 3 * max([A, B, C]) - A - B - C
    print(x // 2 + x % 2 * 2)


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)


if __name__ == '__main__':
    main()
# Judge status: Accepted
print('Heisei' if int(input()[5:7]) <= 4 else 'TBD')
# Judge status: Wrong Answer
N=int(input())
nn=N
import math

i=2
ans=0
count1=0
count2=1
while math.sqrt(N)>=i:
    if nn%i==0:
        nn//=i
        count1+=1
        if count1//count2>0:
            ans+=1
            count2+=1
            count1=0
    else:
        i+=1
        count1=0
        count2=1

if ans==0 and N>=2:
    ans+=1

print(ans)
# Judge status: Wrong Answer
N, M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
import bisect
cnt = 0
if N == 1:
    print(int(A[0]/(2**M)))
    exit()
else:
    while cnt < M:
        A[-1] /= 2
        if A[-1] < A[-2]:
            a = A[-1]
            del A[-1]
            bisect.insort_left(A, a)
            cnt += 1

ans = 0
for i in range(N):
    ans += int(A[i])

print(ans)
# Judge status: Accepted
n = int(input())
A = [list(map(int, input().split())) for _ in range(2)]

ans = -1
for i in range(n):
    ans = max(ans, sum(A[0][0:i+1])+sum(A[1][i:]))
print(ans)
# Judge status: Wrong Answer
n = int(input())
A = map(int, input().split())
A = sorted(A)
maxa = max(A)
if abs(maxa//2 - A[n//2-1]) <= abs(maxa//2 - A[n//2]):
    print(maxa, A[n//2-1])
else:
    print(maxa, A[n//2])
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split() if int(i) % 2 == 0]
t = 0
for x in A:
    if x % 3 != 0 and x % 5 != 0:
        t += 1
if t == 0:
    print('APPROVED')
else:
    print('DENIED')
# Judge status: Accepted
n = int(input())
s = input()

c = 0
scount = 0
for i, si in enumerate(list(s)):
  if si == '(':
    c += 1
  else:
    c -= 1
  if c < 0:
    scount += 1
    c = 0

s = '('*scount + s
s = s + ')'*c
print(s)
# Judge status: Accepted
n = int(input())
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))

ans = 0
for i in range(n):
    c = sum(a1[:i+1]) + sum(a2[i:])
    ans = max(ans, c)

print(ans)
# Judge status: Wrong Answer
n = int(input())
ans = int((n-1)*(n-2)/2)
print(ans)
# Judge status: Accepted
s,c = map(int,input().split())

if c//2 <= s:
    print(c//2)
else:
    ans = s
    ans += (c-2*s)//4
    print(ans)
# Judge status: Wrong Answer
# -*- coding : utf-8 -*-

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

A = a // x
B = b // x
if a % x != 0:
  print(b-a)
else:
  print( b-a + 1)
# Judge status: Accepted
a, b = map(int, input().split())

if a >= 13:
  print(b)
elif 6 <= a and a <= 12:
  print(int(b/2))
else:
  print('0')
# Judge status: Accepted
a = list(map(int, input().split()))
print(sum(a)%24)
# Judge status: Accepted
# Alice: a to b
# Bob: c to d
a,b,c,d = map(int, input().split())

if b <= c or d <= a:
  print(0)
elif (c<= a<b <=d):
  print(b-a)
elif (a<= c<d <=b):
  print(d-c)
elif (a <= c < b <= d):
  print(b-c)
elif (c <= a < d <= b):
  print(d-a)
else:
  print(None)
# Judge status: Accepted
n,m=map(int, raw_input().split())
arr=map(int, raw_input().split())
s=sum(arr)
if s>n:
  print -1
else:
  print n-s
# Judge status: Accepted
A, B, N = map(int, input().split())
x = min(N, B-1)
ans = (A*x)//B - A*(x//B)
print(ans)
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
D = list(map(int, input().split()))

c = Counter(D)
mod = 998244353
L = list(set(D[:]))
L.sort(reverse=True)
if (D[0] != 0):
    print(0)
    exit()
elif (c[0] > 1):
    print(0)
    exit()

if (N == 1):
    print(1)
    exit()


ans = 1
for i in L:
    if (i == 1):
        ans *= 1
        break
    if (c[i - 1] == 0 and i != 1):
        print(0)
        exit()
    else:
        ans *= c[i - 1] ** c[i]

print(ans)