peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
a, b, t = map(int, input().split())
c = a
while t+0.5 >c :
    c += a 
c -= a
aa = (c*b)//3
print(aa)
# Judge status: Accepted
(n,h),*ab = [list(map(int, s.split())) for s in open(0)]

mxa = max([a for a, b in ab])
bb = sorted([b for a, b in ab if b>mxa],reverse=True)

ans = 0
for b in bb:
    h-=b
    ans += 1
    if h<=0:
        break
if h>0:
    ans += (0--h//mxa)
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())
c = 1
while a < b:
  a += a
  c += 1
print(c)
# Judge status: Accepted



n,k = map(int,input().split())


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



for j in range(n,100000):
    h = str(j)
    u=0
    for s in h:
        if int(s) in t:
            u+=1
            break
    if u==0:
        print(h)
        break
# Judge status: Wrong Answer
n = int(input())
while n >= 1000:
	n = n-1000
print(1000-n)
# Judge status: Wrong Answer

def calcPattern(N, Y):
    for i in range(0, N+1):
        for j in range(0, N+1):
            if i == ((Y - 1000*N - 4000*j) / 9000):
                if (N-i-j) >= 0: return (str(i) + " " + str(j) + " " +str(N-i-j))
    return ("-1 -1 -1")

n,y = map(int, input().split())
print(calcPattern(n,y))
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())

count = 0

while a >= b:
    b *= 2
    count += 1
while b >= c:
    c *= 2
    count += 1

if count <= k:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

money = 1000
stock = 0
for day in range(N):
    if day == N - 1:
        money += stock * A[day]
        stock = 0
    elif A[day] == A[day+1]:
        continue
    elif A[day] < A[day+1]:
        stock = money // A[day]
        money = money % A[day]
    elif A[day] > A[day+1]:
        money += stock * A[day]
        stock = 0

print(money)
# Judge status: Accepted
k, s = map(int, input().split())
ans = 0

for i in range(k+1):
    for j in range(k+1):
        if (i + j <= s) and (s - i - j <= k):
            ans += 1

print(ans)
# Judge status: Wrong Answer
K = int(input())
ans = 0
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)
for a in range(K):
    for b in range(K):
        for c in range(K):
            ans += gcd(gcd(a, b), c)
print(ans)
# Judge status: Wrong Answer
a,b,c,d,e = map(int,input().split())

x = [a,b,c,d,e]

for i in range(4):
  if x[i] == 0:
    print(i+1)
# Judge status: Accepted
from  heapq import heappush, heappop, heapify
import math

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

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

l = 0
r = 10 ** 9

def check(m):
    now = 0
    for i in range(N):
        #A[i]-1してるのは、たとえばm=3のときは4,7から回数が増えるため
        now += (A[i]-1) // m
    return now <= K

#差が1になったら終了
while r - l > 1:
    m = (l + r) // 2

    if check(m):
        r = m
    else:
        l = m

print(r)
# Judge status: Accepted
a, b, c, k = map(int, input().split())

if k%2 == 0:
    ans = a-b
else:
    ans = b-a

if abs(ans)> 10**18:
    print('Unfair')
else:
    print(ans)
# 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:
        S += [ab[0]]*ab[1]
    print(S[K-1])
            

if __name__ == '__main__':
    main()
# Judge status: Accepted
if __name__ == '__main__':
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    H = sorted(H)[::-1]
    cnt = 0
    for h in H:
        if K>0:
            K -= 1
        else:
            cnt += h
    
    print(cnt)
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

A.sort()
A.append(-1)

x = A[0]
if x != 1:
    flag = True
    for a in A:
        if a % x != 0:
            flag = False
    if flag:
        print(0)
        exit()

used = [False] * A[-2]
ans = 0
for idx, a in enumerate(A[:-1]):
    if used[a - 1]:
        continue
    if a != A[idx + 1]:
        ans += 1
    for j in range(a, len(used) + 1, a):
        used[j - 1] = True
print(ans)
# Judge status: Wrong Answer

S = list(map(int, list(input())))

mod = 2019
ctr = [0] * mod
p = 1
t = 0
for i, v in enumerate(reversed(S)):
    t = (t + int(v) * pow(10, i, mod)) % mod
    ctr[t] += 1

ans = ctr[0]
for v in ctr[1:]:
    ans += v * (v - 1) // 2
print(ans)
# Judge status: Wrong Answer
N = int(input())
result = 1

