peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
s = input()
n = len(s)
t = 'keyence'
flg = False
for i in range(8):
  if i == 7:
    u = s[:7]
  else:
    u = s[:i] + s[i-7:]
  if u == t:
    flg = True
    break

if flg:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
s = list(input())
a = [s.count('a'),s.count('b'),s.count('c')]
print("No" if max(a)-min(a)>1 else "Yes")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
x=1000
for i in range(N - 1):
  s = A[i]
  t = A[i +1]
  if s < t:
    k = x//s
    x %= s
    x += k*t

print(x)
# Judge status: Wrong Answer
N= int(input())
list1 =[]
list1 = list(map(int, input().split()))
sum = 0

print(list1)  
for i in range(N-1):
    for j in range(i+1,N):
        
        sum = sum + list1[i]*list1[j]
answer = divmod(sum, 10**9+7)
print(answer[0])
# Judge status: Wrong Answer
S=input()
T=input()

D={}

ans=1
for s,t in zip(S,T):
    x=D.get(t, '')
    print(s,t,x)
    if x=='':
        D[t]=s
    else:
        print(s,t,x)
        if x!=s:
            ans=0
            break
            

print('Yes' if ans else 'No')
# Judge status: Accepted
n,k=map(int,input().split())
s=set()
for i in range(k):
  _=input()
  s|=set(input().split())
print(n-len(s))
# Judge status: Accepted
X = int(input())
for i in range(-500, 500):
    for j in range(-500, 500):
        if i**5 - j**5 == X:            
            ans = [str(i), str(j)]
            break
print(" ".join(ans))
# Judge status: Wrong Answer
x = int(input())

count_a = x// 500
x = x%500
x = x% 100
x = x%50
x = x%10
count_b = x // 5

print(count_a*1000+count_b*5)
# Judge status: Accepted
y, m, d = map(int, input().split('/'))

if y < 2019:
    print('Heisei')
elif y == 2019 and m <= 4:
    print('Heisei')
else:
    print('TBD')
# Judge status: Accepted
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
S = [sr() for _ in range(N)]
se = set(S)
answer = len(se)
print(answer)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = []

nh1 = n//2 - 1
nh2 = nh1 + 1

if a[nh1] == a[nh2]:
    print(0)
else:
    for i in range(a[nh1]+1,a[nh2]+1):
        ans.append(i)

print(len(ans))
# Judge status: Wrong Answer
S = str(input().lower())
if S[2]==S[3] and S[4]==S[5]:
    print("Yes")
else:
    print("NO")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=[0 for i in range(9)]
