Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

for _ in range(K):
    new = [0]*N
    for i in range(N):
        m = max(0,i-A[i])
        new[m] += 1
        if i+A[i]+1 < N:
            new[i+A[i]+1] -= 1
    for i in range(1,N):
        new[i] += new[i-1]
    A = new

A = [str(i) for i in A]
print(" ".join(A))

### FIXED CODE ###

N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

for _ in range(K):
    new = [0]*N
    for i in range(N):
        m = max(0,i-A[i])
        new[m] += 1
        if i+A[i]+1 < N:
            new[i+A[i]+1] -= 1
    A[0] = new[0]
    for i in range(1,N):
        new[i] += new[i-1]
        A[i] = new[i]
    for a in A:
        if a != N:
            break
    else:
        break

A = [str(i) for i in A]
print(" ".join(A))
### BUGGY CODE ###

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():
    a,b,c=INTM()
    abl=b-a+1
    ablist=[i for i in range(a,b+1)]
    #print(ablist)
    ansa=ablist[0:min(c,abl)]
    ansb=ablist[max(0,abl-c):abl]
    #print(ansa,ansb)
    ans=set(ansa) | set(ansb)
    ans=sorted(ans)
    for i in ans:
        print(i)
    
if __name__ == '__main__':
    do()

### FIXED CODE ###

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():
    a,b,c=INTM()
    ans=[]
    for i in range(c):
        ai=a+i
        bi=b-i
        if a<=ai and ai<=b:
            ans.append(ai)
        if a<=bi and bi<=b:
            ans.append(bi)
    ans=sorted(set(ans))
    for i in ans:
        print(i)
    
if __name__ == '__main__':
    do()
### BUGGY CODE ###

def pairORSum(arr, n,mod=10**9+7):
    ans = 0  # Initialize result

    # Consider all pairs (arr[i], arr[j)
    # such that i < j
    for i in range(0, n):

        for j in range(i + 1, n):
            ans = ans + (arr[i] ^ arr[j])
            ans %=mod

    return ans


n=int(input())
A=list(map(int,input().split()))
print(pairORSum(A,n))

### FIXED CODE ###

import numpy as np
mod=10**9+7
n=int(input())
A=np.array(list(map(int,input().split())))

ans=0

for i in range(60):
    cnt=np.count_nonzero(A&1)
    ans +=2**i*cnt*(n-cnt)
    A >>=1

print(ans%mod)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 5 + 100)

n, m = list(map(int, input().split()))
links = [set() for _ in range(n)]
root = set(range(n))
for line in sys.stdin.readlines():
    a, b = list(map(int, line.split()))
    a -= 1
    b -= 1
    links[a].add(b)
    root.discard(b)
root = root.pop()

parent = [-1] * n
depth = [-1] * n


def dfs(v, p, d):
    # print(v, p, d, parent, depth)
    if depth[v] != -1 and depth[v] > d:
        return
    parent[v] = p
    depth[v] = d
    for c in links[v]:
        dfs(c, v, d + 1)


dfs(root, -1, 0)

print('\n'.join(str(p + 1) for p in parent))


### FIXED CODE ###

import sys
from collections import deque

sys.setrecursionlimit(10 ** 5 + 100)

n, m = list(map(int, input().split()))
links = [set() for _ in range(n)]
root = set(range(n))
for line in sys.stdin.readlines():
    a, b = list(map(int, line.split()))
    a -= 1
    b -= 1
    links[a].add(b)
    root.discard(b)
root = root.pop()

parents = [set() for _ in range(n)]
q = deque([(root, -1)])

while q:
    v, p = q.popleft()
    parents[v].add(p)
    if len(parents[v]) > 1:
        continue
    q.extend((c, v) for c in links[v])

fixed = [-1] * n

# print(parents)

q = deque([(root, -1)])
while q:
    v, p = q.popleft()
    pv = parents[v]
    pv.remove(p)
    if len(pv) == 0:
        fixed[v] = p
        q.extend((c, v) for c in links[v])

print('\n'.join(str(p + 1) for p in fixed))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n,q = map(int,input().split())
s = input()
lr = []
for _ in range(q):
    lr.append(list(map(int,input().split())))

for slr in lr:
    l = slr[0]
    r = slr[1]
    if r<n:
        cs = s[l-1:r]
        print(cs.count("AC"))
    else:
        cs = s[l-1:]
        print(cs.count("AC"))





