Harryxun/stf_run huggingface dataset:
H,W = map(int,input().split())
L = []
for i in range(H) :
    L.append(list(input()))
flag = 0
if H == 1 :
    if W == 1 :
        if L[H][W] != "#" :
            flag = 1
    else :
        if L[i][j] == "#" :
            if j == 0 :
                if L[i][j+1] != "#" :
                    flag = 1
            elif j == W-1 :
                if L[i][j-1] != "#" :
                    flag = 1
            else :
                if (L[i][j+1] != "#") and (L[i][j-1] != "#") :
                    flag = 1
else :
    for i in range(H) :
        for j in range(W) :
            if L[i][j] == "#" :
                if j == 0 :
                    if i == 0 :
                        if (L[i+1][j] != "#") and (L[i][j+1] != "#") :
                            flag = 1
                    elif i == (W-1) :
                        if (L[i-1][j] != "#") and (L[i][j+1] != "#") :
                            flag = 1
                    else :
                        if (L[i-1][j] != "#") and (L[i][j+1] != "#") and (L[i+1][j] != "#") :
                            flag = 1
                elif j == (H-1) :
                    if i == 0 :
                        if (L[i+1][j] != "#") and (L[i][j-1] != "#") :
                            flag = 1
                    elif i == (W-1) :
                        if (L[i-1][j] != "#") and (L[i][j-1] != "#") :
                            flag = 1
                    else :
                        if (L[i-1][j] != "#") and (L[i][j-1] != "#") and (L[i+1][j] != "#") :
                            flag = 1
                else :
                    if i == 0 :
                        if (L[i+1][j] != "#") and (L[i][j+1] != "#") and (L[i][j-1] != "#") :
                            flag = 1
                    elif i == (W-1) :
                        if (L[i-1][j] != "#") and (L[i][j+1] != "#") and (L[i][j-1] != "#") :
                            flag = 1
                    else :
                        if (L[i-1][j] != "#") and (L[i][j+1] != "#") and (L[i+1][j] != "#") and (L[i][j-1] != "#") :
                            flag = 1
            if flag == 1 :
                break
        if flag == 1 :
            break
if flag == 0 :
    print("Yes")
else :
    print("No")



### FIXED CODE ###

H,W = map(int,input().split())
L = [input() for i in range(H)]
dxy = [[1,0],[-1,0],[0,1],[0,-1]]
flag = 1

for y in range(H) :
    for x in range(W) :
        if L[y][x] == "#" and flag == 1 :
            for dx,dy in dxy :
                nx = x+dx
                ny = y+dy
                if (0 <= nx <= W-1) and (0 <= ny <= H-1) :
                    if L[ny][nx] == "#" :
                        flag = 1
                        break
                    else :
                        flag = 0
if flag == 1 :
    print("Yes")
else :
    print("No")
H, W, K, = list(map(int, input().split()))
C = [0] * H
for i in range(H):
  C[i] = input()
  C[i] = [1 if(C[i][j] == "#") else 0 for j in range(W)]
h = 2 ** H
w = 2 ** W
ans = 0
cnt = 0
for i in range(2 ** H):
  w = 2 ** W
  for j in range(2 ** W):
    cnt = 0
    for k in range(H):
      for l in range(W):
        if(bin(h)[k + 3] == "0" and bin(w)[l + 3] == "0"):
          cnt += D[k][l]
    ans += (cnt == K)
    w += 1
  h += 1
print(ans)


### FIXED CODE ###

import copy
H, W, K, = list(map(int, input().split()))
C = [0] * H
for i in range(H):
  C[i] = input()
  C[i] = [1 if(C[i][j] == "#") else 0 for j in range(W)]
h = 2 ** H
w = 2 ** W
ans = 0
for i in range(2 ** H):
  w = 2 ** W
  for j in range(2 ** W):
    D = copy.deepcopy(C)
    for k in range(H):
      for l in range(W):
        if(bin(h)[k + 3] == "1" or bin(w)[l + 3] == "1"):
          D[k][l] = 0
    ans += (sum(map(sum, D)) == K)
    w += 1
  h += 1