for i in range(1, N+1):
  result = (result * i) % (10^9+7)
print(result)
# Judge status: Accepted
from sys import exit
x = int(input())
for a in range(-200, 201):
	for b in range(-200, 201):
		if a**5 - b**5 == x:
			print(a, b)
			exit()
# Judge status: Accepted
d, n = map(int, input().split())
if n == 100:
    print((100 ** d) * n + 100**d)
else:
    print((100**d)*n)
# Judge status: Accepted
N = int(input())
D = {i: 0 for i in range(100)}
for i in range(1, N+1):
  if i % 10 != 0:
    s = str(i)
    D[int(s[0])*10+int(s[-1])] += 1
S = 0
for i in range(10):
  for j in range(10):
    S += D[i*10+j] * D[j*10+i]
print(S)
# Judge status: Accepted
import heapq
n=int(input())
q=[]
p=list(map(int,input().split()))
ans=1
flag=0
q.append(p[0])
heapq.heapify(q)
for i in range(1,n):
  if n==1:
    ans=1
    break
  if p[0]==1:
    break
  if p[i]<q[0]:
    #print("i",i,q[0])
    ans+=1
  heapq.heappush(q,p[i])
print(ans)
# Judge status: Accepted
n,r=map(int, input().split())
print(r+100*(10-n) if n < 10 else r)
# Judge status: Accepted
from collections import deque

int1 = lambda x: int(x) - 1

N, M = map(int, input().split())
G = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int1, input().split())
    G[a].append(b)
    G[b].append(a)

# bfs
ans_lst = [None] * N
ans_lst[0] = 0
D = deque([0])
while D:
    v = D.popleft()
    for x in G[v]:
        if ans_lst[x] is None:
            ans_lst[x] = v
            D.append(x)
print('Yes')
for x in ans_lst[1:]:
    print(x + 1)
# Judge status: Wrong Answer


n=int(input())
a=list(map(int,input().split()))
ans=[]
for i in range(1,n+1):
  ans.append(a.index(i)+1)

print(ans)
# Judge status: Wrong Answer
import sys


def resolve(in_):
    n = int(in_.readline())
    a = list(map(int, in_.readline().split()))
    assert len(a) == n
    a.sort(reverse=True)
    return sum(a[:-1])


def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import math
n,k = map(int,input().split())
alist = list(map(int,input().split()))

max_length = max(alist)
cur_length = 0

while(max_length - cur_length > 1):
    next_length = (max_length+cur_length)//2

    test_k = 0
    for i in range(n):
        test_k += math.ceil(alist[i]/next_length)-1

    if test_k <= k:
        max_length = next_length
    else:
        cur_length = next_length
        

print(max_length)
# Judge status: Accepted
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    T,A = map(int,input().split())
    H = list(map(int,input().split()))
    temp = 10**10
    ans = -1
    for i in range(N):
        if temp > abs(T-H[i]*0.006-A):
            ans = i
            temp = abs(T-H[i]*0.006-A)
            
    print(ans+1)
    
if __name__ == "__main__":
    main()
# Judge status: Accepted
s = input()
q = int(input())

rev = 0
head = []
tail = []

for i in range(q):
    t = input().split()
    if t[0] == "1":
        rev ^= 1
    else:
        if (int(t[1])-1)^rev == 0:
            head.append(t[2])
        else:
            tail.append(t[2])

h = "".join(head)
t = "".join(tail)

if rev == 0:
    print(h[::-1] + s + t)
else:
    s = s[::-1]
    print(t[::-1] + s + h)
# Judge status: Wrong Answer
S = input()
for i in range(ord("a"), ord("z")+1):
  if chr(i) not in S:
    print(chr(i))
    exit()
# Judge status: Wrong Answer
A,B,C,D,E=map(int,input().split())
print(C*60-A*60-E if C*60-A*60-E>=0 else 0)
# Judge status: Wrong Answer
n,m,x,y = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.sort(reverse = True)
b.sort()

if b[0] - a[0] < 1:
    print('War')
else:
    if x == b[0] or y == b[0]:
        print('War')
    elif x == a[0] or y == a[0]:
        print('War')
    else:
        print('No War')
# Judge status: Accepted
import sys
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


S = LS2()
if S[0] == S[1] == S[2] == S[3]:
    print('No')
elif S[0] == S[1] and S[2] == S[3]:
    print('Yes')