### FIXED CODE ###

import sys
from itertools import accumulate
input = sys.stdin.readline

n,q = map(int,input().split())
s = input()
lr = []
for _ in range(q):
    lr.append(list(map(int,input().split())))

count = [0]
for i in range(0,n-1):
    if s[i] == 'A' and s[i+1] == "C":
        count.append(1)
    else:
        count.append(0)
count.append(0)

flag = list(accumulate(count))

for slr in lr:
    l = slr[0]
    r = slr[1]
    print(flag[r-1] - flag[l-1])
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split(" ")))
result = []

for i in range(1,N+1):
  stu = A.index(i) + 1
  result.append(stu)

print(" ".join(map(str,result)))


### FIXED CODE ###

N = int(input()) + 1
A = list(map(int,input().split(" ")))
A.insert(0,0)
J = [i for i in range(1,N)]

sorted_result = sorted(J , key=lambda i: +A[i])
print(" ".join(map(str,sorted_result)))
### BUGGY CODE ###

def q3():
    N = int(input())
    P = [int(i) for i in input().split()]
    ans = 0
    for i in range(N):
        m = min(P[:i+1])
        if P[i] == m:
            ans += 1
    print(ans)


if __name__ == '__main__':
    q3()


### FIXED CODE ###

def q3():
    N = int(input())
    P = [int(i) for i in input().split()]
    ans = 0
    min_p = P[0]
    for i in range(N):
        if P[i] <= min_p:
            min_p = P[i]
            ans += 1
    print(ans)


if __name__ == '__main__':
    q3()
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
limit=10**18

ans = 1
for i in range(n):
  if a[i] == 0:
    ans = 0
    break
  else:
    ans *= a[i]

if ans > limit:
  print(-1)
else:
  print(ans)


### FIXED CODE ###

# from operator import mul
# from functools import reduce

n=int(input())
a=list(map(int, input().split()))
# limit=10**18

# if 0 in a:
#     print(0)
#     exit()

ans = 1
# ans = reduce(mul, a) #=> 1320

for i in range(n):
  ans *= a[i]
  if ans > 10 ** 18:
  # if a[i] == 0:
  #   break
  # elif (ans*a[i]) > limit:
    ans = -1
    break

for i in range(n):
  if a[i] == 0:
      ans = 0

# if ans > limit:
#   print(-1)
# else:
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy
 
## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))
 
N,K=map(int, input().split())
P = list(map(int, input().split()))


S = []

for i in range(K):
    S.append((P[i]+1)/2)

ans = sum(S)

for i in range(K,N):
    S.pop(0)
    S.append((P[i]+1)/2)
    ans = max(ans, sum(S))


print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
 
## Library
 
import sys
from fractions import gcd
import math
from math import ceil,floor
import collections
from collections import Counter
import itertools
import copy
 
## input
 
# N=int(input())
# A,B,C,D=map(int, input().split())
# S = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]
#    S = []
#    for _ in range(N):
#        S.append(list(input()))
 
N,K=map(int, input().split())
P = list(map(int, input().split()))

S = []

for i in range(N):
    S.append((P[i]+1)/2)

tmp = sum(S[:K])
ans = tmp

for i in range(N-K):
    tmp = tmp - S[i] + S[i+K]
    ans = max(ans, tmp)


print(ans)
### BUGGY CODE ###

def resolve():
    '''
    code here
    '''
    import collections

    H, W = [int(item) for item in input().split()]
    Ch, Cw = [int(item)-1 for item in input().split()]
    Dh, Dw = [int(item)-1 for item in input().split()]
    grid = [[item for item in input()] for _ in range(H)]
    max_num = 10**6
    fp = [[max_num for _ in range(W)] for _ in range(H)]
    
    que = collections.deque([[Ch, Cw, 0]])
    fp[Ch][Cw] = 0
    next_y_x = []
    for i in range(5):
        for j in range(5):
            next_y_x.append([-2 + i, -2 + j])
    next_y_x.remove([0,0])

    while que:
        y, x, w_num = que.popleft()

        for dy, dx in next_y_x:
            ny = y + dy
            nx = x + dx

            if 0 <= ny <= H-1 and 0 <= nx <= W-1:
                if abs(dy) + abs(dx) == 1:
                    if grid[ny][nx] == '.' and fp[ny][nx] > w_num:
                        que.appendleft([ny, nx, w_num])
                        fp[ny][nx] = w_num
                else:
                    nw = w_num +1
                    if grid[ny][nx] == '.' and fp[ny][nx] > nw:
                        que.append([ny, nx, nw])
                        fp[ny][nx] = nw

    if fp[Dh][Dw] != max_num:
        print(fp[Dh][Dw])
    else:
        print(-1)

