Harryxun/stf_run huggingface dataset:
base1 = 1009
base2 = 1013
mask = (1 << 32) - 1
def calc_hash(f, r, c):
    global ph, pw, h
    tmp = [[0] * c for _ in range(r)]
    dr, dc = r - ph, c - pw
    t1 = 1
	t1 = (t1 * (base1 ** pw)) & mask
    # for _ in range(pw):
        # t1 = (t1 * base1) & mask
    for i in range(r):
        e = 0
        for j in range(pw):
            e = e * base1 + f[i][j]
        for j in range(dc):
            tmp[i][j] = e
            e = (e * base1 - t1 * f[i][j] + f[i][j + pw]) & mask
        tmp[i][dc] = e
    t2 = 1
    for _ in range(ph):
        t2 = (t2 * base2) & mask
    for j in range(dc + 1):
        e = 0
        for i in range(ph):
            e = e * base2 + tmp[i][j]
        for i in range(dr):
            h[i][j] = e
            e = (e * base2 - t2 * tmp[i][j] + tmp[i + ph][j]) & mask
        h[dr][j] = e
th, tw = map(int, input().split())
t = tuple(tuple(ord(c) for c in input()) for _ in range(th))
ph, pw = map(int, input().split())
p = tuple(tuple(ord(c) for c in input()) for _ in range(ph))
ans = []
if th >= ph and tw >= pw:
    h = [[0] * tw for _ in range(th)]
    calc_hash(p, ph, pw)
    key = h[0][0] & mask
    calc_hash(t, th, tw)
    for i in range(th - ph + 1):
        for j in range(tw - pw + 1):
            if h[i][j] & mask == key:
                ans.append(f"{i} {j}")
if ans:
    print("\n".join(a for a in ans))


### FIXED CODE ###

base1 = 1009
base2 = 1013
mask = (1 << 32) - 1
def calc_hash(f, r, c):
    global ph, pw, h
    tmp = [[0] * c for _ in range(r)]
    dr, dc = r - ph, c - pw
    # t1 = 1
    t1 = (base1 ** pw) & mask
    # for _ in range(pw):
        # t1 = (t1 * base1) & mask
    for i in range(r):
        e = 0
        for j in range(pw):
            e = e * base1 + f[i][j]
        for j in range(dc):
            tmp[i][j] = e
            e = (e * base1 - t1 * f[i][j] + f[i][j + pw]) & mask
        tmp[i][dc] = e
    t2 = 1
    for _ in range(ph):
        t2 = (t2 * base2) & mask
    for j in range(dc + 1):
        e = 0
        for i in range(ph):
            e = e * base2 + tmp[i][j]
        for i in range(dr):
            h[i][j] = e
            e = (e * base2 - t2 * tmp[i][j] + tmp[i + ph][j]) & mask
        h[dr][j] = e
th, tw = map(int, input().split())
t = tuple(tuple(ord(c) for c in input()) for _ in range(th))
ph, pw = map(int, input().split())
p = tuple(tuple(ord(c) for c in input()) for _ in range(ph))
ans = []
if th >= ph and tw >= pw:
    h = [[0] * tw for _ in range(th)]
    calc_hash(p, ph, pw)
    key = h[0][0] & mask
    calc_hash(t, th, tw)
    for i in range(th - ph + 1):
        for j in range(tw - pw + 1):
            if h[i][j] & mask == key:
                ans.append(f"{i} {j}")
if ans:
    print("\n".join(a for a in ans))
n = int(input())+1
a = int(input())
b = int(input())
print((n-a)*(n-b))

### FIXED CODE ###

import sys,math
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float('inf')
MOD = 10**9+7
dy = [0,1,0,-1]
dx = [1,0,-1,0]
ddy = [0,1,1,1,0,-1,-1,-1]
ddx = [1,1,0,-1,-1,-1,0,1]

