Harryxun/stf_run huggingface dataset:
N, P = map(int,input().split())
A = list(map(int,input().split()))
even = 0
odd = 0

for i in A:
    if i % 2 == 0:
        even += 1
    else:
        odd += 1
#print(even,odd)

import math
def Perm(n, r):
    return math.factorial(n)//math.factorial(n-r)
def comb(n, r):
    return Perm(n, r)//math.factorial(r)

#print("0,0 = ", comb(0,0))

if P == 0:
    ans = 0
    for x in range(odd+2):
        #print(odd, x)
        if x % 2 == 0:
            ans += comb(odd,x)
    ans *= 2**even
    print(ans)
else:
    ans = 0
    for x in range(odd+1):
        if x % 2 == 1:
            if odd != 0:
                ans += comb(odd,x)
    ans *= 2**even
    print(ans)

### FIXED CODE ###

N, P = map(int,input().split())
A = list(map(int,input().split()))
even = 0
odd = 0

for i in A:
    if i % 2 == 0:
        even += 1
    else:
        odd += 1
#print(even,odd)

import math
def Perm(n, r):
    return math.factorial(n)//math.factorial(n-r)
def comb(n, r):
    return Perm(n, r)//math.factorial(r)

#print("0,0 = ", comb(0,0))

if P == 0:
    ans = 0
    for x in range(odd+1):
        #print(odd, x)
        if x % 2 == 0:
            ans += comb(odd,x)
    ans *= 2**even
    print(ans)
else:
    ans = 0
    for x in range(odd+1):
        if x % 2 == 1:
            if odd != 0:
                ans += comb(odd,x)
    ans *= 2**even
    print(ans)
sentence = raw_input()
ans = []

for i in range(26):
  ans.append(0)

for string in sentence:
  string = string.strip()
  for s in string:
    s = s.lower()
    key = ord(s) - ord('a')
    if 0 <= key <= 25:
      ans[key] += 1