for i in range(n):
    b[min([a[i]//400,8])]+=1

ans1=len([i for i in b[:8] if i>0])
ans2=ans1+b[8]
ans1=max([ans1,1])
print(ans1,ans2)
# Judge status: Accepted
lis1 = [1,3,5,7,8,10,12]
lis2 = [4,6,9,11]

x,y = map(int,input().split())

if  x in lis1 and y in lis1:
    print("Yes")
elif x in lis2 and y in lis2:
    print("Yes")
elif x == 2 and y ==2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split(' ')]
B = [0] * N
for i in A:
	B[i-1] += 1

for i in B:
	print(i)
# Judge status: Wrong Answer
a, b = map(int, input().split())

x = a if a<=b else b

for _ in range(x):
    print(x, end='')
# Judge status: Wrong Answer
A,B,C=map(int,input().split())

if A==B and B==C and A!=C:
  print('Yes')
elif B==C and C==A and B!=A:
  print('Yes')
elif C==A and A==B and C!=B:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import math
x,k,d=map(int,input().split())
x1=abs(x)
if k*d<x1:
    print(x1-k*d)
else:
    a=math.ceil(x1/d)
    if (k-a)%2==0:
        print(abs(x1-d*a))
    else:
        print(abs(x1-d*(a-1)))
# Judge status: Accepted
import collections
n=int(input())

A=[]
for i in range(n):
    s=sorted(input())
    t=''.join(s)
    A.append(t)

r=collections.Counter(A)
r=r.most_common()

cnt=0
for j in range(len(r)):
    if r[j][1]==1:
        cnt+=0
    else:
        cnt+=((r[j][1]-1)*r[j][1])//2
print(cnt)
# Judge status: Accepted
n,x = map(int,input().split())
a = sorted(map(int,input().split()))
ans = 0

for i in a[:-1]:
    if i <= x:
        ans += 1
        x -= i
    else:
        break
        
if x == a[-1]:
    ans += 1
    
print(ans)
# Judge status: Accepted
N = int(input())

d = {}
w1 = []
f = False
for i in range(N):
    w = input()

    if d.get(w) is None:
        d[w] = 1
    else:
        f = True

    w1.append(w)

for i in range(1, N):
    if w1[i-1][-1] == w1[i][0]:
        continue
    else:
        f = True

print('Yes' if f is False else 'No')
# Judge status: Accepted
s = input()
win=[]
for i in range(len(s)):
    win.append("x")            
final_list=''.join(win)

print (final_list)
# Judge status: Accepted
from collections import Counter

n = int(input())
s = [input() for _ in range(n)]

c = Counter(s[0])
for i in range(1,len(s)):
    c &= Counter(s[i])

ans=''
for letter, cnt in c.items():
    ans += letter*cnt

print(*sorted(ans), sep='')
# Judge status: Accepted
import sys
import math
from collections import Counter

s = sys.stdin.readline().strip()

if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
(N,D) = list(map(int,input().split()))
d = D * 2 + 1
print ((N+d-1)//d)
# Judge status: Accepted
N,X = map(int,input().split())
L =[0] + list(map(int,input().split()))

D = [0 for i in range(N+2)]
cnt = 1
for i in range(2,N+2):
  D[i] = D[i-1] + L[i-1]
  if D[i] > X:
    break
  else:  
    cnt += 1
print(cnt)
# Judge status: Accepted
n=int(input())
m=n//100
l=n%100
if l<=5*m:
  print("1")
else:
  print("0")
# Judge status: Accepted
from collections import defaultdict
d=defaultdict(int)
for i in range(int(input())):
    d[input()]+=1
ans=[]
d=list(d.items())
d.sort(key=lambda x:-x[1])

m=d[0][1]
for i,j in d:
    if m==j:
        ans+=[i]
    else:
        break

for i in sorted(ans):
    print(i)
# Judge status: Accepted
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

x = I()
if x == 0:
    print(1)
else:
    print(0)
# Judge status: Accepted
a,b,c = map(int, input().split())
k = int(input())

m = max(a,b,c)
re = sum([a,b,c]) - m
print(re + m*2**(k))
# Judge status: Accepted
# Begin Header {{{
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
# }}} End Header
# _________コーディングはここから！！___________
n = int(input())
if n%1000 == 0:
    print(0)
else:
    print(1000-n%1000)
# Judge status: Wrong Answer
n = int(input())
dic = {}

for i in range(n):
  temp = input()
  try:
    dic[temp] += 1
  except:
    dic[temp] = 0

dic = dict(sorted(dic.items(), key=lambda x: x[0]))

for i in dic.keys():
  print(i)
# Judge status: Wrong Answer
n = int(input())
s = list(input())

l = [0]*n
l[n-1] = s[:n-1].count('E')
for i in range(n-1):
  w_side = s[:i].count('E')
  e_side = s[i+1:].count('W')
  l[i] = w_side + e_side
  
print(min(l))
# Judge status: Wrong Answer
W, H, N = map(int, input().split())
b = [0, 0, W, 0, H]
for _ in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        b[a] = max(b[a], x)
    elif a == 2:
        b[a] = min(b[a], x)
    elif a == 3:
        b[a] = max(b[a], y)
    else:
        b[a] = min(b[a], y)
# print('b', b)
_W = b[2] - b[1]
_H = b[4] - b[3]
# print('_W, _H', _W, _H)
ans = _W * _H
print(0 if ans < 0 else ans)
# Judge status: Accepted
A,B=map(int,input().split())
c=min([(A+B)%3,A%3,B%3])
print(['Possible','Impossible'][c!=0])
# Judge status: Accepted
d = int(input())
c = list(map(int,input().split()))
data = [0]*(26)
ans = 0
for i in range(1,d+1):
    s = list(map(int,input().split()))
    L = []
    for j in range(26):
        sub = s[j]
        for k in range(26):
            if j == k:
                continue
            sub -= c[k]*(i-data[k])
        L.append(sub)
    out = L.index(max(L))
    print(out+1)
    data[out] = i
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

plus_2 = 0
minus = 0
for a, b in zip(A, B):
    if a < b:
        plus_2 += (b-a)//2
    else:
        minus += a-b

if plus_2 >= minus:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n=int(input())
print(n%1000)
# Judge status: Accepted
name = str(input())
nickname = name[:3]

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

i = 0
base = 1
digits = ''

while n!= 0:
  if n % (base*2) == 0:
    digits += '0'
  else:
    digits += '1'
    n -= base 
  
  i += 1
  base *= -2

if digits=='':
  digits='0'
  
print(digits[::-1])
# Judge status: Accepted
def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()
    BC = [tuple(map(int, input().split())) for _ in range(M)]
    BC.sort(key=lambda x: x[1], reverse=True)
    D = []
    for b, c in BC:
        D.extend([c] * b)
        if len(D) >= N:
            break
    D = D[:N]
    r = sum(A)
    for a, d in zip(A, D):
        r = max(r, r - a + d)
    print(r)

main()
# Judge status: Wrong Answer
n, k = map(int,input().split(" "))
trees = []
for i in range(n):
    trees.append(int(input()))

trees.sort()
min_val = 0
for i in range(len(trees) - 1):
    min_val = min(abs(trees[i+1] - trees[i]), min_val)
    
print(min_val)
# Judge status: Accepted
n,k=map(int,input().split())

if k==1:
    print(0)
elif n>k:
    print(k-(n%k))
else:
    val=k-n
    if n<val:
        print(n)
    else:
        print(val)
# Judge status: Wrong Answer
n=int(input())
vlis=list(map(int,input().split()))
while len(vlis)>=2:
	tlis=[]
	for i in range(len(vlis)-1):
		t=(vlis[i]+vlis[i+1])/2
		tlis.append(t)
	vlis.insert(tlis.index(min(tlis)),min(tlis))
	for i in range(2):
		vlis.pop(tlis.index(min(tlis))+1)
		
print(vlis[0])
# Judge status: Accepted
#AIsing2020 b

import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
A =[0]+list(map(int,input().split()))
count = 0
for i in range(1,N+1,2):
    if A[i]%2 ==1:
        count +=1
print(count)
# Judge status: Accepted
N, M = map(int, input().split())
answer = [0 for _ in range(N)]

for _ in range(M):
    s, c = map(int, input().split())

    if not N == 1:
        if s == 1 and c == 0:
            print(-1)
            exit()

    if answer[s-1] == 0:
        answer[s-1] = c
    else:
        if not answer[s-1] == c:
            print(-1)
            exit()

if answer[0] == 0 and not N == 1:
    answer[0] = 1

print("".join(list(map(str, answer))))
# Judge status: Accepted
# https://atcoder.jp/contests/abc144/tasks/abc144_d

from math import pi, tan, atan, degrees

a, b, x = [int(i) for i in input().split()]

theta = (pi * 0.5) - atan(2 * x / (a * b**2))

if b * tan(pi * 0.5 - theta) <= a:
    print(degrees(theta))

else:
    theta = atan(((2 * b) / a) - (2 * x / a**3))
    print(degrees(theta))
# Judge status: Wrong Answer
import statistics
n=int(input())
r=set([])
x=[[]]*n
for i in range(n):
  a,b=list(map(int,input().split()))
  x[i]=[a,b]
r0=statistics.median([x[z][0] for z in range(n)])
r1=statistics.median([x[z][1] for z in range(n)])
if ((r0*2) % 2)>0 or ((r1*2) % 2)>0:
  mult=2
else:
  mult=1
mult=int((r1-r0)*mult+1)
print(mult)
# Judge status: Accepted
N, K = map(int, input().split())
H = list(map(int, input().split()))


if len(H) <= K:
    print('0')
else:
    HA = sorted(H)
    HA = HA[:len(H) - K]
    print(str(sum(HA)))
# Judge status: Accepted
from numba import jit
N, K = map(int, input().split())
A = list(map(int, input().split()))

@jit
def solve(k,n,a):
    for _ in range(k):
        Y = [0]*(n+1)
        for i, x in enumerate(a):
            Y[max(0, i-x)] += 1
            Y[min(n, i+x+1)] -= 1
        for j in range(1, n):
            Y[j] += Y[j-1]
        if a == Y[:-1]:
            break
        a = Y[:-1]
    return a

ans=solve(K,N,A)
print(*ans)
# Judge status: Wrong Answer
def main():
    a,v = map(int,input().split())
    b,w = map(int,input().split())
    t = int(input())
    if v == w:
        print('NO')
        return 0
    if a-b < 0 and v-w < 0:
        print('NO')
        return 0
    if a-b > 0 and v-w > 0:
        print('NO')
        return 0
    if abs((a-b)/(v-w)) <= t:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()
# Judge status: Accepted
s=input()
s=list(s)
s_c = s.count('R')
if s[1]=='S' and s_c==2:
  s_c=1
print(s_c)
# Judge status: Accepted
N, M = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(M)]


x = set()
for a, b in AB:
    if a == 1:
        x.add(b)
    if b == 1:
        x.add(a)

f = False

for a, b in AB:
    if (a in x and b == N) or (b in x and a == N):
        f = True

if f:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    ans = False
    p = 0
    for i in range(N):
        D = list(map(int, input().split()))
        if D[0] == D[1]:
            p += 1
        else:
            p = 0
        if p == 3:
            ans = True
            break
    if ans:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
blocks = list(map(int, input().split()))
target = 1
for block in blocks:
  if block == target:
    target += 1
print(N-target+1)
# Judge status: Wrong Answer
n = int(input())
an = list(map(int, input().split()))
ans = 10*9
for i in range(min(an), max(an)+1):
    check = 0
    for a in an:
        check += (a-i)**2
    if ans >= check:
        ans = check
print(ans)
# Judge status: Accepted
N = int(input())
A = sorted(list(map(int,input().split())))
B = sorted(list(map(int,input().split())))
C = sorted(list(map(int,input().split())))
ans = 0
import bisect
b = []
for i in B:
    x = bisect.bisect_right(C,i)
    b.append(N-x)
y = sum(b)
c = [y]
for i in range(1,N):
    y -= b[i-1]
    c.append(y)
c.append(0)
for i in A:
    a = bisect.bisect_right(B,i)
    ans += c[a]
print(ans)
# Judge status: Accepted
N = str(input())

if N[-1] in ('2', '4', '5', '7', '9'):
  print('hon')
elif N[-1] in ('0', '1', '6', '8'):
  print('pon')
elif N[-1] in ('3'):
  print('bon')
# Judge status: Accepted
#!/usr/bin/env python3

# from numba import njit

# input = stdin.readline

# @njit
def solve(d,next="A"):
  while len(d[next]) != 0:
    next = d[next].pop(0)
  return next



def main():
  d = {}
  d["A"] = list(input().upper())
  d["B"] = list(input().upper())
  d["C"] = list(input().upper())
  print(solve(d))
  return

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

count = 0
for i in range(n):
  m = n // (i+1)
  count += (i+1)*m*(m+1)/2

print(int(count))
# Judge status: Wrong Answer
N =int(input())
SIX  = [6**i for i in range(1,7)]
NINE = [9**i for i in range(1,5)]
SIX.extend(NINE)
SIX.append(1)
SIX = sorted(SIX,reverse=True)
N2 =N
cnt=0
for s in SIX:
    if N2 >=s:
        
        P,N2 = divmod(N2,s)
        cnt+=P
    
print(cnt)
# Judge status: Accepted
n, l = map(int, input().split())
taste, taste_abs = [l + i for i in range(n)], [abs(l + i) for i in range(n)]
index = taste_abs.index(min(taste_abs))
taste.pop(index)
print(sum(taste))
# Judge status: Wrong Answer
N = int(input())
if N%10 == [2,4,5,7,9]:
  print('hon')
elif N%10 == [0,1,6,8]:
  print('pon')
else:
  print('bon')
# Judge status: Accepted
def main():
    from builtins import int, map, list, print, min
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    A,B,C,K = input_number_list()
    ans = min(A,K)
    K -= A+B
    if K>0:
        ans -= min(C,K)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())), reverse=True)