if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    '''
    code here
    '''
    from collections import deque

    H, W = [int(item) for item in input().split()]
    Ch, Cw = [int(item)-1 for item in input().split()]
    Dh, Dw = [int(item)-1 for item in input().split()]
    grid = [input() for _ in range(H)]
    max_num = 10**6
    fp = [[max_num] * W for _ in range(H)]

    que = deque([[Ch, Cw, 0]])
    fp[Ch][Cw] = 0

    walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]
    warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

    while que:
        y, x, w_num = que.popleft()

        for dy, dx in walk:
            ny = y + dy
            nx = x + dx

            if 0 <= ny <= H-1 and 0 <= nx <= W-1 and grid[ny][nx] == '.' and fp[ny][nx] > w_num:
                que.appendleft([ny, nx, w_num])
                fp[ny][nx] = w_num

        for dy, dx in warp:
            ny = y + dy
            nx = x + dx
            nw = w_num +1

            if 0 <= ny <= H-1 and 0 <= nx <= W-1 and grid[ny][nx] == '.' and fp[ny][nx] > nw:
                que.append([ny, nx, nw])
                fp[ny][nx] = nw

    if fp[Dh][Dw] != max_num:
        print(fp[Dh][Dw])
    else:
        print(-1)

if __name__ == "__main__":
    resolve()
### BUGGY CODE ###

n,m=map(int,input().split())
a=[int(input()) for i in range(m)]
mod=10**9+7

x=1 if 1 not in a else 0
dp=[1,x]+[0]*(n-1)

for i in range(2,n+1):
    if i in a:#階段破損部位は無視する
        continue
    dp[i]=(dp[i-1]+dp[i-2])
print(dp[-1]%mod)

### FIXED CODE ###

n,m=map(int,input().split())
A=[int(input()) for i in range(m)]

ai=0
n1,n2=0,1
for i in range(1,n+1):
      if ai<m and i==A[ai]:
            ai+=1
            n1=n2
            n2=0
      else:
            tmp=n2
            n2=(n1+n2)%1000000007
            n1=tmp
print(n2)
### BUGGY CODE ###

k,s = map(int,input().split())
d = 0
for a in range(0,k+1):
    for b in range(0,k+1):
        for c in range(0,k+1):
            if a+b+c == s:
                d += 1
print(d)

### FIXED CODE ###

k,s = map(int,input().split())
d = 0
for a in range(0,k+1):
    for b in range(0,k+1):
        if 0 <= s-a-b <= k:
                d += 1
print(d)
### BUGGY CODE ###

def solve():
    N = int(input())
    S = input()

    ans = 0
    for i in range(10):
        for j in range(10):
            for k in range(10):
                num = [i,j,k]
                idx = 0
                for digit in S:
                    digit = int(digit)
                    if digit == num[idx]:
                        idx += 1
                    if idx == 3:
                        ans += 1
                        break
    
    print(ans)

if __name__ == '__main__':
    solve()


### FIXED CODE ###

def solve():
    N = int(input())
    S = input()

    cnt = 0
    for i in range(1000):
        target = str(i).zfill(3)
        idx = 0
        for ch in S:
            if ch == target[idx]:
                idx += 1
                if idx == 3:
                    cnt += 1
                    break
    
    print(cnt)

if __name__ == '__main__':
    solve()
### BUGGY CODE ###

N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
mod = 10 ** 9 + 7


def bit(n, k):  # nのkbit目を返す
    return (n >> k) & 1


def bit_count(n):
    return bin(n).count("1")


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

for s in range(1, 1 << N):
    i = bin(s).count("1")  # i人目の男とのマッチング
    for j in range(N):
        if (s >> j) & 1 and A[i-1][j]:
            dp[s] = (dp[s] + dp[s ^ (1 << j)]) % mod

ans = dp[(1 << N) - 1]
print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7