n,k = map(int,input().split())
if math.ceil(n/2) >= k:
    print('YES')
else:
    print('NO')
import sys
S=input()
k=int(input())
ans=0
flag=0
if S[0]==S[-1]:
    left=1
    for i in range(len(S)-1):
        if S[i+1]==S[0]:
            left+=1
        else:
            break
    if left==len(S):
        print(left*k//2)
        sys.exit()
    right=1
    for i in range(len(S)-1):
        if S[-i-2]==S[0]:
            right+=1
        else:
            break
    
now=""
for i in range(left,len(S)-right):
    if flag==1:
        flag=0
        now=S[i]
        continue
    if now==S[i]:
        ans+=1
        flag=1
    now=S[i]
ans*=k

if S[0]==S[-1]:
    ans+=(left+right)//2*(k-1)
    ans+=left//2+right//2
print(ans)

### FIXED CODE ###

import sys
S=input()
k=int(input())
ans=0
flag=0
left=0
right=0
if S[0]==S[-1]:
    left=1
    for i in range(len(S)-1):
        if S[i+1]==S[0]:
            left+=1
        else:
            break
    if left==len(S):
        print(left*k//2)
        sys.exit()
    right=1
    for i in range(len(S)-1):
        if S[-i-2]==S[0]:
            right+=1
        else:
            break
    
now=""
for i in range(left,len(S)-right):
    if flag==1:
        flag=0
        now=S[i]
        continue
    if now==S[i]:
        ans+=1
        flag=1
    now=S[i]
ans*=k

if S[0]==S[-1]:
    ans+=(left+right)//2*(k-1)
    ans+=left//2+right//2

print(ans)
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from itertools import accumulate
from itertools import chain
from collections import deque
def main():
    n = int(input())
    a1 = chain(tuple([0]), tuple(map(int, input().split())))
    a2 = chain(tuple([0]), tuple(map(int, input().split())))

    a1a = tuple(accumulate(a1))
    a2a = tuple(accumulate(a2))
    scores = deque()
    for i1 in range(1, n + 1):
        scores.append([i1] + a2a[n] - a2a[i1 - 1])
    r = max(scores)
    print(r)
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    a1 = list(map(int, input().split()))
    a2 = list(map(int, input().split()))

    scores = []
    for i1 in range(n):
        score = sum(a1[:i1+1]) + sum(a2[i1:])
        scores.append(score)
    r = max(scores)
    print(r)


if __name__ == '__main__':
    main()
array_temp = input.split()
N = array[0]
L = array[1]
strs = array[2:]
strs.sort()
print(strs)

### FIXED CODE ###

n, l = map( int, input().split( ' ' ) )
strs = sorted( [ input() for i in range(n) ] )
print( ''.join( strs ) )
A, B = map(int, input().split())
import math
C = math.gcd(A, B)
print(A * B // C)

### FIXED CODE ###

A, B = map(int, input().split())
from fractions import gcd
 
print(A * B // gcd(A, B))
import sys
sys.setrecursionlimit(1000000000)

n, k = map(int, input().split())
h_li = [int(input()) for i in range(n)]
a = max(h_li)-min(h_li)
dp = [[-1]*(a+5)]*100010

def dfs(i, choosed):
    if i == n:
        if len(choosed) != k:
            dif = 10000000010
        else:
            dif = max(choosed) - min(choosed)

    elif len(choosed) >= 2 and dp[len(choosed)][max(choosed)-min(choosed)] != -1:
        dif = dp[len(choosed)][max(choosed)-min(choosed)]
            
    elif len(choosed) == k:
        dif = max(choosed) - min(choosed)
        
    else:
        dif = min(
            dfs(i+1, choosed + [h_li[i]]),
            dfs(i+1, choosed)
        )

    return dif

print(dfs(0, []))

### FIXED CODE ###

n, k = map(int, input().split())
h = [int(input()) for i in range(n)]
h = sorted(h)
dif = 10**9

for i in range(n-k+1):
    if dif > h[i+k-1] - h[i]:
        dif = h[i+k-1] - h[i]

print(dif)
s = [len(x) for x in input().split('T')]
x, y = map(int, input().split())
len_s = len(s)
sx = [s[i] for i in range(len_s) if i % 2 == 0]
sy = [s[i] for i in range(len_s) if i % 2 == 1]

x -= sx[0]
sx = sx[1:]



def is_reachable(p, s):
    origin = 8
    if origin+p < 0:
        return False
        
    n = len(s)
    reachable = [[False for _ in range(origin * 2 + 1)] for i in range(n + 2)]
    reachable[0][origin] = True

    for i in range(n):
        for j in range(origin * 2 + 1):
            if not reachable[i][j]:
                continue
            if j - s[i] >= 0:
                reachable[i + 1][j - s[i]] = True
            if j + s[i] <= origin * 2:
                reachable[i + 1][j + s[i]] = True
    return reachable[n][p + origin] or reachable[n][-p + origin]


if is_reachable(x, sx) and is_reachable(y, sy):
    print('Yes')
else:
    print('No')


### FIXED CODE ###

s = [len(x) for x in input().split('T')]
x, y = map(int, input().split())
len_s = len(s)
sx = [s[i] for i in range(len_s) if i % 2 == 0]
sy = [s[i] for i in range(len_s) if i % 2 == 1]

x -= sx[0]
sx = sx[1:]



def is_reachable(p, s):
    origin = 8000
    if origin+p < 0:
        return False
        
    n = len(s)
    reachable = [set() for i in range(n + 1)]
    reachable[0].add(origin)

    for i in range(n):
        for j in list(reachable[i]):
            if j - s[i] >= 0:
                reachable[i + 1].add(j - s[i])
            if j + s[i] <= origin * 2:
                reachable[i+1].add(j + s[i])
    return (origin+p) in reachable[n] or (origin-p) in reachable[n]


if is_reachable(x, sx) and is_reachable(y, sy):
    print('Yes')
else:
    print('No')
import sys

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


def main():
    N, Q = map(int, readline().split())
    S = list(readline_s().rstrip())
    ac_check = [0] * (N)
    tsum = [0] * (N + 1)

    for i in range(N - 1):
        if S[i] == 'A' and S[i + 1] == 'C':
            tsum[i + 2] += 1
            ac_check[i] = 1
            ac_check[i + 1] = 2

    for i in range(N):
        tsum[i + 1] += tsum[i]

    # print(tsum)
    # print(ac_check)

    ans = []
    for i in range(Q):
        l, r = map(int, readline().split())
        count = tsum[r] - tsum[l - 1]
        if ac_check[l - 1] == 2:
            count -= 1
        ans.append(count)

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys


def main():
    N, Q = map(int, input().split())
    S = list(input())
    ac_check = [0] * (N)
    tsum = [0] * (N + 1)

    for i in range(N - 1):
        if S[i] == 'A' and S[i + 1] == 'C':
            tsum[i + 2] += 1
            ac_check[i] = 1
            ac_check[i + 1] = 2

    for i in range(N):
        tsum[i + 1] += tsum[i]

    ans = []
    for i in range(Q):
        l, r = map(int, input().split())
        count = tsum[r] - tsum[l - 1]
        if ac_check[l - 1] == 2:
            count -= 1
        ans.append(count)

    print('\n'.join(map(str, ans)))


if __name__ == '__main__':
    main()
a = int(input())
li = list(map(int, input().split())
b = float('inf')

for a in li:
          c = 0
	while a%2 == 0:
          a = a/2
          c += 1
          b = min(b,c)
print(b)
     

### FIXED CODE ###

n = int(input())
li = list(map(int, input().split()))
b = float('inf')
for a in li:
    c = 0
    while a%2 == 0:
      a = a/2
      c += 1
    b = min(b,c)
print(b)
N = int(input())
A = list(map(int,input().split()))

from collections import Counter
cnt = Counter(A)

ans = 0
for v in cnt.values():
    ans += v*(v-1)//2

for a in A:
    k = C[a]
    print(ans - (k*(k-1)//2) + (k-1)*(k-2)//2)

### FIXED CODE ###

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

from collections import Counter
cnt = Counter(A)

ans = 0
for v in cnt.values():
    ans += v*(v-1)//2

for a in A:
    k = cnt[a]
    print(ans - (k*(k-1)//2) + (k-1)*(k-2)//2)
a=[0]*100001
b=[0]*100001

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

for i in range(0,n,2):
  a[v[i]]+=1
for i in range(1,n,2):
  b[v[i]]+=1

if a.index(max(a))==b.index(max(b)):
  a= sorted(a[v[i]])
  b= sorted(b[v[i]])
  print(min(n-a[2]+b[1],n-a[1]-b[2]))
elif max(a)+max(b)==n and v[1]==v[0]:
  print(n//2)
else:
  print(n-max(a)-max(b))
  



### FIXED CODE ###

a=[0]*100001
b=[0]*100001

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

for i in range(0,n,2):
  a[v[i]]+=1
for i in range(1,n,2):
  b[v[i]]+=1

if a.index(max(a))==b.index(max(b)):
  a= sorted(a, reverse=True)
  b= sorted(b, reverse=True)
  print(min(n-a[1]-b[0],n-a[0]-b[1]))
else:
  print(n-max(a)-max(b))
from itertools import accumlate


def main():
    n, k = [int(x) for x in input().split()]
    dice = [int(x) for x in input().split()]

    expected_accum = list(accumlate((1 + p) / 2 for p in dice))

    def gen():
        for start in range(n - k + 1):
            if start == 0:
                yield expected_accum[k - 1]
            else:
                yield expected_accum[start + k - 1] - expected_accum[start - 1]

    print(max(gen()))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n, k = [int(x) for x in input().split()]
    dice = [int(x) for x in input().split()]

    expected_accum = []
    for i, p in enumerate(dice):
        ex = (1 + p) / 2
        if i == 0:
            expected_accum.append(ex)
        else:
            expected_accum.append(expected_accum[-1] + ex)

    def gen():
        for start in range(n - k + 1):
            if start == 0:
                yield expected_accum[k - 1]
            else:
                yield expected_accum[start + k - 1] - expected_accum[start - 1]

    print(max(gen()))


if __name__ == '__main__':
    main()
#!/usr/bin/python
# import time
import sys
def sieve(n):
    num = [1]*n
    num[0] = num[1] = 0
    for i in xrange(2,int(n**0.5)+1):
        if num[i]:
            for j in xrange(i**2, n, i):
                num[j] = 0
    return num.count(1)

# start = time.time()
for line in sys.stdin:
    hoge = sieve(int(line))
    print hoge
# elapsed_time = time.time()-start
# print elapsed_time
# print hoge

### FIXED CODE ###

#! -*- coding:utf-8 -*-
import sys
# import time
for line in sys.stdin:
  n=int(line)
  # n=input()
  # start = time.time()
  #plist = [1 for i in xrange(n+1)]
  #??¨??¨1???????????????
  #1?????¨???????????????????´???°??¨??????
  plist = [1]*(n+1)
  #0??¨1????´???°?????????????????§0???????????????
  plist[0]=plist[1]=0
  i=2
  #??¶??°????????????????????????
  while True:
      pos0 = 2*i
      if pos0 < len(plist):
          plist[pos0] = 0
      else:
          break
      i+=1
  #???????????¨????????????????????????
  for x in xrange(3,int(n**0.5)+1):
    if plist[x]:
      for pos0 in xrange(x**2,n+1,x):
        plist[pos0] = 0
  # elapsed_time = time.time()-start
  # print elapsed_time
  print plist.count(1)
H,W = map(int,raw_input().split(" "))

matel = {}

for i in range(H):
    line = raw_input()
    for c in line:
        if not c in matel:
            matel[c] = 0
        matel[c] += 1




def cnter():
    cnt4 = 0
    cnt2 = 0
    cnt1 = 0

    for key in matel.keys():
        vs = matel[key]
        while vs >= 4:
            cnt4+=1
            vs-=4
        while vs >= 2:
            cnt2 += 1
            vs-=2
        cnt1 +=vs

    return cnt1,cnt2,cnt4



def solve():
    cnt1,cnt2,cnt4 = cnter()

    if H%2 == 0 and W%2 == 0:
        if cnt2 == 0 and cnt1 == 0:
            print "Yes"
        else:
            print "No"
    elif H%2 == 1 and W%2 == 1:
        if cnt1 != 1:
            print "No"
            return
        po = (W/2)+(H/2) - cnt2
        if po < 0:
            print "No"
            return

        if po %2 == 0:
            print "Yes"
        else:
            print "No"

    else:
        if cnt1:
            print "No"
            return 
        if H%2 == 1:
            po = W/2 -cnt2
        else:
            pos = H/2 - cnt2

        if po < 0:
            print "No"
            return
        if po % 2 == 0:
            print "Yes"
        else:
            print "No"

solve()


### FIXED CODE ###

H,W = map(int,raw_input().split(" "))

matel = {}

for i in range(H):
    line = raw_input()
    for c in line:
        if not c in matel:
            matel[c] = 0
        matel[c] += 1




def cnter():
    cnt4 = 0
    cnt2 = 0
    cnt1 = 0

    for key in matel.keys():
        vs = matel[key]
        while vs >= 4:
            cnt4+=1
            vs-=4
        while vs >= 2:
            cnt2 += 1
            vs-=2
        cnt1 +=vs

    return cnt1,cnt2,cnt4



def solve():
    cnt1,cnt2,cnt4 = cnter()

    if H%2 == 0 and W%2 == 0:
        if cnt2 == 0 and cnt1 == 0:
            print "Yes"
        else:
            print "No"
    elif H%2 == 1 and W%2 == 1:
        if cnt1 != 1:
            print "No"
            return
        po = (W/2)+(H/2) - cnt2
        if po < 0:
            print "No"
            return

        if po %2 == 0:
            print "Yes"
        else:
            print "No"

    else:
        if cnt1:
            print "No"
            return 
        if H%2 == 1:
            po = W/2 - cnt2
        else:
            po = H/2 - cnt2

        if po < 0:
            print "No"
            return
        if po % 2 == 0:
            print "Yes"
        else:
            print "No"

solve()
n, m = map(int, input())
print((n-1)*(m-1))

### FIXED CODE ###

n, m = map(int, input().split())
print((n-1)*(m-1))
n,m=map(int,input().split())
print('Yes' if n=m else 'No')

### FIXED CODE ###

n,m=map(int,input().split())
print('Yes' if n==m else 'No')
X, N = map(int, input().split())

if N==0:
  print(X)
  exit(0)
  
p = [int(i) for i in input().split()]

for i in range(X+1):
  for s in [-1,1]:
    a = X + i*s
    if a not in p:
      print(a)
      exit(0)
  

### FIXED CODE ###

print(input().split().index('0')+1)
a,b,c,d = map(int,input().split())
if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
    print('Yes')
else
    print('No')

### FIXED CODE ###

a,b,c,d = map(int,input().split())
if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
    print('Yes')
else:
    print('No')
a, b, c = map(int, input().split())
return len(set([a, b, c])) > 2

### FIXED CODE ###

a, b, c = map(int, input().split())
print('Yes' if len(set([a, b, c])) == 2 else 'No')
n = int(input())
x = list(map(int,input().split()))
for i in range(n):
    x[i]-=i+1
x.sort()
l=len(x)
if n%2==0:
    b = int((x[l/2-1]+x[l/2])/2)
else:
    b = x[int((l-1)/2)]
ans=0
for i in range(n):
    ans+=abs(x[i]-b)
print(ans)

### FIXED CODE ###

n = int(input())
x = list(map(int,input().split()))
for i in range(n):
    x[i]-=i+1
x.sort()
if n%2==0:
    b = (x[n//2-1]+x[n//2])//2
else:
    b = x[(n-1)//2]
ans=0
for i in range(n):
    ans+=abs(x[i]-b)
print(ans)
sa = list(input())
sb = list(input())
sc = list(input())

cnta = len(sa)
cntb = len(sb)
cntc = len(sc)

d = sa[0]

while not(cnta == 0 or cntb == 0 or cntc == 0):
    if d == 'a':
        sa = sa[1::]
        d = sa[0]
    elif d == 'b':
        sb = sb[1::]
        d = sb[0]
    else:
        sc = sc[1::]
        d = sc[0]
if cnta == 0:
    print('A')
elif cntb == 0:
    print('B')
else:
    print('C')

### FIXED CODE ###

sa = list(input())
sb = list(input())
sc = list(input())

d = 'a'
cnta = 0
cntb = 0
cntc = 0
A = len(sa)
B = len(sb)
C = len(sc)

while 1:
    if d == 'a':
        cnta += 1
        if cnta == A+1:
            print('A')
            break
        d = sa.pop(0)
    elif d == 'b':
        cntb += 1
        if cntb == B+1:
            print('B')
            break
        d = sb.pop(0)
    else:
        cntc += 1
        if cntc == C+1:
            print('C')
            break
        d = sc.pop(0)
N, M = 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

if M <= 1 and N <= 1:
    print(0)
elif M == 2 and N == 2:
    print(2)
elif M == 2:
    print(cmb(N, 2)+1)
elif N == 2:
    print(cmb(M, 2)+1)
elif M == 0:
    print(cmb(N, 2))
elif N == 0:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)

### FIXED CODE ###

N, M = 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

if M == 0 and N == 0:
    print(0)
elif M == 1 and N == 1:
    print(0)
elif M <= 1:
    print(cmb(N, 2))
elif N <= 1:
    print(cmb(M, 2))
else:
    a = cmb(M, 2)
    b = cmb(N, 2)
    print(a + b)
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

sample_list = []
sample_list.append(a)
sample_list.append(b)
sample_list.append(c)
sample_list.append(d)
sample_list.append(e)

x = []
for i in sample_list:
  if i%10 == 0:
    x.append(0)
  else:
    x.append(10-(i%10))

print(sum(sample_list)+sum(x)-max(x))
              

### FIXED CODE ###

a =int(input())
b =int(input())
c =int(input())
d =int(input())
e =int(input())
sample_list = []
sample_list.append(a)
sample_list.append(b)
sample_list.append(c)
sample_list.append(d)
sample_list.append(e)
x = []
for i in sample_list:
  if i%10 == 0:
    x.append(0)
  else:
    x.append(10-(i%10))
print(sum(sample_list)+sum(x)-max(x))
n,m=map(int,input().split())
if abs(n-m)>1:
    print(0)

ans=int(1)
for i in range(1,n+1):
    ans*=i
    
for i in range(1,m+1):
    ans*=i

if n==m:
    ans*=2

if abs(n-m)>1:
    ans=0

print(ans%=1000000007)

### FIXED CODE ###

n,m=map(int,input().split())
if abs(n-m)>1:
    print(0)

else:
    ans=int(1)
    for i in range(1,n+1):
        ans*=i
        ans%=1000000007
    
    for i in range(1,m+1):
        ans*=i
        ans%=1000000007

    if n==m:
        ans*=2
        ans%=1000000007
    
    print(ans)
x,y,z=list(map(int,input(),splut()))

print(z,x,y)

### FIXED CODE ###

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

print(z,x,y)
while True:
	try:
		input = raw_input()
		splited = input.split()
		num = int(splited[0])+int(splited[1])
		print len(str(num))
	except EOFerror:
		break

### FIXED CODE ###

while True:
	try:
		a,b = map(int, raw_input().split())
		print len(str(a+b))
	except EOFError:
		break
n,k = map(int,input().split())



for i in range(k):
    if i > n-k+1:
        print(0)

    else:
        total = 1
        total2 = 1
        total3 = 1
        for j in range(i+1):
            total *= n-k+1-j
            total2 *= j+1
            total3 = int(total/total2)
            
        ww = (i+1)**(k-i-1)
        ans = ww * total3

        ans2 = ans % 1000000007

        print(ans2)
    


### FIXED CODE ###

n,k = map(int,input().split())
mod = 10**9+7

a = [1 for i in range(2010)]

memo = 1
for i in range(1,2001):
    memo *= i
    a[i] = memo



for i in range(1,k+1):
    if not((n-k+2 > i)):
        print(0)

    else:
        memo1 = a[n-k+1]*a[k-1]
        memo2 = a[i]*a[n-k+1-i]*a[i-1]*a[k-i]

        ans2 = memo1//memo2
        print(ans2%mod)
n = int(input())
L1,L2 = [],[]
for i in range(n):
    a,b = map(int,input().split())
    L1.append(b)
    L2.append(a)
L1 = L1[::-1]
L2 = L2[::-1]
#print(L1)
#print(L2)
cnt = 0
for i in range(n):
    
    L1[i] += cnt
    #print(L1[i])
    
    if L1[i] >= L2[i]:
        cnt += L1[i]%L2[i]
        
    elif L1[i] < L2[i]:
        c = 2
        while True:
            if L1[i] >= L2[i]:
                cnt += L1[i]%L2[i]
                #print(cnt,i,L1[i])
                break
            else:
                L1[i] *= c
                c +=1
        #cnt += L1[i]%L2[i]
print(cnt)

### FIXED CODE ###

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

num = 0
for i in range(n):
    A[i] +=num
    if A[i]%B[i] !=0:
        num = num + B[i] - A[i]%B[i]
        #print(num,B[i], B[i] - A[i]%B[i])
print(num)
N=int(input())
temp=input().split()
A=[int(temp[i]) for i in range(N)]

A=A[-1]+A

for i in range(N):
  print((A[i]+A[i+1])/2)

### FIXED CODE ###

N=int(input())
temp=input().split()
A=[int(temp[i]) for i in range(N)]
As=[]
As.append(sum([A[i]*pow(-1, i) for i in range(N)]))
for i in range(1, N):
  As.append(A[i-1]-As[i-1])

x1=As[0]/2
print(int(2*x1), end=' ')

for i in range(1, N):
  print(2*int(As[i]-x1*pow(-1, i)), end=' ')
import sys

def main():
    N = int(input())
    t = [0] * N+1
    x = [0] * N+1
    y = [0] * N+1
    for i in range(1, N+1):
        t[i], x[i], y[i] = map(int, input().split())
    
    flag = True
    for i in range(N):
        dt = t[i+1] - t[i]
        dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
        if dt % 2 != dist % 2:
            flag = False
            break
            
    print('Yes' if flag else 'No')
    
    

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

def main():
    N = int(input())
    t = [0] * (N+1)
    x = [0] * (N+1)
    y = [0] * (N+1)
    for i in range(1, N+1):
        t[i], x[i], y[i] = map(int, input().split())
    
    flag = True
    for i in range(N):
        dt = t[i+1] - t[i]
        dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])
        if dt % 2 != dist % 2 or dt < dist:
            flag = False
            break
            
    print('Yes' if flag else 'No')
    
    

if __name__ == '__main__':
    main()