Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
h, w = map(int, raw_input().split())

matrix = []

matrix.append(list('.'*(w+2)))
for i in range(w):
    matrix.append(['.'] + list(raw_input()) + ['.'])
matrix.append(list('.'*(w+2)))

for i in range(1, h+1):
    for j in range(1, w+1):
        if matrix[i][j] == '#':
            if matrix[i+1][j] == '#' or matrix[i-1][j] == '#' or matrix[i][j-1] == '#' or matrix[i][j+1] == '#':
                continue
            else:
                print 'No'
                exit()
print 'Yes'


### FIXED CODE ###

#!/usr/bin/env python3
H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]

# yoko
for i in range(H):
    for j in range(W-1):
        if (M[i][j] == '#' or M[i][j] == 'M') and (M[i][j+1] == '#' or M[i][j+1] == 'M'):
            M[i][j] = 'M'
            M[i][j+1] = 'M'

#tate
for j in range(W):
    for i in range(H-1):
        if (M[i][j] == '#' or M[i][j] == 'M') and (M[i+1][j] == '#' or M[i+1][j] == 'M'):
            M[i][j] = 'M'
            M[i+1][j] = 'M'

ret = 0
for m in M:
    ret += m.count('#')

if ret == 0: print('Yes')
else: print('No')
raw = raw_input().split()                                                                              
a = int(raw[0])                                                                                        
b = int(raw[1])                                                                                        
c = int(raw[2])                                                                                        
d = int(raw[3])                                                                                        
e = int(raw[4])                                                                                        
k = int(raw[5])                                                                                        
                                                                                                       
if b - a <= k or c - b <= k or d - c <= k or d - e <= k:                                               
    print 'Yay!'                                                                                       
else:                                                                                                  
    print ':(' 

### FIXED CODE ###

raw = raw_input()
a = int(raw)
raw = raw_input()                                  
b = int(raw)
raw = raw_input()                                  
c = int(raw)
raw = raw_input()                                  
d = int(raw)
raw = raw_input()                                  
e = int(raw)
raw = raw_input()                                  
k = int(raw)
                                                                                                       
if e - a > k:
    print ':('
else:                                                                                                  
    print 'Yay!'
def main():
    n = input()
    D = []
    O = []
    for i in range(n):
        c, k = raw_input().split()
        if c == 'insert':
            D.append(k)
        else:
            O.append(search(D,k))

    for item in O:
        print item

    return 0


def search(D,k):
    Dc = D[:]
    o = 'no'
    while Dc != []:
        d = Dc.pop()
        if d == k:
            o = 'yes'
            break

    return o
            

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n = input()
    S = map(int,raw_input().split())
    q = input()
    T = map(int,raw_input().split())
    m = 0
    for i in range(q):
        t = T.pop()
        for j in range(n):
            s = S[j]
            if t == s:
                m += 1
                break
                
    print m

if __name__ == "__main__":
    main()
N = int(input())
A = list(map(int, input().split()))
AA = [0] * (N)
for i in range(N):
    AA[i] = list(format(A[i], 'b'))

ans = [0] * 22
for i in range(N):
    AA[i].reverse()
    for j in range(len(AA[i])):
        ans[j] += int(AA[i][j])

ret = []
for i in range(N):
    temp = 0
    for j in range(len(AA[i])):
        if (ans[j] - int(AA[i][j])) % 2 == 1:
            temp += 1 << j

    ret.append(temp)

print(*ret)

### FIXED CODE ###

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

AA = [0] * (N)
for i in range(N):
    AA[i] = list(format(A[i], 'b').zfill(42))

ans = [0] * 42
ma = 0
for i in range(N):
    AA[i].reverse()
    for j in range(len(AA[i])):
        ma = max(ma, j)
        ans[j] += int(AA[i][j])

ret = []
for i in range(N):
    temp = 0
    for j in range(ma):
        if (ans[j] + int(AA[i][j])) & 1 == 1:
            temp += 1 << j

    ret.append(temp)

print(*ret)
n = int(input())
li = list()
for i range(n):
	li.append(str(input()))

print(len(set(li)))



### FIXED CODE ###

n = int(input())
li = list()
for i in range(n):
	li.append(str(input()))

print(len(set(li)))
numberinput= int(raw_input())
letterinput= raw_input()
if numberinput%2==1:
	print("No")