def count_bit_flag(T):
    T = (T & 0x55555555) + ((T >> 1) & 0x55555555)
    T = (T & 0x33333333) + ((T >> 2) & 0x33333333)
    T = (T & 0x0F0F0F0F) + ((T >> 4) & 0x0F0F0F0F)
    T = (T & 0x00FF00FF) + ((T >> 8) & 0x00FF00FF)
    T = (T & 0x0000FFFF) + ((T >> 16) & 0x0000FFFF)
    return T


def main():
    N = int(input())
    A = tuple(tuple(map(int, input().split())) for _ in range(N))

    memo = {i: set() for i in range(N)}
    for bit in range(1, 1 << N):
        memo[count_bit_flag(bit)-1].add(bit)

    dp = [0] * (1 << N)
    dp[0] = 1
    for i, bit_list in enumerate(memo.values()):
        for bit in bit_list:
            for j, a in enumerate(A[i]):
                if a and (bit >> j) & 1:
                    dp[bit] += dp[bit ^ (1 << j)]
                    dp[bit] %= mod
    print(dp[(1 << N) - 1])


if __name__ == "__main__":
    main()
### BUGGY CODE ###

S = input()
MOD = 2019
cnt = [0]*MOD
cur = 0 # 現在考えている部分文字列
cnt[cur] = 1 # 部分文字列'0'も作れると考える
d = 1 # 位を表す
for s in S[::-1]:
    cur += int(s)*d # 新たな桁を追加
    cur %= MOD
    cnt[cur] += 1
    # 後処理
    d *= 10 # 位を上げる
    #d %= MOD # ただし数が巨大になるため、計算量を減らすために剰余をとる
ans = 0
for c in cnt:
    ans += c*(c-1)//2
print (ans)



### FIXED CODE ###

import sys
input = sys.stdin.readline

sys.setrecursionlimit(10**7)
INF = 10**10

N = 2019
cnt = [0] * N
#print (cnt)

def dec(cnt,s):
    new = [0] * N
    for n in range(N):
        idx = (10 * n + s) % N
        new[idx] += cnt[n]
    return new


S = input()[:-1]
ans = 0
for s in S:
    s = int(s)
    cnt = dec(cnt,s)
    cnt[s] += 1
    ans += cnt[0]
    # if cnt[0] != 0:
    #     print (cnt[0])
print (ans)
### BUGGY CODE ###

import math
from collections import defaultdict

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

A = defaultdict(int)
p = 10 ** 9 + 7

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

def fact(n, p=10**9 + 7):
    f = [1]
    for i in range(1, n+1):
        f.append(f[-1]*i%p)
    return f

def invfact(n, f, p=10**9 + 7):
    inv = [pow(f[n], p-2, p)]
    for i in range(n, 0, -1):
        inv.append(inv[-1]*i%p)
    return inv[::-1]

f = fact(30+10**5)
invf = invfact(30+10**5, f)

def comb(a, b):
    return f[a] * invf[b] * invf[a-b] % p

i = 2

while m != 1 and math.sqrt(m) + 1:
    while m % i == 0:
        m //= i
        A[i] += 1
    i += 1

if not A:
    print(n)
    exit()

if m != 1:
    A[m] = 1

n -= 1
ans = 1

for v in A.values():
    ans *= comb(v+n, n)
    ans %= p

print(ans)

### FIXED CODE ###

import math
from collections import defaultdict

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

A = defaultdict(int)
p = 10 ** 9 + 7

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

def fact(n, p=10**9 + 7):
    f = [1]
    for i in range(1, n+1):
        f.append(f[-1]*i%p)
    return f

def invfact(n, f, p=10**9 + 7):
    inv = [pow(f[n], p-2, p)]
    for i in range(n, 0, -1):
        inv.append(inv[-1]*i%p)
    return inv[::-1]

f = fact(30+10**5)
invf = invfact(30+10**5, f)

def comb(a, b):
    return f[a] * invf[b] * invf[a-b] % p

i = 2

while m != 1 and i <= math.sqrt(m) + 1:
    while m % i == 0:
        m //= i
        A[i] += 1
    i += 1

if not A:
    print(n)
    exit()

if m != 1:
    A[m] = 1

n -= 1
ans = 1

for v in A.values():
    ans *= comb(v+n, n)
    ans %= p

print(ans)
### BUGGY CODE ###

import sys
A = list(input())
N = len(A)
uq_list = []


def concatStr(liststr):
    temp = ""
    for _ in liststr:
        temp += _
    return temp

for i in range(0, N):
    for j in range(i, N):
        temp = A.copy()
        temp[i], temp[j] = temp[j], temp[i]
        strings = concatStr(temp)
        if strings not in uq_list:
            uq_list.append(strings)