print(ans)
import math
r = int(input())
s=r**2 * math.pi
l=r*2*math.pi
print(s,l)

### FIXED CODE ###

import math
r = float(input())
s=r**2 * math.pi
l=r*2*math.pi
print(s,l)
n = int(input())
a = []
for i in range(1, n//2):
    if n % i == 0:
        a.append(max(len(str(i)), len(str(n // i))))
print(min(a))

### FIXED CODE ###

import math
n = int(input())
a = []
for i in range(1, math.ceil(n**(1/2))+1):
    if n % i == 0:
        a.append(max(len(str(i)), len(str(n // i))))
print(min(a))
from collections import deque
import sys

sys.setrecursionlimit(500 * 500)

n, m = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for _ in range(n):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

visit = [0] * (n + 1)
q = deque([1])
while q:
    now = q.popleft()
    visit[now] = 1
    for i in graph[now]:
        if visit[i] == 0:
            q.append(i)

depth = sum(visit)
ans = 0
visit = [0] * (n + 1)


def dfs(now, count):
    global ans
    if count == depth:
        ans += 1
    else:
        for i in graph[now]:
            if visit[i] == 0:
                visit[now] = 1
                dfs(i, count + 1)
                visit[now] = 0


dfs(1, 1)
print(ans)


### FIXED CODE ###

n, m = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for _ in range(m):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

visit = [0] * (n + 1)


def dfs(now, depth):
    if visit[now]:
        return 0
    if depth == n:
        return 1

    count = 0
    visit[now] = 1
    if graph[now]:
        for i in graph[now]:
            count += dfs(i, depth + 1)
    visit[now] = 0

    return count


ans = dfs(1, 1)
print(ans)
h,w = map(int,input().split())
l=['#'*(w+2)]+['#'+input()+'#' for i in range(h)]+['#'*(w+2)]
dp = [[[0]*2 for i in range(w+2)] for i in range(h+2)]
cnt = 0
ans = 0

def dfsw(x,y,cnt):
  if l[x][y+1] == '.':
    cnt += 1
    dp[x][y][0] = dfsw(x,y+1,cnt)
    return dp[x][y][0]
  else:
    dp[x][y][0] = cnt
    return dp[x][y][0]

def dfsh(x,y,cnt):
  if l[x+1][y] == '.':
    cnt += 1
    dp[x][y][1] = dfsh(x+1,y,cnt)
    return dp[x][y][1]
  else:
    dp[x][y][1] = cnt
    return dp[x][y][1]

for i in range(h+2):
  for j in range(w+2):
    if l[i][j] == '.' and dp[i][j][0] == 0:
      dfsw(i,j,1)
for i in range(h+2):
  for j in range(w+2):
    if l[i][j] == '.' and dp[i][j][1] == 0:
      dfsh(i,j,1)
    
for i in range(h+2):
  for j in range(w+2):
    if l[i][j] == '.':
      ans = max(ans, sum(dp[i][j]) - 1)
print(ans)

### FIXED CODE ###

import numpy as np
h,w = map(int,input().split())
ar = np.array([list(input()) for _ in range(h)]) == '.'
#print(ar)
l = np.zeros((h,w),dtype=int)
r = np.zeros((h,w),dtype=int)
u = np.zeros((h,w),dtype=int)
d = np.zeros((h,w),dtype=int)

for i in range(h):
  u[i] = (u[i-1]+1)*ar[i]
  #print(u)
  d[-i-1] = (d[-i]+1)*ar[-i-1]
  #print(d)
  
for j in range(w):
  l[:,j] = (l[:,j-1]+1)*ar[:,j]
  #print(l)
  r[:,-j-1] = (r[:,-j]+1)*ar[:,-j-1]
  #print(r)
print(np.max(u+d+l+r)-3)
n=int(input())
s = [ str(input()) for _ in range(n)]
s = sorted([sorted(x) for x in s])
pairs = 0
from math import factorial
# for i in range(n):
#     for j in range(i+1, n):
#         if s[i] == s[j]:
#             pairs.append(tuple([i,j]))
def comb(n, r):
    return (factorial(n) / factorial(r) / factorial(n - r))

i=0
while i < n-1:
    sames = 0
    for j in range(i+1, n):
        if s[i] == s[j]:
            sames += 1
            continue
        else:
            break
    i += sames + 1
    if sames != 0:
        pairs += comb(sames + 1, 2)

print(int(pairs))

### FIXED CODE ###

n=int(input())
s = [ str(input()) for _ in range(n)]
s = sorted([sorted(x) for x in s])
pairs = 0
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

i=0
while i < n-1:
    sames = 0
    for j in range(i+1, n):
        if s[i] == s[j]:
            sames += 1
            continue
        else:
            break
    i += sames + 1
    if sames != 0:
        pairs += combinations_count(sames + 1, 2)


print(int(pairs))
while 1:
	su = 0
	stack = []
	raw = raw_input().split()
	
	for s in raw:
		if s == "-":
			stack.append(stack.pop(-2) - stack.pop())
		elif s == "+":
			stack.append(stack.pop(-2) + stack.pop())
		elif s == "/":
			stack.append(stack.pop(-2) / stack.pop())
		elif s == "*":
			stack.append(stack.pop(-2) * stack.pop())
		elif s == "%":
			stack.append(stack.pop(-2) % stack.pop())
		else:
			stack.append(int(s))
	
	print "%.6" % stack[0]

### FIXED CODE ###

while 1:
	try:
		stack = []
		for s in raw_input().split():
			if s == "-":
				stack.append(stack.pop(-2) - stack.pop())
			elif s == "+":
				stack.append(stack.pop(-2) + stack.pop())
			elif s == "/":
				stack.append(stack.pop(-2) / stack.pop())
			elif s == "*":
				stack.append(stack.pop(-2) * stack.pop())
			else:
				stack.append(float(s))
	
		print "%.6f" % (stack[0])
	except:
		break
import fractions
import copy
n = int(input())
a = list(map(int, input().split()))
a_r = copy.copy(a)
a_r.reverse()
cumsum_gcd = [0]
cumsum_gcd_r = [0]
for i in range(n-1):
    cumsum_gcd.append(fractions.gcd(cumsum_gcd[i], a[i]))
    cumsum_gcd_r.append(fractions.gcd(cumsum_gcd_r[i], a_r[i]))
cumsum_gcd_r.reverse()
print(cumsum_gcd, cumsum_gcd_r)
ans = []
for i in range(n):
    ans.append(fractions.gcd(cumsum_gcd[i], cumsum_gcd_r[i]))
print(max(ans)


### FIXED CODE ###

import fractions
import copy
n = int(input())
a = list(map(int, input().split()))
a_r = copy.copy(a)
a_r.reverse()
cumsum_gcd = [0]
cumsum_gcd_r = [0]
for i in range(n-1):
    cumsum_gcd.append(fractions.gcd(cumsum_gcd[i], a[i]))
    cumsum_gcd_r.append(fractions.gcd(cumsum_gcd_r[i], a_r[i]))
cumsum_gcd_r.reverse()
ans = []
for i in range(n):
    ans.append(fractions.gcd(cumsum_gcd[i], cumsum_gcd_r[i]))
print(max(ans))
n,k = map(int,input().split())

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

h.sort()
sumh = 0
if k == 0 :
    print(sum(h))
else :
    for i in range(1,k+1):
        sumh += h[i*-1]
    print(sum(h)-sumh)


### FIXED CODE ###

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

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

h.sort(reverse=True)

if k == 0 :
    print(sum(h))
elif k <= n :
    for i in range(k):
        h[i] = 0
    print(sum(h))
else :
    print(0)
N, K = map(int,input().split()) # 複数の数字を変数に格納

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
  
red = N - K
blue = K
division = 10 ** 9 + 7

for i in range(K):
    if i > red:
        print("0")
    else:
        tmp_blue = cmb(blue-1,i) % division
        tmp_red = 1
        for j in range(i+1):
            tmp_red = tmp_red * (red+1-j) / (j+1) 
        result = int(tmp_blue * tmp_red % division)
        print("{}".format(result))


### FIXED CODE ###

N, K = map(int,input().split()) # 複数の数字を変数に格納

red = N - K
blue = K
division = 10 ** 9 + 7

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under % division
  
for i in range(K):
    if i > red:
        print("0")
    else:
        tmp_blue = cmb(blue-1,i) % division
        tmp_red = cmb(red+1,red-i)
        result = int(tmp_blue * tmp_red % division)
        print("{}".format(result))
S = {c:input() for c in "abc"}
s = "a"
while S[s]:
  s = S[s].pop(0)
print(s.upper())

### FIXED CODE ###

Sa = list(input())
Sb = list(input())
Sc = list(input())
d = Sa[0]
for i in range(300):
  if d == "a":
    d = Sa.pop(0)
  elif d == "b":
    d = Sb.pop(0)
  else:
    d = Sc.pop(0)
  if Sa == [] and d == "a":
    print("A")
    break
  elif Sb == [] and d == "b":
    print("B")
    break
  elif Sc == [] and d == "c":
    print("C")
    break
a , b = [int(i) for i in intput()]
if a > b:
    print("a > b")
elif a < b:
    print("a < b")
else:
    print("a = b")

### FIXED CODE ###

a , b = [int(i) for i in input().split()]
if a > b:
    print("a > b")
elif a < b:
    print("a < b")
else:
    print("a == b")
n = int(input())
x = str(input())

def ppc(k): #k:2進数 bin
  cnt1 = sum( [1*(j == "1") for j in k] )
  k_10 = int(k, 2) #１０進数
  return format( k_10 % cnt1, 'b') #2adic

for i in range(n):
  ly = list(x)
  if ly[i] == '0':
    ly[i] = '1'
    y = ''.join(ly)
  else:
    ly[i] = '0'
    y = ''.join(ly)
  cnt = 0
  while True:
    y = ppc(y)
    cnt += 1
    if y == '0':
      break
  print(cnt)

### FIXED CODE ###

n = int(input())
x = input()
cnt1 = x.count('1')
x10 = int(x,2)

if cnt1 > 1:
  x10mod_m = x10 % (cnt1-1)
  x10mod_p = x10 % (cnt1+1)
else:
  x10mod_m = 0
  x10mod_p = 0

ans = []
for i in range(n):
  if x[i] == '1':
    if cnt1 == 1:
      print(0)
      continue
    cntx = cnt1-1
    mod = ( x10mod_m - pow(2,n-1-i,cntx) ) % cntx
  else:
    cntx = cnt1+1
    mod = ( x10mod_p + pow(2,n-1-i,cntx) ) % cntx
    
  cnt = 1
  mod = format(mod, 'b')
  
  while True:
    if mod == '0':
      break
    mod = format( int(mod,2) % mod.count('1'), 'b')
    cnt += 1
  print(cnt)
N, Q = map(int, input().split())
connect = {i:set() for i in range(1, N+1)}
for _ in range(N-1):
    a, b = map(int, input().split())
    connect[a].add(b)
    connect[b].add(a)
score = {i:0 for i in range(1, N+1)}
for _ in range(Q):
    p, x = map(int, input().split())
    score[p] += x

def dfs(now, prev = -1):
    for nx in connect[now]:
        if nx == prev: continue
        score[nx] += score[now]
        dfs(nx, now)

dfs(1)
print(*score.values())

### FIXED CODE ###

from collections import deque
 
N, Q = map(int, input().split())
Ki = [[] for _ in range(N)]
for _ in range(N-1):
    p, c = map(int, input().split())
    Ki[p-1].append(c-1)
    Ki[c-1].append(p-1)
S = [0]*N
for _ in range(Q):
    node, score = map(int, input().split())
    S[node-1] += score
 
stack = deque([0])
done = [0]*N
done[0] = 1
 
while len(stack) > 0:
    now = stack.pop()
    
    for new in Ki[now]:
        if done[new] == 0:
            done[new] = 1
            stack.append(new)
            S[new] += S[now]
    
print(*S)
list=['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']
ans=input()

for i in list:
	if i==ans:
		print(list[list.index(i)+1])

### FIXED CODE ###

list=['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']
ans=input()

for i in list:
	if i==ans:
		print(list[list.index(i)+1])
x, n = map(int,input().split())

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

p.append(x)

d =100

if n == 0:
    print(x)
else:
    for i in range(1,101):
        if i not in p:
            d_temp = abs(x-i)
            if d_temp < d:
                d = d_temp
                num = i
    print(num)

### FIXED CODE ###

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

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

d =100
num = 0

if n == 0:
    num = x
else:
    for i in range(102):
        if i not in p:
            d_temp = abs(x-i)
            if d_temp < d:
                d = d_temp
                num = i
print(num)
import sys

N = int(input())
C = [int(sys.stdin.readline()) for _ in range(N)]
MOD = 10**9 + 7
A = []
for c in C:
    if A and A[-1] == c:
        continue
    A.append(c)
NA = len(A)
last = [-1] * NA
B = [-1] * NA
for i, a in enumerate(A):
    B[i] = last[a]
    last[a] = i

dp = [0] * NA
dp[0] = 1
for i in range(1, NA):
    prev = 0 if B[i] < 0 else dp[B[i]]
    dp[i] = (dp[i - 1] + prev) % MOD
print(dp[-1])

### FIXED CODE ###

import sys

N = int(input())
C = [int(sys.stdin.readline()) for _ in range(N)]
MOD = 10**9 + 7
A = []
for c in C:
    if A and A[-1] == c:
        continue
    A.append(c)
NA = len(A)
last = [-1] * 200001
B = [-1] * 200001
for i, a in enumerate(A):
    B[i] = last[a]
    last[a] = i

dp = [0] * NA
dp[0] = 1
for i in range(1, NA):
    prev = 0 if B[i] < 0 else dp[B[i]]
    dp[i] = (dp[i - 1] + prev) % MOD
print(dp[-1])
import math
N,K = map(int, input().split())
a = list(map(int,input().split()))
l = 0
r = K - 1
Min = float("inf")
for i in range(N - K + 1):
    if(a[l]*a[r]<=0):#原点を跨ぐとき
        Min = min(Min,abs(a[l])+abs(a[l]-a[r]),abs(a[r])+abs(a[r]-a[l]))

    elif(l==0):#左端の時
        if(a[r]*a[r+1]<0 or a[0]>0 or (a[N-1]<0 and r == N-1)):
            Min = min(Min,abs(a[l])+abs(a[l]-a[r]),abs(a[r])+abs(a[r]-a[l]))
    elif(r==N-1):#右端の時
        if(a[l-1]*a[l]<0 or (a[l]>0 and l == 0) or a[r] <= 0):
            Min = min(Min,abs(a[l])+abs(a[l]-a[r]),abs(a[r])+abs(a[r]-a[l]))
    else:
        if(a[r]*a[r+1]<0 or a[l-1]*a[l]<0):
            Min = min(Min,abs(a[l])+abs(a[l]-a[r]),abs(a[r])+abs(a[r]-a[l]))
    l = l + 1
    r = r + 1
print(Min)


### FIXED CODE ###

import math
N,K = map(int, input().split())
a = list(map(int,input().split()))
l = 0
r = K - 1
Min = float("inf")
for i in range(N - K + 1):
    if(a[l]*a[r]<=0):#原点を跨ぐとき
        Min = min(Min,abs(a[l])+abs(a[l]-a[r]),abs(a[r])+abs(a[r]-a[l]))
    elif(l == 0 and r == N-1):
        Min = min(Min,abs(a[l])+abs(a[l]-a[r]),abs(a[r])+abs(a[r]-a[l]))        
    elif(l==0):#左端の時
        if(a[r]*a[r+1]<0 or a[0]>0 or (a[N-1]<0 and r == N-1)):
            Min = min(Min,abs(a[l])+abs(a[l]-a[r]),abs(a[r])+abs(a[r]-a[l]))
    elif(r==N-1):#右端の時
        if(a[l-1]*a[l]<0 or (a[l]>0 and l == 0) or a[r] <= 0):
            Min = min(Min,abs(a[l])+abs(a[l]-a[r]),abs(a[r])+abs(a[r]-a[l]))
    else:
        if(a[r]*a[r+1]<0 or a[l-1]*a[l]<0):
            Min = min(Min,abs(a[l])+abs(a[l]-a[r]),abs(a[r])+abs(a[r]-a[l]))
    l = l + 1
    r = r + 1
print(Min)
import math
import numpy as np
N,K=map(int,input().split())
A=[0]*N
A=list(map(int,input().split()))

da=[0 for i in range(N)]
for k in range(K):
    B=[0 for i in range(N)]
    for i in range(N):
        l=max(0,i-A[i])
        r=min(N-1,i+A[i])
        B[l]=B[l]+1
        if(r+1<N):
            B[r+1]=B[r+1]-1
    for i in range(1,N):
        B[i]=min(N,B[i]+B[i-1])
    A=B
b=[str(i) for i in B]
b=" ".join(b)
print(b)


### FIXED CODE ###

import math
N,K=map(int,input().split())
A=[0]*N
A=list(map(int,input().split()))

da=[0 for i in range(N)]
for k in range(K):
    B=[0 for i in range(N)]
    for i in range(N):
        l=max(0,i-A[i])
        r=min(N-1,i+A[i])
        B[l]=B[l]+1
        if(r+1<N):
            B[r+1]=B[r+1]-1
    for i in range(1,N):
        B[i]=min(N,B[i]+B[i-1])
    if(A==B):
        break
    A=B
b=[str(i) for i in B]
b=" ".join(b)
print(b)
n,m,x=(int(i) for i in input().split(' '))
a=[int(i) for i in input().split(' ')]
if x<a[0]:
  print('0')
else:
  for i in range(len(m)):
    if a[i]<x:
      print(min(i+1,m-i-1))
      break

### FIXED CODE ###

n,m,x=(int(i) for i in input().split(' '))
a=[int(i) for i in input().split(' ')]
a+=[x]
a.sort()
print(min(a.index(x),m-a.index(x)))
from collections import Counter

def main(N, M, C):
    lst = [n for n in range(N)] # 初期値はすべてがそれぞれ根である状態

    def get_root(x):    # 根を得る関数
        if lst[x] == x: # それ自身が根である場合
            return x
        else:   # 根が別のものである場合
            lst[x] = get_root(lst[x])   # 経路圧縮あり (ある種「メモ再帰化」)
            return lst[x]
            # return get_root(lst[x]) # 経路圧縮なし (わかりやすい，ただの再帰関数)

    def unite(x, y):    # 集合の連結を行う関数
        root_x = get_root(x)
        root_y = get_root(y)
        if root_x != root_y:    # 根が違う (=異なる集合) ならば
            lst[root_x] = root_y

    {unite(*c) for c in C}  # 集合の連結を行う．

    print(max(Counter(map(get_root, lst)).values()))


if __name__ == '__main__':
    N, M = list(map(int, input().split()))
    C = set()
    for _ in range(M):
        C.add(tuple(map(lambda x:int(x)-1, input().split())))   # pythonのindexに合わせるために "-1"
    main(N, M, C)

### FIXED CODE ###

from collections import Counter

# 再帰回数のエラー？と思われるので再帰上限を変更 10**3→10**9
import sys
sys.setrecursionlimit(10 ** 9)

def main(N, M, C):
    lst = [n for n in range(N)] # 初期値はすべてがそれぞれ根である状態

    def get_root(x):    # 根を得る関数
        if lst[x] == x: # それ自身が根である場合
            return x
        else:   # 根が別のものである場合
            lst[x] = get_root(lst[x])   # 経路圧縮あり (ある種「メモ再帰化」)
            return lst[x]
            # return get_root(lst[x]) # 経路圧縮なし (わかりやすい，ただの再帰関数)

    def unite(x, y):    # 集合の連結を行う関数
        root_x = get_root(x)
        root_y = get_root(y)
        if root_x != root_y:    # 根が違う (=異なる集合) ならば
            lst[root_x] = root_y

    {unite(*c) for c in C}  # 集合の連結を行う．

    print(max(Counter(map(get_root, lst)).values()))


if __name__ == '__main__':
    N, M = list(map(int, input().split()))
    C = set()
    for _ in range(M):
        C.add(tuple(map(lambda x:int(x)-1, input().split())))   # pythonのindexに合わせるために "-1"
    main(N, M, C)
import math
a,b = map(int,input().split)
print(math.ceil((b-1)/(a-1)))

### FIXED CODE ###

import math
A, B = map(int, input().split())
print(1+math.ceil((B-A)/(A-1)))
n = str(input())
wa = 0

for i in n:
	n[i] = int(n[i])
	wa += n[i]

if wa % 9 == 0:
	print('Yes')
else:
	print('No')

### FIXED CODE ###

n = str(input())
wa = 0

for i in range(len(n)):
	wa += int(n[i])

if wa % 9 == 0:
	print('Yes')
else:
	print('No')
import sys, math, copy
sys.setrecursionlimit(10**8)

def main():
    n = int(input())
    x = list(input())
    for i in range(n):
        x[i] = int(x[i])
    A0 = 0
    A1 = 0
    B = sum(x)
    for i in range(n):
        A0 += x[i]*pow(2,n-i-1,B+1)
        A1 += x[i]*pow(2,n-i-1,B-1)
        A0 %= B+1
        A1 %= B-1
    for i in range(n):
        if x[i] == 0:
            BB = B + 1
            AA = A0 + pow(2,n-i-1,BB)
        else:
            BB = B - 1
            AA = A1 - pow(2,n-i-1,BB)
        ans = 1
        while AA%BB != 0:
            AA = AA%BB
            AAA = copy.deepcopy(AA)
            BB = 0
            while AAA != 0:
                BB += AAA%2
                AAA //= 2
            ans += 1
        print(ans)
    
if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys, math, copy
sys.setrecursionlimit(10**8)

def main():
    n = int(input())
    x = list(input())
    for i in range(n):
        x[i] = int(x[i])
    A0 = 0
    A1 = 0
    B = sum(x)
    for i in range(n):
        if B+1 != 0:
            A0 += x[i]*pow(2,n-i-1,B+1)
            A0 %= B+1
        if B-1 != 0:
            A1 += x[i]*pow(2,n-i-1,B-1)
            A1 %= B-1
    for i in range(n):
        if x[i] == 0:
            BB = B + 1
            AA = A0 + pow(2,n-i-1,BB)
        else:
            BB = B - 1
            if BB == 0:
                AA = 0
            else:
                AA = A1 - pow(2,n-i-1,BB)
        ans = 1
        if BB == 0:
            print(0)
            continue
        while AA%BB != 0:
            AA = AA%BB
            AAA = AA
            BB = 0
            while AAA != 0:
                BB += AAA%2
                AAA //= 2
            ans += 1
        print(ans)
    
if __name__ == "__main__":
    main()
from math import factorial
from sys import exit

bign = 10**9 + 7


n,k = map(int,input().split())
nk = n-k+1

if n == k:
    print(1)
    for i in range(k-1):
        print(0)
    exit()

ans = nk
print(ans)
if k-1<=nk:
    for i in range(1,k):
        i1 = i+1
        ans = (ans * (nk-i) / i1)
        ans = (ans * (k-i) / i)
        print(int(ans)%bign)
else:
    for i in range(1,nk+1):
        i1 = i+1
        ans = (ans * (nk-i) / i1)
        ans = (ans * (k-i) / i)
        print(int(ans)%bign)
    for i in range(k-1-nk):
        print(0)


### FIXED CODE ###

from math import factorial
from sys import exit

bign = 10**9 + 7


n,k = map(int,input().split())
nk = n-k+1

if n == k:
    print(1)
    for i in range(k-1):
        print(0)
    exit()

ans = nk
print(ans)
if k-1<=nk:
    for i in range(1,k):
        i1 = i+1
        ans = (ans * (nk-i) // i1)
        ans = (ans * (k-i) // i)
        print(ans%bign)
else:
    for i in range(1,nk+1):
        i1 = i+1
        ans = (ans * (nk-i) // i1)
        ans = (ans * (k-i) // i)
        print(ans%bign)
    for i in range(k-1-nk):
        print(0)