q = sorted(list(map(int, input().split())), reverse=True)
r = sorted(list(map(int, input().split())), reverse=True)

p = p[:x]
q = q[:y]
a = p + q + r 
a = sorted(a, reverse=True)
print(sum(a[:(x+y)]))
# Judge status: Accepted
from collections import*
n=input()
a=list(map(int,input().split()))
d=dict(Counter(a))
mod=998244353
ans=a[0]==0 and d[0]==1
for i in d:
  if i==0:continue
  ans*=pow(d.get(i-1,0),d[i],mod)
  ans%=mod
print(ans)
# Judge status: Accepted
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8') 
inf = float('inf') ;mod = 10**9+7 
mans = inf ;ans = 0 ;count = 0 ;pro = 1

s = input()
now = 100000000000
for i in range(len(s)-2):
    chk = abs(753 - int(s[i:i+3]))
    if i == 0:
        now = chk
    elif chk < now:
        now = chk
print(now)
# Judge status: Accepted
from bisect import bisect_left
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        ans += bisect_left(l, l[i] + l[j]) - j - 1
print(ans)
# Judge status: Accepted
import heapq
n,m = map(int,input().split())
lst = [0 for _ in range(m)]
dic = {}
for i in range(n):
    a,b = map(int,input().split())
    if a in dic:
        dic[a].append(-b)
    else:
        dic[a] = [-b]