elif S[0] == S[2] and S[1] == S[3]:
    print('Yes')
elif S[0] == S[3] and S[1] == S[2]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
s = input()
t = input()
s = s[::-1]
t = t[::-1]
for i in range(len(s)-len(t)+1):
  for j in range(len(t)):
    if s[i+j] != t[j] and s[i+j] != '?':
      break
  else:
    break
else:
  print('UNSTORERABLE')
  exit(0)
s = s[:i] + t + s[i+len(t):]
s = s.replace('?','a')
s = s[::-1]
print(s)
# Judge status: Wrong Answer
n = int(input())
s = str(n)
length = len(s)
ans = 0
for i in range(length):
    x = int(s[i])
    if x < 5:
        ans = ans + x
    else:
        ans = ans + (10 - x)

if int(s[-1]) == 0:
    ans = ans - 1

print(ans + 1)
# Judge status: Wrong Answer
import collections

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

for i in range(a-1,b+1):
  j1 = str(i)
  j2 = ''.join(list(reversed(j1)))
  if j1 == j2:
    ans += 1

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

if a >= b:
    print("delicious")
elif a + x >= b:
    print("safe")
else:
    print("dangerous")
# Judge status: Wrong Answer
s=input()
if(s[2]==s[3] and s[4]==s[5]):
	print("YES")
else:
	print("NO")
# Judge status: Wrong Answer

n=int(input())
s=str(input())
e_cnt=s.count('E')
num=[0]*n #Wの数
num2=[0]*(n+1) #Eno左から数えた数
count=0
count2=0
for i in range(n):
    if s[i]=='W':
        num[i]=count
        num2[i+1]=e_cnt-count2
        count+=1
    else:
        num[i]=count
        num2[i+1]=e_cnt-count2 
        count2+=1
    
   

ans=[0]*n

for i in range(n):
    ans[i]=abs(num[i]+num2[i+1])
print(min(ans))
# Judge status: Accepted
import collections

n = int(input())

l = []
for i in range(n):
    s = input()
    l.append("".join(sorted(s)))

l_2 = collections.Counter(l)
ans = 0
for j in l_2.values():
    ans += int((j*(j-1))/2)