else:
  	if letterinput[:len(letterinput)//2]==letterinput[len(letterinput)//2:]
    	print("Yes")
    else:
        print("No)      

### FIXED CODE ###

n=int(raw_input())
ch=raw_input()
if ch[:n//2]==ch[n//2:]:
        print('Yes')
else:
        print('No')
a = int(input())
b = int(input())
print(a*b)

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
import collections

n=int(input())
As=list(map(int,input().split()))
ls=collections.Counter(As)
subd={}
an=ls.values()
for k in l:
  ans+=k*(k-1)//2
sans=ans

for i in As:
  ans=sans+1-ls[i]
  print(ans)


### FIXED CODE ###

import collections

n=int(input())
As=list(map(int,input().split()))
ls=collections.Counter(As)
subd={}
an=ls.values()
ans=0
for k in an:
  ans+=k*(k-1)//2
sans=ans

for i in As:
  ans=sans+1-ls[i]
  print(ans)
#include <iostream>
using namespace std;
 
int main() {
  int n, m, l, a[110][110] = {0}, b[110][110] = {0};
  long long c[110][110] = {0};
  cin >> n >> m >> l;
  for (int i=0;i<n;i++)
    for (int j=0;j<m;j++)
      cin >> a[i][j];
  for (int i=0;i<m;i++)
    for (int j=0;j<l;j++)
      cin >> b[i][j];
 
  for (int i=0;i<n;i++)
    for (int j=0;j<l;j++)
      for (int k=0;k<m;k++)
        c[i][j] += a[i][k] * b[k][j];
  for (int i=0;i<n;i++) {
    for (int j=0;j<l-1;j++)
      cout << c[i][j] << " ";
    cout << c[i][l-1] << endl;
  }
}


### FIXED CODE ###

n, m, l = map(int, input().split())
a = [[] for _ in range(n)]
b = [[] for _ in range(m)]
   
for i in range(n):
  a[i] = list(map(int, input().split()))
   
for i in range(m):
  b[i] = list(map(int, input().split()))
   
for i in range(n):
  line = []
    
  for j in range(l):
    c = 0
      
    for k in range(m):
      c += a[i][k]*b[k][j]
      
    line.append(str(c))
  
  print(' '.join(line))
S = input()

jogai = 'BDEFHIJKLMNOPQRSUVWXYZ'
cnt = []
for i in range(0,len(S)):
    for j in range(1,len(S)+1):
        tmp = S[i:j]
        flg = 1
        for a in jogai:
            if a in tmp:
                flg = 0
        if flg:
            cnt.append(len(tmp))
print(max(cnt))

### FIXED CODE ###

S = input()
N = len(S)
ans =0
for i in range(0, N):
    for j in range(i, N+1):
        tmp = S[i:j]
        if len(tmp)==tmp.count('A')+tmp.count('G')+tmp.count('C')+tmp.count('T'):
            ans = max(ans,len(tmp))
print(ans)
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

h,w=map(int,readline().split())
ch, cw=map(int,readline().split())
dh, dw=map(int,readline().split())
m=list(map(lambda x: x.decode(), readlines()))
ch-=1; cw-=1; dh-=1; dw-=1

def valid(i, j):
    if 0<=i<=h-1 and 0<=j<=w-1:
        return True
    else:
        return False

def bfs(i, j, ans):
    f=False
    if m[i][j]==".":
        m[i]=m[i][:j]+str(ans)+m[i][j+1:]
        f=True
    else:
        if int(m[i][j])>ans:
            m[i]=m[i][:j]+str(ans)+m[i][j+1:]
            f=True
            
    if (i,j)==(dh,dw):
        return 0
    
    if f:
        for si in range(-2, 3):
            for sj in range(-2, 3):
                if valid(i+si, j+sj) and m[i+si][j+sj]!='#':
                    if (si, sj) == (0, 0):
                        pass
                    elif (si, sj) == (-1, 0) or (si, sj) == (0, -1) or (si, sj) == (1, 0) or (si, sj) == (0, 1):
                        bfs(i+si, j+sj, ans)
                    else:
                        bfs(i+si, j+sj, ans+1)
    
bfs(ch, cw, 0)

if m[dh][dw] == '.':
    print(-1)
else:
    print(m[dh][dw])

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# ---------標準入力時--------------
h,w=map(int,readline().split())
ch, cw=map(int,readline().split())
dh, dw=map(int,readline().split())
m=list(map(lambda x: list(x.decode()), readlines()))
# ---------標準入力時--------------

ch-=1; cw-=1; dh-=1; dw-=1

ad = [(-1,0), (0,-1), (1,0), (0,1)]
warp = [(-2, -2),(-2, -1),(-2, 0),(-2, 1),(-2, 2),
 (-1, -2),(-1, -1),(-1, 1),(-1, 2),
 (0, -2),(0, 2),
 (1, -2),(1, -1),(1, 1),(1, 2),
 (2, -2),(2, -1),(2, 0),(2, 1),(2, 2)]

for i in range(h):
    m[i] = ['#']*2 + m[i] + ['#']*2
    
m = [['#']*(w+4)]*2 + m + [['#']*(w+4)]*2
ch+=2; cw+=2; dh+=2; dw+=2

def bfs4():
    '''
    bfs3とほぼ同じ. 迷路の上下左右に2列ずつ壁追加
    '''
    que1=[]
    que2=[] # queueというよりはメモリ
    m[ch][cw]=str(0)
    que1.append((ch,cw))

    while que1!=[]:
        l1=len(que1)
        r1=0 # que1における使用済みindex

        # que1の要素(座標)から歩いていけるマス
        while r1<l1:
            i, j=que1[r1]
            r1+=1
            # 隣接したマスへの移動
            for si, sj in ad:
                if m[i+si][j+sj]=='.': 
                    m[i+si][j+sj]=m[i][j]
                    que1.append((i+si, j+sj))
                    l1+=1

        # 歩いていけないマス
        for i,j in que1:
            for si, sj in warp:
                if m[i+si][j+sj]=='.':
                    m[i+si][j+sj]=str(int(m[i][j])+1)
                    que2.append((i+si, j+sj))

        que1=que2
        que2=[]
###---------------------------------------

bfs4()


if m[dh][dw] == '.':
    print(-1)
else:
    print(m[dh][dw])
N = int(input())
A = list(map(int, input().split()))
if N > 2:
    for i in range(N-2):
        if A[i]>A[i+1]:
            A[i] -= 1
    for i in range(N-2):
        if A[i] > A[i+1]:
            print("No")
            break
    else:
        print("Yes")
        print(range(0))
elif N == 2:
    if A[0] <= A[1]:
        print("Yes")
    else:
        print("No")
elif N == 1:
    print("Yes")


### FIXED CODE ###

a, b,c = map(int, input().split())
d = c-(a-b)
if d<0:
    d = 0
print(d)
import numpy as np

N, Q = map(int, input().split())
S = input()
ls, rs = [], []
for _ in range(Q):
    l, r = map(int, input().split())
    ls.append(l-1)
    rs.append(r-1)

arr = np.zeros(N, np.int)
# flag = False
# for i in range(N):
#     if S[i] == 'A':
#         flag = True
#     elif S[i] == 'C' and flag:
#         arr[i - 1] = 1
#     else:
#         flag = False

for i, a, c in enumerate(zip(S, S[1:])):
    if a == 'A' and c == 'C':
        arr[i] = 1

for l, r in zip(ls, rs):
    print(np.sum(arr[l:r]))


### FIXED CODE ###

import numpy as np

N, Q = map(int, input().split())
S = input()
ls, rs = [], []
for _ in range(Q):
    l, r = input().split()
    ls.append(int(l)-1)
    rs.append(int(r)-1)

arr = np.zeros(N, np.int)
# flag = False
# for i in range(N):
#     if S[i] == 'A':
#         flag = True
#     elif S[i] == 'C' and flag:
#         arr[i - 1] = 1
#     else:
#         flag = False
for i, (a, c) in enumerate(zip(S, S[1:])):
    if a == 'A' and c == 'C':
        arr[i] = 1

cum = np.cumsum(arr)

for l, r in zip(ls, rs):
    if l == 0:
        print(cum[r-1])
    else:
        print(cum[r-1] - cum[l-1])
import sys
input = sys.stdin.readline
def print_ans(N, K, Q, arr):
    """Test Case
    >>> print_ans(6, 3, 4, [3, 1, 3, 2])
    No
    No
    Yes
    No
    No
    No
    >>> print_ans(6, 5, 4, [3, 1, 3, 2])
    Yes
    Yes
    Yes
    Yes
    Yes
    Yes
    >>> print_ans(10, 13, 15,[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9])
    No
    No
    No
    No
    Yes
    No
    No
    No
    Yes
    No
    """
    point = [K - Q] * N
    for a in arr:
        point[a - 1] += 1
    ans_arr = ["Yes" if p > 0 else "No" for p in point]
    for ans in ans_arr:
        print(ans)

if __name__ == '__main__':
    N, K, Q = map(int,input().rstrip().split())
    arr = [ int(line) for line in input()]
    print_ans(N, K, Q, arr)

### FIXED CODE ###

import sys
input = sys.stdin.readline
def print_ans(N, K, Q, arr):
    """Test Case
    >>> print_ans(6, 3, 4, [3, 1, 3, 2])
    No
    No
    Yes
    No
    No
    No
    >>> print_ans(6, 5, 4, [3, 1, 3, 2])
    Yes
    Yes
    Yes
    Yes
    Yes
    Yes
    >>> print_ans(10, 13, 15,[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9])
    No
    No
    No
    No
    Yes
    No
    No
    No
    Yes
    No
    """
    point = [K - Q] * N
    for a in arr:
        point[a - 1] += 1
    ans_arr = ["Yes" if p > 0 else "No" for p in point]
    for ans in ans_arr:
        print(ans)

if __name__ == '__main__':
    N, K, Q = map(int,input().rstrip().split())
    arr = [ int(input()) for i in range(Q)]
    print_ans(N, K, Q, arr)
import math
n = int(input())
ans = 0
for i in range(1,n+1):
    for j in range(1,n+1):
      jj = math.gcd(i,j)
        for k in range(1,n+1):
            ans+=math.gcd(jj,k)
print(ans)

### FIXED CODE ###

from math import gcd
n = int(input())
ans = 0
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            ans+=gcd(gcd(i,j),k)
print(ans)
import sys
s = sys.stdin.readline()
if (s== 'ABC'):
  sys.stdout('ARC')
else:
  sys.stdout('ABC')

### FIXED CODE ###

s = input()
if (s=='ABC'):
    print('ARC')
else:
    print('ABC')
import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def countp(cp, p):
    ret = 0
    while cp % p == 0:
        ret += 1
        cp //= p
    return ret


def count_in(fx_dict):
    if not fx_dict:
        return 2
    ret = 1
    for v in fx_dict:
        ret *= (v + 1)
    return ret


def main():
    N = int(input())
    va = [i for i in range(N + 1)]
    fx = [[] for _ in range(N + 1)]
    for p in range(2, int(N**0.5) + 2):
        if va[p] == 1:
            continue
        for cp in range(p, N + 1, p):
            tmp = countp(cp, p)
            va[cp] //= p**tmp
            fx[cp].append(tmp)
    # print(fx)

    ans = 1
    for i in range(2, N + 1):
        if va[i] != 1:
            fx[i].append(1)
        tmp = count_in(fx[i])
        # print(i, tmp)
        ans += i * tmp

    print(ans)
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def main():
    N = int(input())
    ans = 0
    for i in range(1, N + 1):
        n = N // i
        ans += n * (n + 1) * i // 2
    print(ans)
    return


if __name__ == '__main__':
    main()
mod = 10**9+7

table = [1,10,9,12,3,4]
#for i in range(1,len(S)+1):
#	tblpow.append(10*tblpow[i-1]%13)

dp = [0]*13
dp[0] = 1
for i in range(len(S)-1,-1,-1):
	ch = int(S[i]) if S[i]!='?' else -1
	temp = [0]*13
	for d in range(10):
		if ch!=-1 and ch!=d:
			continue
		for m in range(13):
			temp[(d*table[i%6]+m)%13] += dp[m]
	for m in range(13):
		temp[m] %= mod
	dp = temp
print(dp[5])


### FIXED CODE ###

S = input()
S = S[::-1]
#print(S)

mod = 10**9+7

tblpow = [1]
for i in range(1,len(S)+1):
	tblpow.append(10*tblpow[i-1]%13)

dp = [0]*13
dp[0] = 1
for i in range(len(S)-1,-1,-1):
	ch = int(S[i]) if S[i]!='?' else -1
	temp = [0]*13
	for d in range(10):
		if ch!=-1 and ch!=d:
			continue
		for m in range(13):
			temp[(d*tblpow[i]+m)%13] += dp[m]
	for m in range(13):
		temp[m] %= mod
	dp = temp
print(dp[5])
import numpy as np

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

res = 1
i = 1

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

while True:
    t = np.power(i, N)

    if t > P:
        break
    if P % t == 0:
        res = i

    i += 1

print(res)


### FIXED CODE ###

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

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

div = 2
res = 1
R = P

while div * div <= R and div <= P:
    cnt = 0
    while P % div == 0:
        P /= div
        cnt += 1

        if cnt == N:
            res *= div
            cnt = 0
    div += 1

print(res)
R,G,B,N=[int(c) for c in input().split()]

C=sorted([R,G,B])




if(C==[1,1,1]):
	input()
    print(4504501)
	exit()
if(C==[1,1,2]):
	print(2253001)
	exit()






count=0
for i in range(N//C[2]+1):
	for j in range(N//C[1]+1):
		if(N-C[2]*i-C[1]*j>=0 and (N-C[2]*i-C[1]*j)%C[0]==0):
			count+=1
print(count)


### FIXED CODE ###

N=int(input())
S=[input() for i in range(N)]
BXA=0;XA=0;BX=0;ans=0;
for s in S:
  ans+=s.count("AB")
  if(s[0]=='B' and s[-1]=='A'):
    BXA+=1
  elif(s[0]=='B'):
    BX+=1
  elif(s[-1]=='A'):
    XA+=1
#print(ans,min([XA,BX]))
if min([XA,BX])>0:
  ans+=min([XA,BX])+BXA
elif max([XA,BX])>0:
  ans+=BXA
else:
  ans+=max([BXA-1,0])
print(ans)
a = list(map(int, input().split()))

re = abs(a[0] - a[1])

for i in range(a[0] - a[1]):
  if abs(a[0] - i) == abs(a[1] - i):
    print(i)
    yes = 1
    break

if yes != 1:
  print('IMPOSSIBLE)

### FIXED CODE ###

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

b = a[0] + a[1]

if b % 2 == 0:
  print(b//2)
else:
  print('IMPOSSIBLE')
import itertools
import sys

input = sys.stdin.readline

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

ans = 0
a_cum = [0] + list(itertools.accumulate(a))
b_cum = [0] + list(itertools.accumulate(b))

y = m
for x in range(len(a_cum) + 1):
    if a_cum[x] > k:
        break
    while b[y] > k - a[x]:
        y -= 1
    ans = max(ans, x + y)

print(ans)


### FIXED CODE ###

import itertools
import sys

input = sys.stdin.readline

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

ans = 0
a_cum = [0] + list(itertools.accumulate(a))
b_cum = [0] + list(itertools.accumulate(b))

y = m  # len(b_cum) - 1
for x in range(len(a_cum)):
    if a_cum[x] > k:
        break
    while b_cum[y] > k - a_cum[x]:
        y -= 1
    ans = max(ans, x + y)

print(ans)
n, k = map(int, input().split())
p_list = list(map(int, input().split()))
index = 0
value = 0

for i in range(n - k):
    if p_list[i] < p_list[i + k]:
        index = i + 1

for i in range(k):
    value += (1 + p_list[index + i])/ 2 

print(value)


### FIXED CODE ###

n = int(input())
a_list = list(map(int, input().split()))

if len(set(a_list)) == n:
    print('YES')
else:
    print('NO')
s = input()
K = int(input())
substring = []
for i in range(len(s)):
	for j in range(len(s)):
		if s[i:j] != '':
			substring.append(s[i:j])
sub_set = set(substring)
ans = list(sub_set)
ans.sort()
print(ans[K-1])

### FIXED CODE ###

s = input()
K = int(input())
substr = set()
for i in range(len(s)):
    for j in range(i+1, i+K+1):
        substr.add(s[i:j])
print(sorted(substr)[K-1])
a = int(input())
b = int(input())
if a == b:
    print("Yay!")
else:
    print(":(")

### FIXED CODE ###

a,b = map(int,input().split())
if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")
from fractions import gcd

N, M = map(int,input().split())
S = input()
T = input()
L = N*M//gcd(N,M)
ans = [0] * (L+1)
for i in range(1,N+1):
    ans[1+(i-1)*(L//N)] = S[i-1]

for i in range(1,M+1):
    if ans[1+(i-1)*(L//M)] == 0:
        ans[1+(i-1)*(L//M)] = T[i-1]
    else:
        if ans[1+(i-1)*(L//M)] == T[i-1]:
            pass
        else:
            print(-1)
            exit()

print(L)
        

### FIXED CODE ###

from fractions import gcd

N, M = map(int,input().split())
S = input()
T = input()
L = (N*M)//gcd(N,M)
S_a = L // N
T_a = L // M
L_a = (S_a*T_a)//gcd(S_a,T_a)

S_b = L_a // S_a
T_b = L_a // T_a
i = 0
j = 0
while True:
    if S[i] != T[j]:
        print('-1')
        break
    i += S_b
    j += T_b
    if i >= N or j >= M:
        print(L)
        break
import sys, re
input = sys.stdin.readline().rstrip()

S = input()

if S == 'keyence' or re.fullmatch(r'[a-z]+keyence', S) or re.fullmatch(r'k[a-z]+eyence', S) or re.fullmatch(r'ke[a-z]+yence', S) or re.fullmatch(r'key[a-z]+ence', S) or re.fullmatch(r'keye[a-z]+nce', S) or re.fullmatch(r'keyen[a-z]+ce', S) or re.fullmatch(r'keyenc[a-z]+e', S) or re.fullmatch(r'keyence[a-z]+', S):
  print('YES')
else:
  print('NO')

### FIXED CODE ###

import re

S = input()

if S == 'keyence' or re.fullmatch(r'[a-z]+keyence', S) or re.fullmatch(r'k[a-z]+eyence', S) or re.fullmatch(r'ke[a-z]+yence', S) or re.fullmatch(r'key[a-z]+ence', S) or re.fullmatch(r'keye[a-z]+nce', S) or re.fullmatch(r'keyen[a-z]+ce', S) or re.fullmatch(r'keyenc[a-z]+e', S) or re.fullmatch(r'keyence[a-z]+', S):
  print('YES')
else:
  print('NO')
from itertools import product

x = int(input())
num = [i**5 for i in range(-1000, 1000)]

for a, b in product(num, repeat=2):
    if a - b == x:
        print(int(a**0.2), int(b**0.2))
        break


### FIXED CODE ###

from itertools import combinations

x = int(input())
num = [i**5 for i in range(1000)]

for a, b in combinations(num, 2):
    if a - b == x:
        print(int(a**0.2), int(b**0.2))
    elif a + b == x:
        print(int(a**0.2), -int(b**0.2))
    elif b - a == x:
        print(int(b**0.2), int(a**0.2))
    elif b + a == x:
        print(int(b**0.2), -int(a**0.2))
    else:
        continue
    break
from math import gcd
from functools import reduce


def lcm_base(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
a = list(map(int, input().split()))
ll = lcm_list(a) - 1
ans = 0
for i in a:
    ans += (ll % i)
print(ans)


### FIXED CODE ###


from fractions import gcd
from functools import reduce


def lcm_base(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


n = int(input())
a = list(map(int, input().split()))
ll = lcm_list(a) - 1
ans = 0
for i in a:
    ans += (ll % i)
print(ans)
import numpy as np

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

edge = [[] for i in range(N)]
child = [{i} for i in range(N)]
ans = np.array([0] * N)

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

is_visited = [False] * N

def dfs(cur):
    is_visited[cur] = True

    for next in edge[cur]:
        if is_visited[next]:
            continue
        dfs(next)
        child[cur] = child[next] | child[cur]

dfs(0)

for q in range(Q):
    p, x = map(int, input().split())
    ans[list(child[p-1])] += x
    
print(*ans)

### FIXED CODE ###

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

edge = [[] for i in range(N)]
ans = [0] * N
query = [0] * N

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

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

is_visited = [False] * N
stack = [(0,0)]

while len(stack) != 0:
    cur, q = stack.pop()
    is_visited[cur] = True

    q = q + query[cur]
    ans[cur] += q

    for next in edge[cur]:
        if is_visited[next]:
            continue
        stack.append((next, q))

print(*ans)
def resolve():
    N, K = map(int, input().split())
    const = 1e9 + 7
    n_iter = int(min(K, N - K + 1))
    for i in range(1, n_iter + 1):
        ans = combinations_count(N - K + 1, i) * combinations_count(
            K - 1, i - 1)
        print(int(ans % const))
resolve()

### FIXED CODE ###

import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


def resolve():
    N, K = map(int, input().split())
    const = 1e9 + 7
    for i in range(1, K + 1):
        if (N - K + 1 >= i):
            print(
                combinations_count(N - K + 1, i) *
                combinations_count(K - 1, i - 1) % 1000000007)
        else:
            print(0)
            
resolve()