q = []
heapq.heapify(q)
ans = 0
for i in range(1,m+1):
    if i in dic:
        for j in range(len(dic[i])):
            heapq.heappush(q,dic[i][j])
    if q:
        ans -= heapq.heappop(q)
print(ans)
# Judge status: Accepted
#!/usr/bin/env python

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**6)
INF = float("inf")

from bisect import bisect_right

def main():
    N = int(input())
    L = list(map(int,input().split()))

    L.sort()
    ans = 0
    for b in range(N):
        for a in range(b+1,N):
            upper = b
            lower = bisect_right(L, L[a] - L[b])
            ans += max(0, upper - lower)
    
    print(ans)
    
if __name__ == "__main__":
    main()
# Judge status: Accepted
N=input()
a=0
k=0
for i in range(len(N)-1,-1,-1):
    n=int(N[i])+k
    if n<6:
        a+=n
        if n==5 and i!=0 and int(N[i-1])>4:
            k=1
        else:
            k=0
    elif n!=10:
        a+=10-n
        k=1
    else:
        a+=0
        k=1
a+=k
print(a)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
nA = []
for i in range(N):
    nA.append([str(A[i]), str(i + 1)])
nA.sort(key=lambda x: x[0])
ans = list(map(list, zip(*nA)))[1]
print(' '.join(ans))
# Judge status: Accepted
x,y,a,b,c = map(int,input().split())
r = sorted([i for i in map(int,input().split())],reverse = True)[0:x]
g = sorted([i for i in map(int,input().split())],reverse = True)[0:y]
n = sorted([i for i in map(int,input().split())],reverse = True)
com = sorted(r + g + n,reverse = True)
print(sum(com[0:x + y]))
# Judge status: Accepted
n=int(input())
s=list(input())
r=[]
g=[]
b=[0]*n
for i in range(len(s)):
	if s[i]=="R":
		r.append(i)
	if s[i]=="G":
		g.append(i)
	if s[i]=="B":
		b[i]=1