print(ans)
# Judge status: Accepted
N = int(input())
S = input()
r = S.count('R')
g = S.count('G')
b = S.count('B')
c = 0
for i in range(N-2):
  for j in range(i+1,(i+N+1)//2):
    k = j*2-i
    if len(set([S[i], S[j], S[k]]))==3:
      c += 1
print(r*g*b-c)
# Judge status: Wrong Answer
N,Q = [int(zz) for zz in input().split()]
S = input()

li = [0]*N
Aflag = 0
AC = 0
for i in range(N):
    if S[i] == 'A':
        Aflag = 1
    elif S[i] == 'C' and Aflag:
        AC += 1
        Aflag = 0
    li[i] = AC

ans = []
for _ in range(Q):
    l,r = [int(zz)-1 for zz in input().split()]
    ans.append(li[r]-li[l])

[print(i) for i in ans]
# Judge status: Wrong Answer
A, B, C = list(map(int, input().split()))
K = int(input())

c = 0

while A >= B:
    B *= 2
    c += 1
    if c >= K:
        break
    while B >= C:
        C *= 2
        c += 1
        if c >= K:
            break

ans = 0
if A < B < C:
    ans = "Yes"
else:
    ans = "No"

print(ans)
# Judge status: Accepted
c,d=map(int,input().split())
a=max(c,d)
b=min(c,d)
if a-1>=b:
    print(a+a-1)
else:
    print(a+b)
# Judge status: Wrong Answer
import math
n,m = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
cnt,tmp = 0,0
for i in range(n-1):
	for j in range(i+1,n):
		tmp = 0
		for M in range(m):
			tmp += (x[i][M] - x[j][M])**2
			#print(tmp)
			if math.sqrt(tmp).is_integer():
				cnt += 1
print(cnt)
# Judge status: Accepted
def main():
    N = int(input())
    B = list(map(int, input().split()))
    A = [0]*N
    A[0] = B[0]
    for i in range(1, N-1):
        A[i] = min(B[i-1], B[i])
    A[-1] = B[-1]
    print(sum(A))
main()
# Judge status: Accepted
x = int(input())
x11 = x/11
num = [1,2,3,4,5,6]
num2= [7,8,9,10]

if x in num:
  print(1)
  exit()
elif x in num2:
  print(2)
  exit()

elif int(x11) == x11:
  print(int(x11)*2)
  exit()
elif x > int(x11)*11 + 6:
  print(int(x11)*2 +2)
  exit()
else:
  print(1+int(x11)*2)
  exit()
# Judge status: Wrong Answer
x = input()
ans = len(x)
s = 0
t = 0
tar = "S"

for c in x:
    if c == "S":
        if tar == "T":
            ans -= min(s,t)*2
            s,t = 0,0
        s += 1
    else:
        t += 1
    tar = c
else:
    if tar == "T":
        ans -= min(s,t)*2

print(ans)
# Judge status: Accepted
N,K= map(int,(input().split()))
p = list(map(int,input().split()))
rui_p=[]
rui_p.append(0)
sum_p=[]
for i in range(N):
  rui_p.append(rui_p[i]+p[i])
for j in range(K,N+1):
  sum_p.append(rui_p[j]-rui_p[j-K])

msp=max(sum_p)
ans=(msp/2)+(0.5*K)
print(ans)
# Judge status: Accepted
S = input()
 
N = len(S)
for i in range(N):
    for j in range(i, N + 1):
        if S[:i] + S[j:] == "keyence":
            print("YES")
            quit()
print("NO")
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
fw = [a for i,a in enumerate(A) if i%2 == 0]
bw = [a for i,a in enumerate(A) if i%2 == 1]
if len(A) % 2 == 0:
  ans = list(reversed(bw)) + fw
else:
  ans = list(reversed(fw)) + bw
print(' '.join([str(a) for a in ans]))
# Judge status: Accepted
a,b,x=map(int,input().split())
print(b//x - (a-1)//x)
# Judge status: Accepted
from itertools import combinations_with_replacement

n,m,q = map(int,input().split())
abcd = [list(map(int,input().split())) for _ in range(q)]

result = 0

for x in combinations_with_replacement(range(1, m+1), n):
    t = 0
    for a,b,c,d in abcd:
        if x[b-1] - x[a-1] == c:
            t += d
    result = max(result,t)
print(result)
# Judge status: Wrong Answer
s,t=(str,input().split())
a,b=(int,input().split())
u=str(input())

if s==u:
  print (a-1,b)
elif t==u:
  print(a,b-1)
# Judge status: Accepted
N, M = map(int, input().split())
a = list(int(input()) for i in range(M))
DP = [0]*(N+1)
pointer = 0
for i in range(N+1):
    if pointer < M:
        if i == a[pointer]:
          DP[i] = 0
          pointer += 1
          continue
    if i == 0 or i == 1:
        DP[i] = 1
    else:
        DP[i] = (DP[i-1]+DP[i-2])
print(DP[-1]%1000000007)
# Judge status: Accepted
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    s=LIST()
    s.sort()
    a=s.pop(-1)
    if sum(s)>a:
        print('Yes')
    else:
        print('No')
if __name__ == '__main__':
    do()
# Judge status: Wrong Answer
from fractions import gcd
from math import ceil

def lcm(a):
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

def solve(N, M, A):
    num = lcm(A)
    if num > M:
        return 0
    else:
        return ceil(M / (num*2))
    

def main():
    N, M = map(int, input().split())
    A = list(set(int(x)//2 for x in input().split()))
    ans = solve(N, M, A)
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
k,x=input().split()

if 500*k>x:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N,K,S = map(int,input().split(" "))
l = N-K
ans = [S for _ in range(K)]
for i in range(l):
    ans.append(S+1)
print(*ans)
# Judge status: Accepted
nums=[int(e) for e in input().split()]
A=[int(e) for e in input().split()]
B=[int(e) for e in input().split()]

a, b = [0], [0]
for i in range(nums[0]):
    a.append(a[i]+A[i])
for i in range(nums[1]):
    b.append(b[i]+B[i])

ans, j = 0, nums[1]
for i in range(nums[0]+1):
    if a[i] > nums[2]:
        break
    while b[j] > nums[2] - a[i]:
        j -= 1
    ans = max(ans, i+j)

print(ans)
# Judge status: Accepted
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b, c, k = map(int, read().split())
print((a+b+c)-max(a, b, c)+max(a, b, c)*2**k)
# Judge status: Accepted
n, k = map(int, input().split())
x = list(map(int, input().split()))

ans = float('inf')
for i in range(n-k+1):
    l, r = x[i], x[i+k-1]
    if l < 0 and r < 0:
        ans = min(ans, max(abs(l), abs(r)))
    elif l <= 0 and r >= 0:
        ans = min(ans, min(abs(l), r)*2 + max(abs(l), r))
    elif l > 0 and r > 0:
        ans = min(ans, max(l, r))
print(ans)
# Judge status: Accepted
n,t = map(int, input().split())
y = 10**5
for i in range(n):
    c,x = map(int,input().split())
    if x<=t:
        y=min(y,c)
if y != 10**5:
    print(y)
else:
    print("TLE")
# Judge status: Wrong Answer
a,b,c= map(int,input().split())
if a*c>b :print(c)
else:print(b//a)
# Judge status: Accepted
'''
Created on 2020/08/28

@author: harurun
'''
def main():
  import collections
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  S=pin()[:-1]
  a=0
  b=0
  c=0
  for i in S:
    if i=="a":
      a+=1
    elif i=="b":
      b+=1
    else:
      c+=1
  if max(a,b,c)-min(a,b,c)<=1:
    print("YES")
  else:
    print("NO")
  return 
main()
#解説AC
# Judge status: Accepted
x,y=map(int,input().split())
if(x<=8 and y<=8):
    print("Yay!")
else:
    print(':(')
# Judge status: Accepted
#A
S = input()
T = input()

if ((len(T) - len(S)) == 1) and (S == T[0:len(S)]):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n, d = map(int,input().split())
points = []

for i in range(n):
  points.append(list(map(int,input().split())))

def distance(a, b):
  dist = 0
  
  for a, b in zip(a, b):
    dist += (a - n) ** 2

  if dist == 0:
    return False
  return int(dist ** 0.5) ** 2 == dist

count = 0

for pa in points:
  for pb in points:
    if distance(pa, pb):
      count += 1

print(count // 2)
# Judge status: Wrong Answer
K = int(input())
S = input()
SS = (int(len(S)))
if SS-K < 0:
  print(S)
else:
  print((S[:SS-K])+('.'*K))
# Judge status: Wrong Answer
S=input()
a=[]
for i in range(len(S)):
    a.append('×')
print(''.join(a))
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
cnt = 0
while A%2 == B%2 == C%2 == 0:
    x = (B+C)//2
    y = (A+C)//2
    z = (A+B)//2
    A = x
    B = y
    C = z
    cnt += 1
if A == B == C:
    print(-1)
else:
    print(cnt)
# Judge status: Wrong Answer
N = input()

sum = 0

for c in N:
    sum += int(c)
    sum = sum % 9

if sum % 9 == 0:
    ans = "yes"
else:
    ans = "no"

print(ans)
# Judge status: Accepted
a,b,c,k = map(int,input().split())
ans = 0
if a >= k:
    ans += k
    print(ans)
    quit()
else:
    ans += a
    k -= a

if b >= k:
    print(ans)
    quit()
else:
    k-=b
    ans += (-1*k)
    print(ans)
# Judge status: Wrong Answer
# https://atcoder.jp/contests/arc080/tasks/arc080_a

n = int(input())
nums = [int(i) for i in input().split()]

fours = 0
twos = 0
odd = 0
for num in nums:
    if num % 4 == 0:
        fours += 1
    elif num % 2 == 0:
        twos += 1
    else:
        odd += 1

if fours + 1 >= twos + odd:
    print('Yes')
elif fours + 1 >= odd and twos > 1:
    print('Yes')
elif odd == 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

mod = 10**9+7

count = 0

num = sum(A) % mod

ans = 0
for a in A[:-1]:
    num = num-a
    ans = (ans+a*num) % mod

print(ans)
# Judge status: Accepted
n = int(input())
arr = list(map(int, input().split()))
arr.sort()
ans = arr[n//2] - arr[n//2-1]
print(ans)
# Judge status: Accepted
n = input()
print('Yes' if '9' in n else 'No')
# Judge status: Accepted
def abc144b():
    n = int(input())

    start = 1
    end = 9
    flag = False

    # シンプルな全探索
    for i in range(start, end + 1):
        for j in range(start, end + 1):
            if n == i * j:
                flag = True
                break

    if flag:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    abc144b()
# Judge status: Accepted
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    n, m = MI()
    if n == 2 or m == 2:
        print(0)
        sys.exit()
    h = max(n-2, 1)
    w = max(m-2, 1)
    print(h*w)

if __name__ == '__main__':
    main()
# Judge status: Accepted

n = int(input())

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

height = h[0]

q = 0

for i in h:
    if i < height:
        q = 1
        break
    elif i > height:
        height = i-1
    else:
        height = i
        
if q == 1:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
W = ["Sunny","Cloudy","Rainy","Sunny"]
print(W[W.index(input())])
# Judge status: Wrong Answer
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
import math

n,p = iim()
A = iil()

if n > 1:
    even = 0
    odd = 0
    for i in A:
        if i%2 == 0:
            even += 1
        else:
            odd += 1

    p0 = 2**(odd-1)
    print(2**even*p0)
else:
    print(2 if A[0]%2 == p else 0)
# Judge status: Accepted
x,y=map(int,input().split())
if (2*x-y)%3!=0 or (x-2*y)%3!=0:
  print(0)
  exit()
a=(2*x-y)//3
b=(2*y-x)//3
if a<0 or b<0:
  print(0)
  exit()
mod=10**9+7
def comb(x,y):
    s=1
    t=1
    for i in range(1,y+1):
        s=s*(x-i+1)%mod
        t=t*(i)%mod
    return (s*pow(t,mod-2,mod))%mod
print(comb(a+b,min(a,b)))
# Judge status: Accepted
X, Y = map(int, input().split())

for i in range(X+1):
    if i*2+(X-i)*4 == Y:
        print('Yes')
        exit(0)
print('No')
# Judge status: Accepted
from collections import defaultdict
S = input()
d = defaultdict(int)
for c in S:
    d[c] += 1

b = True
for value in d.values():
    if value != 2:
        b = False

if b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x,y = map(int,input().split())
res = 10**32
#print(res)
cnt = 0
for mask in range(1<<2):
    #print(mask)
    _x = x
    _y = y
    if mask & 1:
        _x *= -1 # 最初に反転させる
        cnt += 1
    if mask >> 1 & 1:
        _y *= -1 # 最後に反転させる
        cnt += 1
    if _x <= _y:
        cnt += _y-_x
        res = min(res,cnt)
    cnt = 0
print(res)
# Judge status: Wrong Answer
import math

K=int(input())
a=10
rr=10
if K<10:
  print(K)
else:
  while K>rr:
    if a//10-a%10==-1:
      a+=9
    else:
      a+=1
    rr+=1
        

  print(a)
# Judge status: Wrong Answer
n,a,b=map(int,input().split())
if b<a:
  print(0)
  exit()
  
if a==b:
  print(1)
  exit()
  

n-=2

print(b*n-a*n+1)
# Judge status: Wrong Answer
import math

n = int(input())
m = [int(input()) for _ in range(5)]
min_m = min(m)

x = math.floor(n/min_m) + 5

if n == min_m:
    print(x-1)
else:
    print(x)
# Judge status: Accepted
N, K = map(int, input().split())
ans =  N % K
if N % K > abs(N%K-K):
    ans = abs(N%K-K)
print(ans)
# Judge status: Accepted
s = input()
print(s.rindex("Z") - s.index("A") + 1)
# Judge status: Accepted
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())

ansl=[]
ans=0
for i in range(N):
    if x[i]==y[i]:
        ans+=1
    else:
        ansl.append(ans)
        ans=0
ansl.append(ans)
if max(ansl)>=3:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n=int(input())
print(min(n%1000,1000-n%1000))
# Judge status: Accepted
import string

s = list(map(str, input()))
s = list(set(s))
s.sort()

ans = ""
arr = []

alp = list(map(str, string.ascii_lowercase))
for char in s:
    alp.remove(char)

if len(alp) == 0:
    print("None")
else:
    print(alp[0])
# Judge status: Wrong Answer
x = int(input())

if x != 7 and x != 5 and x != 3:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
N,M = map(int, input().split())
A = [map(int,input().split()) for _ in range(M)]
S = []
for i in A:
    for j in i:
        S.append(j)
for i in range(1,N+1):
    print(S.count(i))
# Judge status: Accepted
from itertools import accumulate
n,k = map(int,input().split())
A = list(map(int,input().split()))
for _ in range(min(k,50)):
    c = [0]*n
    for i,j in enumerate(A):
        l = max(0,i-j)
        r = min(n-1,i+j)
        c[l] += 1
        if r+1 < n:
            c[r+1] -= 1
    A = list(accumulate(c))
print(" ".join(map(str,A)))