for i in range(len(ans)):
  print('{} : {}".format(chr(ord('a') + i), ans[i]) )

### FIXED CODE ###

import sys
 
text = sys.stdin.readlines()
ans = []
for i in range(26):
    ans.append(0)
for i in text:
    i = i.strip()
    for j in i:
        j = j.lower()
        key = ord(j) - ord("a")
        if 0 <= key <= 25:
            ans[key] += 1
for i in range(len(ans)):
    print "{} : {}".format(chr(ord("a") + i), ans[i])
import sys
 
sys.setrecursionlimit(100000)

N, M = map(int, input().split())
memo = [-1]*N
dic = [[] for i in range(N)]
def dfs(dic, memo, v):
    if memo[v] != -1:
        return memo[v]
    plen = 0
    for i in dic[v]:
        plen = max(plen, dfs(dic, memo, i)+1)
    memo[v] = plen
    return plen
for m in range(M):
    x, y = map(int, input().split())
    dic[x-1].append(y-1)
ans = 0
for i in range(N):
    ans = max(ans, dfs(dic, memo, i))
print(ans)

### FIXED CODE ###

N = int(input())
h = [i for i in map(int, input().split())]    
memo = [0] * (N+1)
for i in range(N):
    if i == 0:
        pass
    elif i == 1:
        memo[1] = abs(h[1]-h[0])
    else:
        memo[i] = min(memo[i-1]+abs(h[i]-h[i-1]),  memo[i-2]+abs(h[i]-h[i-2]))
print(memo[N-1])
s = input()
ans = "Good"
for i in range(3)
	if s[i] == s[i+1]:
    	ans = "Bad"

print(ans)

### FIXED CODE ###

s = input()
ans = "Good"
for i in range(3):
    if s[i] == s[i+1]:
        ans = "Bad"
 
print(ans)
N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7

P = []
M = []
zero = 0
for a in A:
    if a > 0:
        P.append(a)
    elif a < 0:
        M.append(a)
    else:
        zero += 1

# 0 を選ぶしかない場合
if len(P) + len(M) < K:
    print(0)
    exit()

P.sort(reverse=True)
M.sort()

# a >= 0 のとき
if len(P) + zero == N:
    ans = 1
    for k in range(K):
        ans *= P[k]
        ans %= MOD
    print(ans)
    exit()

# a <= 0 のとき
if len(M) + zero == N:
    ans = 1
    if K % 2 == 0:
        for k in range(K):
            ans *= M[k]
            ans %= MOD
        print(ans)
    else:
        if zero > 0:
            print(0)
        else:
            M.sort(reverse=True)
            for k in range(K):
                ans *= M[k]
                ans %= MOD
            print(ans)
    exit()

# a に正・負両方含まれる場合
cur_p = 0
cur_m = 0
ans = 1
for k in range(K):
    if cur_p == len(P):
        ans *= M[cur_m]
        cur_m += 1
    elif cur_m == len(M):
        ans *= P[cur_p]
        cur_p += 1
    else:
        if P[cur_p] < abs(M[cur_m]):
            ans *= M[cur_m]
            cur_m += 1
        else:
            ans *= P[cur_p]
            cur_p += 1
    ans %= MOD

if cur_m % 2 == 0:
    print(ans)
else:
    if cur_p == len(P):
        ans *= M[cur_m]
        ans *= pow(P[cur_p - 1], MOD - 2, MOD)
        ans %= MOD
    elif cur_m == len(M):
        ans *= P[cur_p]
        ans *= pow(M[cur_m - 1], MOD - 2, MOD)
        ans %= MOD
    else:
        m1 = M[cur_m - 1]
        p1 = P[cur_p]
        m2 = M[cur_m]
        p2 = P[cur_p - 1]
        if abs(p1 * p2) > abs(m1 * m2):
            ans *= p1
            ans *= pow(m1, MOD - 2, MOD)
            ans %= MOD
        else:
            ans *= m2
            ans *= pow(p2, MOD - 2, MOD)
            ans %= MOD
    print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
MOD = 10 ** 9 + 7


P = []
M = []
zero = 0
for a in A:
    if a >= 0:
        P.append(a)
    elif a < 0:
        M.append(a)

ans = 1
if K == N:
    for a in A:
        ans *= a
        ans %= MOD
    print(ans)
    exit()

ans = 1
if len(P) == 0 and K % 2 == 1:
    M.sort(reverse=True)
    for k in range(K):
        ans *= M[k]
        ans %= MOD
    print(ans)
    exit()

P.sort(reverse=True)
M.sort()
S = 1
LP = len(P)
LM = len(M)
cur_p = 0
cur_m = 0
cnt = 0
ans = 1
while cnt < K:
    if K - cnt == 1 or LM - cur_m <= 1:
        flag = 'p'
    elif LP - cur_p == 1:
        if (K - cnt) % 2 == 1:
            flag = 'p'
        else:
            flag = 'm'
    elif LP - cur_p == 0:
        flag = 'm'
    else:
        p1 = P[cur_p]
        p2 = P[cur_p + 1]
        m1 = M[cur_m]
        m2 = M[cur_m + 1]
        if p1 * p2 >= m1 * m2:
            flag = 'p'
        else:
            flag = 'm'
    
    if flag == 'p':
        ans *= P[cur_p]
        ans %= MOD
        cur_p += 1
        cnt += 1
    else:
        ans *= M[cur_m] * M[cur_m + 1]
        ans %= MOD
        cur_m += 2
        cnt += 2

print(ans)
from numba import njit

import sys
sys.setrecursionlimit(10**9)

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

MOD = 998244353
for _ in range(K):
    L, R = map(int, input().split())
    S |= set(range(L, R + 1))
# print(f'{S=}')

DP = [-1] * (N + 1)
DP[0] = 0
DP[1] = 1


@njit
def f(idx):
    ans = 0
    for s in S:
        if idx - s < 0:
            continue
        if DP[idx - s] == -1:
            DP[idx - s] = f(idx - s)
        ans += DP[idx - s]
    return ans % MOD


ans = f(N)
# print(f'{DP=}')
print(ans)


### FIXED CODE ###

N, K = map(int, input().split())
MOD = 998244353
LR = []
for _ in range(K):
    L, R = map(int, input().split())
    LR.append((L, R))
# print(f'{LR=}')

DP = [0] * (N + 1)
DP[1] = 1
S = [0] * (N + 1)

for i in range(1, len(DP)):
    for L, R in LR:
        v = S[max(i - L, 0)] - S[max(i - R - 1, 0)]
        DP[i] += v
    DP[i] %= MOD
    S[i] = (S[i - 1] + DP[i]) % MOD

# print(f'{DP=}')
# print(f'{S=}')
print(DP[-1])
print(input().reversed)

### FIXED CODE ###

print(input()[::-1])
n = int(input())
print len(set(map(int,[input() for i in range(n)])))

### FIXED CODE ###

n = int(input())
print(len(set(map(int,[input() for i in range(n)]))))
pi = 3.141592
r = int(input())
area = pi*pi*r
length = pi*r*2

print('{:.5f}'.format(area),'{:.5f}'.format(length))


### FIXED CODE ###

pi = 3.14159265359 
r = float(input()) 
area = r*r*pi 
length = 2*r*pi 

print('{:.6f}'.format(area),'{:.6f}'.format(length))
n,k = map(int,input().split())
li = list(map(int,input().split()))
li.sort(reverse=True)
for i in range(k):
    li.remove(li[0])
print(sum(li))

### FIXED CODE ###

n,k = map(int,input().split())
li = list(map(int,input().split()))
lenght = len(li)
li.sort(reverse=True)
if lenght <= k:
    del li[0:lenght]
else:
    del li[0:k]
print(sum(li))
I = lambda : list(map(int,input().split()))
h,w,m=I()
x={};y={}
l=[];dic={}
for i in range(m):
  a,b=I()
  l.append([a,b])
  dic[(a,b)]=1
  x[a]=x.get(a,0)+1
  y[b]=y.get(b,0)+1
p,q=max(x.values()),max(y.values())
a,b=[i for i in x if x[i]==p],[i for i in y if y[i]==q]
an=p+q;fl=0
for i in a:
  for j in b:
    if dic.get((i,j),-1)==-1:
      fl=1;break
  if fl:
    break
an-=(fl==0)
print(an)

### FIXED CODE ###

n,x,t = map(int,input().split())
print((n+x-1)//x*t)
A,B,K = map(int, input().split())
tmp = list(range(A,B+1))
answer = list(set(tmp[0:K]+tmp[-K:]))
answer.sort()
print(*answer, sep='\n')

### FIXED CODE ###

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

ak = [i for i in range(a, min(b + 1, a + k))]
bk = [i for i in range(max(a, b - k + 1), b + 1)]

answer = list(set(ak) | set(bk))
answer.sort()
print(*answer, sep='\n')
import sympy

n=int(input())
t=0
for i in range(1,n+1):
    t=t+(sympy.divisor_count(i)*i)

print(t)


### FIXED CODE ###

n=int(input())
t=0
k=0
for i in range(1,n+1):
   k=n//i
   t+=i*k*(k+1)//2

print(t)
n = list(map(int, input().split()))
for i in range(3)
if n[i] == 7:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

n = list(input())
n = list(map(int, n))
if 7 in n:
    print('Yes')
else:
    print('No')
import fractions
n, m = map(int, input().split())
s = list(input())
t = list(input())
l = n * m // fractions.gcd(n, m)
k = [""] * l
n = l // n
m = l//m
for i in range(l):
    if i % n == 0 and i % m == 0:
        if s[i//n] != t[i//m]:
            ans = -1
            break
else:
    ans = l
print(ans)

### FIXED CODE ###

import fractions
n, m = map(int, input().split())
s = list(input())
t = list(input())
u = fractions.gcd(n, m)
l = n * m // u
n = n//u
m = m // u
for i in range(u):
    if s[i * n] != t[i * m]:
        l = -1
        break
print(l)
print(eval(''join(input().strip().split(' '))))

### FIXED CODE ###

print(eval(''.join(input().strip().split(' '))))
import sys
a=[1]*500000
for i in range(3,999,2):
 x=i*i;if a[i]:a[x//2::i]=[0]*len(a[x//2::i])
for e in map(int,sys.stdin):print([e-1,sum(a[:(e+1)//2])+1][e>4])


### FIXED CODE ###

import sys
m=500000;a=[1]*m
for i in range(3,999,2):
 if a[i//2]:a[i*i//2::i]=[0]*len(a[i*i//2::i])
p=[]
for i in range(m*2):p+=[i-1 if i<4 else p[i-1]+[0,a[i//2]][i%2]]
for e in sys.stdin:print(p[int(e)])
n = int(input())
s = 0
for i in range(len(str(n))):
  s += list(str(n))[i]
if n % s == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
s = 0
for i in range(len(str(n))):
  s += int(list(str(n))[i])
if n % s == 0:
  print("Yes")
else:
  print("No")
x,y=map(int,input())
if x%y==0:
  print(-1)
else:
  print(x)

### FIXED CODE ###

x,y=map(int,input().split())
if x%y==0:
  print(-1)
else:
  print(x)
# coding: utf-8
N = int(input())
D = list(map(int, input().split()))
l = [0] * (N-1)
top = max(D)
mod = 998244353

for i in range(N):
    l[D[i]] += 1
# print(*l)
ans = 1
for i in range(1, top+1):
    if l[i] != 0:
        ans *= l[i-1] ** l[i]
    if l[i] == 0:
        print(0)
        exit()
if D[0] != 0:
    ans = 0
if l[0] != 1:
    ans = 0
    

print(ans % mod)

### FIXED CODE ###

# coding: utf-8
import collections

n=int(input())
d=list(map(int,input().split()))
c = collections.Counter(d)
ans = 1
m=max(d)


for i in range(m):
    ans*=c[i]**c[i+1]
    ans = ans%998244353

if c[0]!=1:
    ans=0
if d[0] != 0:
    ans = 0

# print(c)
print(ans)
safgdsgjhk


### FIXED CODE ###

for i in range(1, 10):
    for j in range(1, 10):
        print(f'{i}x{j}={i * j}')
A,B = map(int,input().split())
if A > B:
    print(A*2 - 1)
elif B > A:
    print(B*2 - 1)
else A = B:
    print(A*2)

### FIXED CODE ###

A, B = map(int,input().split())
if A > B:
    print(int(A) + int(A) - 1)
elif B > A:
    print(int(B) + int(B) - 1)
else:
    print(int(A) + int(A))
n,k,q=map(int,input().split())
ans=[-q]*n
for i in range(q):
  a=int(input())
  ans[a]+=1
  
print('Yes' if x > -k for x in ans else 'No')


### FIXED CODE ###

n,k,q=map(int,input().split())
ans=[-q]*n
for i in range(q):
  a=int(input())
  ans[a-1]+=1
  
for i in range(n):
  print('Yes' if ans[i] > -k else 'No')
n,q = map(int,input().split())
s = input()
t = [0] * (n + 1)
for i in range(q):
  t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)
for i in range(q):
  l,r = map(int,input().split())
  print(t[r+1] - t[l-1])


### FIXED CODE ###

n,q = map(int,input().split())
s = input()
t = [0] * (n + 1)
for i in range(n):
  t[i+1] = t[i] + (1 if s[i:i+2] == "AC" else 0)
for i in range(q):
  l,r = map(int,input().split())
  print(t[r-1] - t[l-1])
import math
n,k = map(int,input().split())
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(1,k+1):
    blue = combinations_count(k-1,i-1)
    red = combinations_count(n-k+1,i)
    print(blue*red%(10**9+7))

### FIXED CODE ###

import math
n,k = map(int,input().split())
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
for i in range(1,k+1):
    blue = combinations_count(k-1,i-1)
    if n-k+1<i:
        red = 0
    else:
        red = combinations_count(n-k+1,i)
    print(blue*red%(10**9+7))
import sys	

num1 = list(map(int, input().split()))
N = num1[0] #参加者数
K = num1[1] #初期ポイント
Q = num1[2] #出た正解の数
ans_list = []
for index1 in range(Q):
	ans_list.append(int(input()))
for index1 in range(1,N+1):
	point = 0
	for index2 in ans_list:
		if index1==ans_list[index2]:
			point +=1

	fin=K+point-Q
	
	if fin <=0:
		print("No")
	else:
		print("Yes")
		

### FIXED CODE ###

N, K, Q = map(int,input().split())
point_list = [0 for i in range(N+1)]
for i in range(Q):
    A = int(input())
    point_list[A]+=1
for i in range(1,N+1):
    if point_list[i]+K-Q<=0:
        print("No")
    else:
        print("Yes")
#ABC131 C
import math
A, B, C, D = (int(_) for _ in input().split())
def ad(X):
    XmodC = X // C
    XmodD = X // D
    CD_lcm = C * D / math.gcd(C, D)
    XmodCD = X // CD_lcm
    return X - (XmodC + XmodD - XmodCD)
print(int(ad(B) - ad(A - 1)))

### FIXED CODE ###

#ABC131 C
import fractions

A, B, C, D = map(int, input().split())
def ad(X):
    XmodC = int(X // C)
    XmodD = int(X // D)
    CD_lcm = int(C * D / fractions.gcd(C, D))
    XmodCD = int(X // CD_lcm)
    return X - (XmodC + XmodD - XmodCD)
ans = ad(B) - ad(A - 1)
print(ans)
n = int(raw_input())
R = []
for i in xrange(n):
    L = raw_input().split()
    order = L[0]
    value = 0
    if len(L) > 1:
        value = int(L[1])
    if order == 'insert':
        R.insert(0, value)
    if order == 'delete':
        R.remove(value)
    if order == 'deleteFirst':
        R.pop(0)
    if order == 'deleteLast':
        R.pop()
print ' '.join(map(str, R))

### FIXED CODE ###

from collections import deque
n = int(raw_input())
R = deque()
for i in xrange(n):
    L = raw_input().split()
    order = L[0]
    value = 0
    if len(L) > 1:
        value = int(L[1])
    if order == 'insert':
        R.appendleft(value)
    if order == 'delete' and value in R:
        R.remove(value)
    if order == 'deleteFirst':
        R.popleft()
    if order == 'deleteLast':
        R.pop()
print ' '.join(map(str, R))
from collections import deque
s = deque(input())
print(s)
le = len(s)
cnt = 0
while le:
  if s[0] == s[-1]:
    s.pop()
    s.popleft()
    le -= 2
  elif s[0] == "x":
    s.popleft()
    cnt += 1
    le -= 1
  elif s[-1] == "x":
    s.pop()
    cnt += 1
    le -= 1
  else:
    print(-1)
    break
  print(s)
else:
  print(cnt)


### FIXED CODE ###

from collections import deque
s = deque(input())
le = len(s)
cnt = 0
while le>1:
  if s[0] == s[-1]:
    s.pop()
    s.popleft()
    le -= 2
  elif s[0] == "x":
    s.popleft()
    cnt += 1
    le -= 1
  elif s[-1] == "x":
    s.pop()
    cnt += 1
    le -= 1
  else:
    print(-1)
    break
else:
  print(cnt)
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0

c500 = X // 500

if c500 > A:
    print(ans)
    exit()

for i in range(c500 + 1):
    c100 = (X - i*500) / 100
    if c100 > B:
        continue
    for j in range(c100 + 1):
        c50 = (X - i*500 - j*100)/50
        if c50 <= C:
           ans += 1

print(ans)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans = 0

c500 = X // 500

if c500 > A:
    c500 = A

for i in range(c500 + 1):
    c100 = (X - i*500) // 100
    if c100 > B:
        c100 = B
    for j in range(c100 + 1):
        c50 = (X - i*500 - j*100) // 50
        if c50 <= C:
           ans += 1

print(ans)
def f(S,start_num,j):
  start=start_num[j-1]
  s=0
  for i in range(0,strat_num[j]-start_num[j-1]):
    if S[start+i]=="WA":
      s=s+1
      continue
    else:
      break
return s

N,M=map(int,input().split())
P_str=[0]*M
S=[0]*M
for i in range(M):
  P_str[i],S[i]=map(str,input().split())
P=[int(P_str[j]) for j in range(M)]

start_num=[0]*N
start_num[0]=1
for i in range(1,M):
    if not P[i-1]==P[i]:
      i=start_num[P[i]-1]

correct=0
for j in range(1,N+1):
  if f(S,start_num,j)<(start_num[j]-start_num[j-1]):
    correct+=1
penalty=0
for j in range(1,N+1):
  penalty+=f(S,start_num,j)

print(correct,"",penalty)

### FIXED CODE ###

N,M=map(int,input().split())
ac=[0]*N
wa=[0]*N

for i in range(M):
  p,s=input().split()
  if s=="WA" and ac[int(p)-1]==0:
    wa[int(p)-1]+=1
  elif s=="AC" and ac[int(p)-1]==0:
    ac[int(p)-1]+=1

penalty=[wa[k] for k in [i for i,j in enumerate(ac) if j!=0]]    
print("%d %d" % (sum(ac),sum(penalty)))
import math


def sieve_of_erastosthenes(target_list):
    for num in target_list:
        input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)]
        input_list[0] = input_list[1] = False
        input_list[2] = input_list[3] = input_list[5] = True
        sqrt = math.sqrt(num)

        for serial in range(3, num, 2):
            
            if serial >= sqrt:
                print(sum(input_list))
                break

            for s in range(serial ** 2, num, serial): 
                input_list[s] = False



if __name__ == '__main__':
    target_list = []

    while True:
        try:
            target_list.append(int(input()))
        except:
            break

    sieve_of_erastosthenes(target_list)

### FIXED CODE ###

a = [True for i in range(1000000)]
i = 3
while i * i < 1000000:
    for j in range(3 * i, 1000000, 2 * i): a[j] = False
    i += 2
 
while True:
    try:
        n = int(input())
    except:
        break
 
    count = int(n >= 2) + sum(a[i] for i in range(3, n + 1, 2))
    print(count)
#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#li=input().split()
#import fractions
#lis=list(map(int,input().split()))

n=int(input())
S=[]
ans=0
firstB,lastA,bothAB=0,0,0

for i in range(n):
    S.append(input())
    flag=0
    for j in range(len(S[-1])-1):
        if S[-1][j:j+2]=="AB":
            ans+=1
    if S[-1][0]=="B":
        firstB+=1
        flag+=1
    if S[-1][-1]=="A":
        lastA+=1
        flag+=1
    if flag==2:
        bothAB+=1
        firstB-=1
        lastA-=1

if firstB==lastA:
    if first==0 and bothAB!=0:
        ans+=bothAB-1
    else:
        ans+=(bothAB+firstB)
else:
    ans+=min(firstB,lastA)+bothAB

print(ans)


### FIXED CODE ###

#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#n=int(input())
#li=input().split()
#import fractions
#lis=list(map(int,input().split()))

n=int(input())
S=[]
ans=0
firstB,lastA,bothAB=0,0,0

for i in range(n):
    S.append(input())
    flag=0
    for j in range(len(S[-1])-1):
        if S[-1][j:j+2]=="AB":
            ans+=1
    if S[-1][0]=="B":
        firstB+=1
        flag+=1
    if S[-1][-1]=="A":
        lastA+=1
        flag+=1
    if flag==2:
        bothAB+=1
        firstB-=1
        lastA-=1

if firstB==lastA:
    if firstB==0 and bothAB!=0:
        ans+=bothAB-1
    else:
        ans+=(bothAB+firstB)
else:
    ans+=min(firstB,lastA)+bothAB

print(ans)
a = int(input())
b = int(input())
nums = [1, 2, 3]

for n in nums:
  if((a != n) and (b != n):
     print(n)


### FIXED CODE ###

a = input()
b = input()
choices = '123'
for c in choices:
  if((c != a) and (c != b)):
    print(c)
a,b= map(int,input().split(" "))
b = int(input())
ar = list(map(int,input().split(" ")))
br = [[0 for i in range(b)] for j in range(a)]
go = "M"
ap = 1
for i in range(a):
    if go == "M":
        for j in range(b):
            if ar[0] == 0:
                del ar[0]
                ap += 1
            br[i][j] = ap
            ar[0] -= 1
        go = "U"
    else:
        for j in range(b-1,-1,-1):
            if ar[0] == 0:
                del ar[0]
                ap += 1
            br[i][j] = ap
            ar[0] -= 1
for r in br:
    for i in range(b-1):
        print(r[i],end=" ")
    print(r[b-1])

### FIXED CODE ###

a,b= map(int,input().split(" "))
c = int(input())
ar = list(map(int,input().split(" ")))
br = [[0 for i in range(b)] for j in range(a)]
go = "M"
ap = 1
for i in range(a):
    if go == "M":
        for j in range(b):
            if ar[0] == 0:
                del ar[0]
                ap += 1
            br[i][j] = ap
            ar[0] -= 1
        go = "U"
    else:
        for j in range(b-1,-1,-1):
            if ar[0] == 0:
                del ar[0]
                ap += 1
            br[i][j] = ap
            ar[0] -= 1
        go = "M"
for r in br:
    for i in range(b-1):
        print(r[i],end=" ")
    print(r[b-1])
w,h,x,y=map(int,input().split())
print((w*h)/2,(2x==w)&(2y==h))

### FIXED CODE ###

w,h,x,y=map(int,input().split())
ans=0
if (2*x==w)&(2*y==h):
  ans=1
print((w*h)/2,ans)
N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
dp = [1] * (M+1)
dpleft = [0] * (M)
MOD = 10 ** 9 + 7
ndp = [1] * (M+1)
for n in range(N):
    for m in range(M):
        if S[n] == T[m]:
            ndp[m+1] = ndp[m] + dp[m+1]
            dpleft[m] = dp[m+1]
        else:
            ndp[m+1] = ndp[m] + dpleft[m]
    dp = ndp[:]
    print(dpleft)
print(dp[-1] % MOD)

### FIXED CODE ###

N, M = map(int, input().split())
S = list(map(int, input().split()))
T = list(map(int, input().split()))
dp = [1] * (M+1)
dpleft = [0] * (M)
MOD = 10 ** 9 + 7
ndp = [1] * (M+1)
for n in range(N):
    for m in range(M):
        if S[n] == T[m]:
            ndp[m+1] = ndp[m] + dp[m+1]
            dpleft[m] = dp[m+1]
        else:
            ndp[m+1] = ndp[m] + dpleft[m]
    dp = ndp[:]
print(dp[-1] % MOD)
n=int(input())
a=list(map(int,input().split()))]
if 0 in a:
    print("0")
    exit()
else:
    ans=1
    for i in range(n):
        ans*=a[i]
        if ans>10**18:
            print("-1")
            exit()

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
if 0 in a:
    print("0")
    exit()
else:
    ans=1
    for i in range(n):
        ans*=a[i]
        if ans>10**18:
            print("-1")
            exit()
    print(ans)
word = {'A':0,'B':1,'C':2,'D':3,'E':4,'F':5,'G':6,'H':7,'I':8,'J':9,'K':10,'L':11,'M':12,'N':13,'O':14,'P':15,'Q':16,'R':17,'S':18,'T':19,'U':20,'V':21,'W':22,'X':23,'Y':24,'Z':25}
word_reverse={v: k for k, v in word.items()}
x=input()
y=input()
Ans=''
for i in x:
  Ans=Ans+word_reverse[word[i]+int(y)]

print(Ans)

### FIXED CODE ###

word = {'A':0,'B':1,'C':2,'D':3,'E':4,'F':5,'G':6,'H':7,'I':8,'J':9,'K':10,'L':11,'M':12,'N':13,'O':14,'P':15,'Q':16,'R':17,'S':18,'T':19,'U':20,'V':21,'W':22,'X':23,'Y':24,'Z':25}
word_reverse={v: k for k, v in word.items()}
x=input()
y=input()
Ans=''
for i in y:
  if word[i]+int(x) > 25:
    z = (word[i]+int(x)) % 26
  else:z=word[i]+int(x)
  Ans=Ans+word_reverse[z]

print(Ans)
n = int(input())
a = list(range(n))
s = 0
for i in range(n):
  a[i] = int(input())
  s += a[i]

t = s  
for i in range(n):
  t_ = t
  t -= a[i]
  if abs(t) >= abs(t_):
    break
print(abs(t_))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
s = 0
for i in range(n):
  s += a[i]

b = []
t = s
for i in range(n-1):
  s -= a[i]
  b.append(abs(t-s*2))
print(min(b))