ans=0
s=sum(b)
for i in r:
	for j in g:
		ans+=s
		if 0<=2*j-i and 2*j-i<n:
			ans-=b[2*j-i]
		if (i+j)%2==0:
			ans-=b[(i+j)//2]
		if 0<=2*i-j and 2*i-j<n:
			ans-=b[2*i-j]
print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
if x>0 and y>0:
    if x<=y:
        print(y-x)
    else:
        print(x-y+2)
elif x<0 and y<0:
    if x<=y:
        print(y-x)
    else:
        print(x-y+2)
else:
    if y==0 or x==0:
        if y<0 or x>0:
            print(abs(y)+abs(x)+1)
        else:
            print(abs(y)+abs(x))
    else:
        print(abs(abs(x)-abs(y))+1)
# Judge status: Wrong Answer
import sys
N=input()
A=map(int, sys.stdin.readline().split())
B=map(int, sys.stdin.readline().split())
A.sort()
B.sort()

for a,b in zip(A,B):
    if a>b:
        print "No"
        quit()
else:
    print "Yes"
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N = int(input())
    S = input().strip()
    T = input().strip()

    x = 0
    for i in range(N):
        if S[i:] == T[:N - i]:
            x = N - i
            break

    print(N * 2 - x)


    

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
import sys
S = list(input())
s = list(set(S))
s.sort()
alfa = [chr(ord("a")+i) for i in range(26)]
ans = 0
if(len(s)==len(alfa)):
  print('None')
else:
  for i in range(len(s)):
    if(s[i]!=alfa[i]):
      print(alfa[i])
      sys.exit()
# Judge status: Accepted
from scipy.special import comb
n, p = map(int, input().split())
A = list(map(int, input().split()))
cnt_o = len([a for a in A if a%2 == 1])
cnt_e = n - cnt_o
sum_comb_o = 0  # 奇数からとる組み合わせの和
for i in range(n+1):
    if p == 0 and i%2 == 0:
        sum_comb_o += comb(cnt_o, i, exact=True)
    elif p == 1 and i%2 == 1:
        sum_comb_o += comb(cnt_o, i, exact=True)
print(2**cnt_e * sum_comb_o)
# Judge status: Accepted
N = int(input())
X = []
for i in range(N):
    x,l=map(int,input().split())
    X.append([x-l,x+l])

X = sorted(X, key=lambda x:x[1])
a = X[0][0]-1
ans = 0
for i in range(N):
    if X[i][0] >= a:
        a =X[i][1]
        ans +=1
    else:
        continue
print(ans)
# Judge status: Accepted
n,a,b = map(int,input().split())
m = 10**9 + 7
comb_a = 1
comb_b = 1

a_num = list(range(1,a+1))
j = 0
for i in range(1,a+1):
    comb_a *= (n-i+1)
    comb_a *= pow(a_num[i-1],m-2,m)
    comb_a = comb_a % m

b_num = list(range(1,b+1))
j = 0
for i in range(1,b+1):
    comb_b *= (n-i+1)
    comb_b *= pow(b_num[i-1],m-2,m)
    comb_b = comb_b % m

ans = pow(2,n,m) - comb_a - comb_b - 1
print(int(ans) % m)
# Judge status: Wrong Answer
c = []
for _ in range(3) :
    c += [list(map(int, input().split()))]
a1 = c[1][0]-c[0][0]
a2 = c[2][0]-c[0][0]
c1 = [c[0][i] + a1 for i in range(3)]
c2 = [c[0][i] + a2 for i in range(3)]
if c[1] == c1 and c[2] == c2 :
    print("yes")
else :
    print("no")
# Judge status: Accepted
n=int(input())
a=sorted(list(map(int,input().split())),reverse=True)
ans=0
for i in range(n):
    if i%2==0:
        ans+=a[i]
    else:
        ans-=a[i]
print(ans)
# Judge status: Accepted
from fractions import gcd
N = int(input())
A = list(map(int,input().split()))

lg = [A[0]]
for a in A[1:]:
    lg.append(gcd(lg[-1], a))

rg = [A[-1]]
for a in reversed(A[:-1]):
    rg.append(gcd(rg[-1], a))
rg.reverse()

ans = max(lg[-2], rg[1])
for l,r in zip(lg,rg[2:]):
    g = gcd(l,r)
    ans = max(ans, g)
print(ans)
# Judge status: Accepted
n = int(input())
balls = list(map(int, input().split()))
conbi = [0]*n
for i in balls:
    conbi[i-1] +=1
result = 0
for j in range(n):
    result += (conbi[j]*(conbi[j]-1))//2
for k in balls:
    print(result-conbi[k-1]+1, end=" ")
# Judge status: Accepted
n, a, b = map(int, input().split())
mod = pow(10, 9) + 7

def comb(N, x):
    numerator = 1
    for i in range(N-x+1, N+1):
        numerator = numerator * i % mod
    denominator = 1
    for j in range(1, x+1):
        denominator = denominator * j % mod
    d = pow(denominator, mod-2, mod)
    return numerator * d

a = comb(n, a)
b = comb(n, b)

print((pow(2, n, mod) -1 -a -b) % mod)
# Judge status: Wrong Answer
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

N, K = i_l()
x = i_l()

ans = 1 << 31
for i in range(N-K+1):
    if x[i] >= 0:
        ans = min(ans, x[i+K-1])
    elif x[i+K-1] <= 0:
        ans = min(ans, x[i])
    elif x[i] <= 0 and 0 <= x[i+K-1]:
        ans = x[i+K-1] - x[i] + min(abs(x[i+K-1]), abs(x[i]))

print(ans)
# Judge status: Wrong Answer
n= int(input())
cnt = 1
for i in range(1,n+1):
  cnt *= i
print(cnt)