print(len(uq_list))


### FIXED CODE ###

from collections import Counter
A = input()
N = len(A)
counter = Counter(A)
count = 1


for i in range(0, len(A)):
    counter[A[i]] -= 1
    count += (len(A[(i+1):N]) - counter[A[i]])

print(count)
### BUGGY CODE ###

a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
count=0
while count<c:
  for i in range(100,0):
    if a%i==0 and b%i==0:
      count=count+1
print(i)

### FIXED CODE ###

a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
if a>=b:
  for i in range(101):
    if a%(b-i)==0 and b%(b-i)==0:
      d=d+1
      if d==c:
        print(b-i)
        break
if a<b:
  for i in range(101):
    if a%(a-i)==0 and b%(a-i)==0:
      d=d+1
      if d==c:
        print(a-i)
        break
### BUGGY CODE ###

H,W = map(int, input().split())
A = [[int(a) for a in input().split()] for _ in range(H)]
B = [[int(b) for b in input().split()] for _ in range(H)]

dp = [[[False]*12802 for _ in range(W)] for _ in range(H)]
t = A[0][0]-B[0][0]
if t < 0:
    dp[0][0][-t*2] = True
    dp[0][0][-t*2-1] = True
elif t > 0:
    dp[0][0][2*t-1] = True
    dp[0][0][2*t] = True
else:
    dp[0][0][0] = True

for i in range(H):
    for j in range(W):
        if i > 0:
            for k in range(12802):
                if dp[i-1][j][k]:
                    if k % 2 == 0:
                        num = -k//2
                    else:
                        num = (k+1)//2
                    num += A[i][j]-B[i][j]
                    if num <= 0:
                        idx = -num*2
                    else:
                        idx = num*2-1
                    dp[i][j][idx] = True
                    num -= (-A[i][j]+B[i][j])*2
                    if num <= 0:
                        idx = -num*2
                    else:
                        idx = num*2-1
                    dp[i][j][idx] = True
        if j > 0:
            for k in range(12802):
                if dp[i][j-1][k]:
                    if k % 2 == 0:
                        num = -k//2
                    else:
                        num = (k+1)//2
                    num += A[i][j]-B[i][j]
                    if num <= 0:
                        idx = -num*2
                    else:
                        idx = num*2-1
                    dp[i][j][idx] = True
                    num += (-A[i][j]+B[i][j])*2
                    if num <= 0:
                        idx = -num*2
                    else:
                        idx = num*2-1
                    dp[i][j][idx] = True
                    
for k in range(12802):
    if dp[H-1][W-1][k]:
        ans = k//2 + k%2
        break
        
print(ans)

### FIXED CODE ###

H,W = map(int, input().split())
A = [[int(a) for a in input().split()] for _ in range(H)]
B = [[int(b) for b in input().split()] for _ in range(H)]

C = [[0]*W for _ in range(H)]
num = 80
for i in range(H):
    for j in range(W):
        C[i][j] = abs(A[i][j]-B[i][j])
        
dp = [[0]*W for _ in range(H)]
dp[0][0] |= (1<<num+C[0][0]) | (1<<num-C[0][0])

for i in range(H):
    for j in range(W):
        if i > 0:
            dp[i][j] |= (dp[i-1][j]<<num+C[i][j]) | (dp[i-1][j]<<num-C[i][j])
        if j > 0:
            dp[i][j] |= (dp[i][j-1]<<num+C[i][j]) | (dp[i][j-1]<<num-C[i][j])
            
b = list(bin(dp[-1][-1]))[::-1]
ans = 10**9
for i in range(len(b)):
    if b[i] == "1":
        ans = min(ans, abs(num*(H+W-1)-i))

print(ans)
### BUGGY CODE ###

M=10**9+7;n,k,*A=map(int,open(0).read().split());B=[1];I=[1]*(n+1)
for i in range(1,n+1):B+=[B[-1]*i%M]
for i in range(n+1,0,-1):I[i-1]=pow(B[n],M-2,M)%M if i>n else I[i]*i%M
C=lambda n,k:(B[n]*I[k]*I[n-k],0)[k<0];F=[[0]*(n+1)for _ in"_"*(k+1)];F[0][0]=1
for i in range(k):
 for j in range(n+1):
  for m in range(j+1):F[i+1][j]+=C(j,m)*F[i][m]*C(n-j+m,A[i]-j+m)%M
print(F[k][n]%M)

### FIXED CODE ###

import sys
input = sys.stdin.readline
U = 1000
MOD = 10**9+7
 
fact = [1]*(U+1)
fact_inv = [1]*(U+1)
 
for i in range(1,U+1):
    fact[i] = (fact[i-1]*i)%MOD
fact_inv[U] = pow(fact[U], MOD-2, MOD)
 
for i in range(U,0,-1):
    fact_inv[i-1] = (fact_inv[i]*i)%MOD

def comb(n, k):
    if k < 0 or k > n:
        return 0
    z = fact[n]
    z *= fact_inv[k]
    z %= MOD
    z *= fact_inv[n-k]
    z %= MOD
    return z

n, k = map(int, input().split())
A = list(map(int, input().split()))
F = [[0]*(n+1) for _ in range(k+1)]
F[0][0] = 1
for i in range(k):
  for j in range(n+1):
    for m in range(j+1):
      F[i+1][j] += comb(j, m) * F[i][m] * comb(n-(j-m), A[i]-(j-m))
    F[i+1][j] %= MOD
ans = F[k][n]
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = []
flg = True
for e in a:
    if flg:
        b.append(e)
        flg = False
    else:
        b.insert(0, e)
        flg = True
if n % 2 == 1:
    b.reverse()
print(' '.join(map(str, b)))


### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
b = deque([])
flg = False
if n % 2 == 0:
    flg = True
for e in a:
    if flg:
        b.append(e)
        flg = False
    else:
        b.appendleft(e)
        flg = True
print(' '.join(map(str, b)))
### BUGGY CODE ###

import numpy as np
 
N, Q = (int(x) for x in input().split())
 
dic = {}
for i in range(N) :
    dic[i+1] = []
 
for i in range(N-1) :
    a, b = (int(x) for x in input().split())
    dic[a].append(b)
    for n in dic.keys() :
        if a in dic[n] :
            dic[n].append(b)
 
SUM = [0]*n #np.zeros(N, dtype=np.int)
 
for i in range(Q) :
    p, x = (int(x) for x in input().split())
    SUM[p-1] = SUM[p-1] + x
    for n in dic[p] :
        SUM[n-1] = SUM[n-1] + x
 
print(' '.join(map(str, SUM)))

### FIXED CODE ###


import numpy as np

N, Q = (int(x) for x in input().split())

dic = {}

for i in range(N-1) :
    #a, b = (int(x) for x in input().split())
    a, b = map(int,input().split())
    dic[b] = a

#SUM = np.zeros(N, dtype=np.int)
SUM = [0]*N

for i in range(Q) :
    #p, x = (int(x) for x in input().split())
    p, x = map(int,input().split())
    SUM[p-1] = SUM[p-1] + x

for i in range(N-1) :
    SUM[i+1] += SUM[dic.get(i+2)-1]

print(' '.join(map(str, SUM)))
### BUGGY CODE ###

n,k=map(int,input().split())
h=[int(i) for i in input().split()]
dp=[0]*n
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    dp[i]=min([abs(h[j]-h[i])+dp[j] for j in range(max(0,i-k),i)])
print(dp[-1])

### FIXED CODE ###

n,k=map(int,input().split())
h=[int(i) for i in input().split()]
dp=[0]*n
dp[1]=abs(h[1]-h[0])
for i in range(2,n):
    dp[i]=min([abs(h[j]-h[i])+dp[j] for j in range(max(0,i-k),i)])
print(dp[-1])
### BUGGY CODE ###

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

A.sort()
checked = []
ans = 0
before = 0
first = True
for i in A:
    if before == i and first:
        if flag:
            ans -= 1
        first = False
        continue
    elif before != i:
        first = True
    elif not first:
        continue
    flag = True
    for l in checked:
        if l > i // 2:
            break
        if i % l == 0:
            flag = False
            break
    if flag:
        checked.append(i)
        ans += 1
    before = i

print(ans)

### FIXED CODE ###

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

A.sort()

maxnum = A[-1]
checklist = [True]*(maxnum+1)
before = 0

for a in A:
    if before == a:
        checklist[a] = False
        continue
    num = 2
    while num * a <= maxnum:
        checklist[a * num] = False
        num += 1
    before = a

ans = 0
for i in A:
    ans += checklist[i]
print(ans)