Harryxun/stf_run huggingface dataset:
import numpy as n;i=n.int32;p=input;q=n.searchsorted;N=int(p());A=i(p().split());B=i(p().split());c=0;
for k in range(1,30):
  a,b=n.sort(n.hstack((A%(1<<k),A%(1<<k)-2**k))),B%(1<<k);c+=(n.sum(q(a,2**k-b)-q(a,2**(k-1)-b)))%2*2**(k-1)
print(c)


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
import numpy as np
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    a, b, c = LI()
    if a + b >= c:
        print("Yes")
    else:
        print("No")
    return

#B
def B():
    return

#C
def C():
    n = II()
    ab = LIR(n)
    cd = LIR(n)
    ab.sort()
    cd.sort()
    check = [0 for i in range(n)]
    ans = 0
    #print(ab)
    for _, c in enumerate(cd):
        d = c[1]
        c = c[0]
        maxy = -1
        x = -1
        for k, a in enumerate(ab):
            b = a[1]
            a = a[0]
            if maxy < b and c > a and check[k] == 0 and d > b:
                maxy = b
                x = k
                #print(a,b,c,d)
        if x != -1:
            ans += 1
            check[x] += 1
    print(ans)


    return

#D
def D():
    N = II()
    a = LI()
    b = LI()
    ans = 0
    for i in range(29):
        t = 2 ** i
        a2 = [A % (2 * t) for A in a]
        b2 = [B % (2 * t) for B in b]
        a2.sort()
        b2.sort()
        ansb = 0
        for A in a2:
            ansb += np.searchsorted(b2, 2 * t - A) - np.searchsorted(b2, t - A)
            ansb += N - np.searchsorted(b2, 3* t - A)
            #print(ansb)
        #ans += (ansb % 2) << i
        ans += ((ansb %2 ) << i)
    print(ans)
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()
input()
d = {}
for i in map(int, input().split()):
    if i in d:
        d[i] = 1
    else:
        d[i] += 1
print(sorted(d.values())[-1])
  
  

### FIXED CODE ###

input()
d = {}
for i in map(int, input().split()):
    for j in (-1, 0, 1):
        a = i + j
        if a in d:
            d[a] += 1
        else:
            d[a] = 1
print(sorted(d.values())[-1])
n = int(input())**2
print(n-int(input())

### FIXED CODE ###

n = int(input())**2
print(n-int(input()))
n=int(input())
x_=input()
px=x_.count("1")
if not px:
    print(0)
    for i in range(n-1):
        print(1)
    exit()

x=int(x_,2)

pow2=[1]

for i in range(n):
    tmp=pow2[-1]
    tmp*=2
    tmp%=px+1
    pow2.append(tmp)
pow22=[1]
for i in range(n):
    tmp=pow22[-1]
    tmp*=2
    tmp%=px-1
    pow22.append(tmp)
x1=x%(px+1)
x2=x%(px-1)
ans=[]
for i in range(n):
    tmp=0;dv=0
    if int(x_[-i-1]):
        tmp=x2-pow22[i]
        dv=px-1
    else:
        tmp=x1+pow2[i]
        dv=px+1
    if px==0:
        ans.append(0)
        continue
    cnt=1
    while tmp:
        tmp%=dv
        dv=bin(tmp).count("1")
        if not tmp:
            break
        cnt+=1
    ans.append(cnt)
for i in ans[::-1]:
    print(i)

### FIXED CODE ###

n=int(input())
x_=input()
px=x_.count("1")
if not px:
    for i in range(n):
        print(1)
    exit()
if px==1:
####[上から] i 桁目
    for i in range(n):
        if int(x_[i]):
            print(0)
        else:
            if i==n-1 or int(x_[-1])==1:###
                print(2)
            else:
                print(1)
    exit()
x=int(x_,2)

pow2=[1]

for i in range(n):
    tmp=pow2[-1]
    tmp*=2
    tmp%=px+1
    pow2.append(tmp)
pow22=[1]
for i in range(n):
    tmp=pow22[-1]
    tmp*=2
    tmp%=px-1
    pow22.append(tmp)
x1=x%(px+1)
x2=x%(px-1)
ans=[]
for i in range(n):
    tmp=0;dv=0
    if int(x_[-i-1]):
        tmp=x2-pow22[i]
        tmp%=(px-1)
        dv=px-1
    else:
        tmp=x1+pow2[i]
        tmp%=(px+1)
        dv=px+1
    
    cnt=1
    while tmp:
        
        dv=bin(tmp).count("1")
        if not dv or not tmp:
            break
        
        tmp%=dv
        cnt+=1
    ans.append(cnt)
for i in ans[::-1]:
    print(i)
from collections import defaultdict
edges = []
to = defaultdict(list) # 1から到達できるか
ot = defaultdict(list) # Nから到達できるか
N, M, P = map(int, input().split())
visited_toN = [False]*(N+1)
visited_fm1 = [False]*(N+1)    
for i in range(M):
    a,b,c = map(int, input().split())
    a -= 1
    b -= 1
    edges.append((a,b,-c+P))
    to[a].append(b)
    ot[b].append(a)

def dfs(v):
    global visited_fm1
    if visited_fm1[v]:return
    visited_fm1[v] = True
    for nxt in to[v]:
        dfs(nxt)
    
def dfs_r(v):
    global visited_toN
    if visited_toN[v]:return
    visited_toN[v] = True
    for nxt in ot[v]:
        dfs_r(nxt)
        
dfs(0)
dfs_r(N-1)
is_ok = []

for s, t in zip(visited_fm1,visited_toN):
    is_ok.append(s&t)


# BellmanFord    
INF = 10 ** 18
def bellmanFord(n, edges, s, g):
    """
    input
        n : 頂点の数
        edges : (始点, 終点, コスト)のリスト
        s : 探索の始点
        g : 探索の終点
    output
        sから各点への最短距離
    """    
    d = [INF] * n
    d[s] = 0
    cnt = 0
    while True:
        update = False
        for a, b, c in edges:
            if not is_ok[a]:continue
            if not is_ok[b]:continue
            if d[a] != INF and d[b] > d[a] + c:
                d[b] = d[a] + c
                update = True
        if not update:
            break
        cnt += 1
        # 負閉路の存在をチェック
        if cnt == n:
            print(-1)
            exit()
        # print(d,cnt)
    return d[g]



ans = bellmanFord(N,edges,0,N-1)
print(max(0,-ans))


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)
from collections import defaultdict
edges = []
to = defaultdict(list) # 1から到達できるか
ot = defaultdict(list) # Nから到達できるか
N, M, P = map(int, input().split())
visited_toN = [False]*(N+1)
visited_fm1 = [False]*(N+1)    
for i in range(M):
    a,b,c = map(int, input().split())
    a -= 1
    b -= 1
    edges.append((a,b,-c+P))
    to[a].append(b)
    ot[b].append(a)

def dfs(v):
    global visited_fm1
    if visited_fm1[v]:return
    visited_fm1[v] = True
    for nxt in to[v]:
        dfs(nxt)
    
def dfs_r(v):
    global visited_toN
    if visited_toN[v]:return
    visited_toN[v] = True
    for nxt in ot[v]:
        dfs_r(nxt)
        
dfs(0)
dfs_r(N-1)
is_ok = []

for s, t in zip(visited_fm1,visited_toN):
    is_ok.append(s and t)


# BellmanFord    
INF = 10 ** 18
def bellmanFord(n, edges, s, g):
    """
    input
        n : 頂点の数
        edges : (始点, 終点, コスト)のリスト
        s : 探索の始点
        g : 探索の終点
    output
        sから各点への最短距離
    """    
    d = [INF] * n
    d[s] = 0
    cnt = 0
    while True:
        update = False
        for a, b, c in edges:
            if not is_ok[a]:continue
            if not is_ok[b]:continue
            if d[a] != INF and d[b] > d[a] + c:
                d[b] = d[a] + c
                update = True
        if not update:
            break
        cnt += 1
        # 負閉路の存在をチェック
        if cnt > n:
            print(-1)
            exit()
        # print(d,cnt)
    return d[g]



ans = bellmanFord(N,edges,0,N-1)
print(max(0,-ans))
H,W = list(int,map(input().split()))
for i in range(H):
  C = input()
  print(C)
  print(C)

### FIXED CODE ###

a = list(map(int,input().split()))
for i in range(a[0]):
  b = input()
  print(b)
  print(b)
def d_maximum_sum_of_minimum(N, Nodes, C):
    # 根から始め、巡回した葉にCの大きなものから順に書き込んで行く。

    int_list = list(sorted(C))
    graph = [[] for _ in range(N)]
    for u, v in Nodes:  # 0-basedとする
        graph[u - 1].append(v - 1)
        graph[v - 1].append(u - 1)

    def traverse_tree(parent, current, ret=[0] * N):
        """各頂点にCの値が大きなもの順に書き込んでいく"""
        def dfs(p, c):
            ret[c] = int_list.pop()
            for next_edge in graph[c]:
                if next_edge != p:  # 木を「逆戻り」しない頂点だけ調べる
                    dfs(c, next_edge)
        dfs(parent, current)
        return ret
    tmp = traverse_tree(-1, 0)
    return str(sum(tmp[1:])) + '\n' + ' '.join(map(str, tmp))

N = int(input())
Nodes = [[int(i) for i in input().split()] for j in range(N - 1)]
C = [int(i) for i in input().split()]
print(d_maximum_sum_of_minimum(N, Nodes, C))


### FIXED CODE ###

def d_maximum_sum_of_minimum(N, Nodes, C):
    # 根から始め、巡回した葉にCの大きなものから順に書き込んで行く。
    import sys
    sys.setrecursionlimit(10**6)

    int_list = list(sorted(C))
    graph = [[] for _ in range(N)]
    for u, v in Nodes:  # 0-basedとする
        graph[u - 1].append(v - 1)
        graph[v - 1].append(u - 1)

    def traverse_tree(parent, current, ret=[0] * N):
        """各頂点にCの値が大きなもの順に書き込んでいく"""
        def dfs(p, c):
            ret[c] = int_list.pop()
            for next_edge in graph[c]:
                if next_edge != p:  # 木を「逆戻り」しない頂点だけ調べる
                    dfs(c, next_edge)
        dfs(parent, current)
        return ret
    tmp = traverse_tree(-1, 0)
    return str(sum(tmp[1:])) + '\n' + ' '.join(map(str, tmp))

N = int(input())
Nodes = [[int(i) for i in input().split()] for j in range(N - 1)]
C = [int(i) for i in input().split()]
print(d_maximum_sum_of_minimum(N, Nodes, C))
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


lim = 2*10**5   #必要そうな階乗の限界を入力

#階乗#
fact = [1] * (lim+1)
for n in range(1, lim+1):
	fact[n] = n * fact[n-1] % mod

#階乗の逆元#
fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod


H, W, A, B = MAP()

ans = 0
for n in range(B, W):
	way = C(H-A-1+n, n)*C(W-n-1+A-1, A-1)%mod
	ans = (ans+way)%mod

print(ans)

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

lim = 2*10**6
fact = [1]*(lim+1)
for n in range(1, lim+1):
	fact[n] = n*fact[n-1]%mod

fact_inv = [1]*(lim+1)
fact_inv[lim] = pow(fact[lim], mod-2, mod)
for n in range(lim, 0, -1):
	fact_inv[n-1] = n*fact_inv[n]%mod

def C(n, r):
	return (fact[n]*fact_inv[r]%mod)*fact_inv[n-r]%mod

H, W, A, B = MAP()

ans = 0
for n in range(B, W):
	way = C(H-A-1+n, n)*C(W-n-1+A-1, A-1)%mod
	ans = (ans+way)%mod

print(ans)
n,k=map(int,input().split())
 
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a=sorted(a)
f=sorted(f,reverse=True)
 
l=-1
r=max(a)*max(f)
def ok():
    s=0
    for i in range(n):
        s+=max(0,int(int(a[i])-int(c/f[i])))
    return s<=k
 
while(l+1<r):
    c=int((l+r)/2)
    ok=lambda :
    	s=0
    	for i in range(n):
    	    s+=max(0,int(int(a[i])-int(c/f[i])))
    	return s<=k
    if ok:
        r=c
    else:
        l=c
print(r)

### FIXED CODE ###

import math
a,b,x=map(int,input().split())
if (a*a*b)/2>x:
  print(math.degrees(math.atan(a*b*b/(2*x))))
else:
  print(math.degrees(math.atan(2*(a*a*b-x)/(a*a*a))))
a, b = map(int, input().split( )
area = a*b
perimeter = 2*(a+b)
print(area, perimeter)

### FIXED CODE ###

a, b = map(int, input().split(" "))
area = a*b
perimeter = 2*(a+b)
print(area, perimeter)
n=int(input())
s=input()
t=input()
while True:
  if s==t:
    break
  s=s[1:]
  t=[:-1]
  n+=1
print(n)

### FIXED CODE ###

n=int(input())
s=input()
t=input()
while True:
  if s==t:
    break
  s=s[1:]
  t=t[:-1]
  n+=1
print(n)
N,A = map(int,input().split())
X = [0]+list(map(int,input().split()))
dp = []
for i in range(N+1):
  K = []
  for j in range(N+1):
    J = [0]*(N*max(X)+1)
    K.append(J)
  dp.append(K)
for j in range(N+1):
  for k in range(N+1):
    for s in range(N*max(X)+1):
      if j >= 1:
        if s < X[j]:
          dp[j][k][s] = dp[j-1][k][s]
        elif s >= X[j] and k >= 1:
          dp[j][k][s] = dp[j-1][k][s]+dp[j-1][k-1][s-X[j]]
        else:
          dp[j][k][s] = 0
      else:
        if k == 0 and s == 0:
          dp[j][k][s] = 1
        else:
          dp[j][k][s] = 0
ans = 0
for i in range(1,N+1):
  ans += dp[N][i][i*A]
print(ans)

### FIXED CODE ###

N,A = map(int,input().split())
X = [0]+list(map(int,input().split()))
dp = []
for i in range(N+1):
  K = []
  for j in range(N+1):
    J = [0]*(N*max(X)+1)
    K.append(J)
  dp.append(K)
for j in range(N+1):
  for k in range(N+1):
    for s in range(N*max(X)+1):
      if j >= 1:
        if s < X[j]:
          dp[j][k][s] = dp[j-1][k][s]
        elif s >= X[j] and k >= 1:
          dp[j][k][s] = dp[j-1][k][s]+dp[j-1][k-1][s-X[j]]
        else:
          dp[j][k][s] = 0
      else:
        if k == 0 and s == 0:
          dp[j][k][s] = 1
        else:
          dp[j][k][s] = 0
ans = 0
for i in range(1,N+1):
  if i*A <= N*max(X):
    ans += dp[N][i][i*A]
print(ans)
s = input()
k = int(input())
dic = {}
for i in range(len(s)):
    for j in range(i+1,len(s)+1):
        if s[i:j] in dic:
            continue
        dic[s[i:j]] = 1

print(sorted(dic.keys())[k-1])

### FIXED CODE ###

a,b,c,d = map(int, input().split())
if abs(a-b) <= d and abs(b-c) <= d:
    print("Yes")
    quit()
if abs(a-c) <= d:
    print("Yes")
    quit()
print("No")
N = int(input())
2 ans = 0
3 for i in range(1, N + 1):
4 if len(str(i)) % 2 == 1:
5 ans += 1
6 print(ans)


### FIXED CODE ###

A,B,C = map(int, input().split())
if B >= 1 and A >= B and A <= 20 and C >= 1 and C <= 20:
    capacity = A - B
    if capacity <= C:
        remaining = C - capacity
    else:
        remaining = 0
    print(remaining)
def Fib(n, memo={}):
    if n == 1:
        return 0
    elif n == 2:
        return 1
    elif n in memo:
        return memo[n]
    else:
        memo[n] = Fib(n-1, memo) + Fib(n-2, memo)
        return memo[n]
    
N, M = map(int, input().split())
A = [int(input()) for i in range(M)]

x=0
L=[]
for i in range(M):
    L += [A[i] - 1 - x]
    x = A[i] + 1
L += [N - x]
L = [Fib(i+2)%1000000007 for  i in L]

X=1
for i in range(len(L)):
    X=X*L[i]%1000000007
print(X)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

from itertools import product

def mat2_mul(X, Y):
    Z = [ [0, 0], 
          [0, 0] ]
    for (i,j,k) in product(range(2),range(2),range(2)):
        Z[i][j] += X[i][k] * Y[k][j]
    return Z

def mat2_pow(X, n):
    if n == 0:
        return [ [1, 0],
                 [0, 1] ]
    elif n % 2:
        return mat2_mul(X, mat2_pow(X, n-1))  
    else:
        half_pow = mat2_pow(X, n/2)
        return mat2_mul(half_pow, half_pow)

def Fib(n):
    if n == 0:
        return 0
    else:
        F = [ [0, 1],
              [1, 1] ]
        return mat2_pow(F, n-1)[1][1]
    
    
N, M = map(int, input().split())
A = [int(input()) for i in range(M)]

x=0
L=[]
for i in range(M):
    L += [A[i] - 1 - x]
    x = A[i] + 1
L += [N - x]
L = [Fib(i+1)%1000000007 for  i in L]

X=1
for i in range(len(L)):
    X *= L[i]
    X %= 1000000007 
print(X)
# -*- coding: utf-8 -*-


def cal_xor(xor_list, rm_ind):
    ans = None
    for i, xi in enumerate(xor_list):
        if i!=rm_ind:
            if ans is not None:
                ans = ans^xi
            else:
                ans = xi
    return ans

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

ans_str = ''

if N==2:
    print("{} {}".format(a[1], a[0]))
else:

    xors = []
    for i in range(N//2):
        xors.append(a[2*i]^a[2*i+1])

    for i, ai in enumerate(a):
        sum_xor = cal_xor(xors, i//2)
        if i%2==0:
            ind = i+1
        else:
            ind = i-1

        ans = sum_xor^a[ind]
        ans_str += str(ans)+' '
    print(ans_str[:-1])


### FIXED CODE ###

# -*- coding: utf-8 -*-

N, = map(int, input().split())
A = list(map(int, input().split()))
Q, = map(int, input().split())
B = []
C = []
for _ in range(Q):
    Bi, Ci = map(int, input().split())
    B.append(Bi)
    C.append(Ci)

e_dict = {}
for a in A:
    if a in e_dict.keys():
        e_dict[a] += 1
    else:
        e_dict[a] = 1

ans = sum(A)

for b, c in zip(B, C):
    keys = e_dict.keys()
    if b in keys:
        poped = e_dict.pop(b)
        gap = c - b
        ans += (gap * poped)

        if c in keys:
            e_dict[c] += poped
        else:
            e_dict[c] = poped

    print(ans)
N = int(input())
a = [0] + list(map(int,input().split()) + [0]
A = [abs(a[i]-a[i+1]) for i in range(N+1)]
total = sum(A)
             
for i in range(N):
    print(total + abs(a[i+2]-a[i])-A[i]-A[i+1])


### FIXED CODE ###

n = int(input())
a = [0] + list(map(int, input().split())) + [0]
A = [abs(a[i] - a[i + 1]) for i in range(n + 1)]
total = sum(A)

for i in range(n):
    print(total + abs(a[i + 2] - a[i]) - A[i] - A[i + 1])
R = int(input())
if R < 1200:
  print("ABC")
else:
    if R < 2800:
    print("ARC")
  else:
    print("AGC")
  

### FIXED CODE ###

R = int(input())
if R < 1200:
  print("ABC")
else:
  if R < 2800:
    print("ARC")
  else:
    print("AGC")
k = int(input())
a, b = map(int, input(),split())
for i in range(a, b+1):
    if i % k == 0:
        print('OK')
        exit()
print('NO')

### FIXED CODE ###

k = int(input())
a, b = map(int, input().split())
for i in range(a, b+1):
    if i % k == 0:
        print('OK')
        exit()
print('NG')
A,B,C,D = list(map(int,input().split()))
import math
E = C * D // math.gcd(C,D)
total = B - B // C - B // D + B // E
F = A-1
total -= F - F // C - F // D + F // E
print(total)

### FIXED CODE ###

A,B,C,D = list(map(int,input().split()))
import fractions
E = C * D // fractions.gcd(C,D)
total = B - B // C - B // D + B // E
F = A-1
total -= F - F // C - F // D + F // E
print(total)
print ((int(input())-1) * (int(input())-1))

### FIXED CODE ###

a, b = map(int, input().split())
print ((a-1)*(b-1))
n=int(input())
def des(s):
    if int(s) > n:
        return 0
    ret = 1 if all(s.count(c)>0 for c in "753") else 0
    for c in "753":
        ret += dfs(s+c)
    return ret
print(dfs("0"))



### FIXED CODE ###

n=int(input())
def dfs(s):
    if int(s) > n:
        return 0
    if all(s.count(c)>0 for c in "753"):
        ret = 1
    else:
        ret = 0
    for c in "753":
        ret += dfs(s+c)
    return ret
print(dfs("0"))
from fractions import gcd
n, m = map(int, input().split())
s = input()
t = input()
l = n * m // gcd(n, m)
a = [""] * l
for i in range(n):
    a[i*l//n] = s[i]
for i in range(m):
    if a[i*l//m] != "":
        if a[i*l//m] == t[i]:
            continue
        else:
            print(-1)
            exit()
    else:
        continue
print(l)



### FIXED CODE ###

from fractions import gcd
n, m = map(int, input().split())
s = input()
t = input()
g = gcd(n,m)
l = n*m//g
for k in range(g):
    if s[k*n//g] != t[k*m//g]:
        print(-1)
        exit()
print(l)
import sys
sys.setrecursionlimit(3000)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
n,k=map(int,input().split())
ans=[0]*k
for i in range(k):
  ans = cmb(n-k+1,i+1)*cmb(k-1,i)
  print(ans%(10**9+7))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    r=min(r,n-r)
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]
n,k=map(int,input().split())
ans=[0]*k

for i in range(k):
  if n-k<i:
    print(0)
    continue
  ans = cmb(n-k+1,i+1)*cmb(k-1,i)
  print(ans%(10**9+7))
N,K = map(int,input().split())
A = list(map(int,input().split()))
town = [[] for _ in range(N)]
visited = [0]

for i in range(N):
  town[i] = [i,A[i] - 1]

def teleport(i,con):
  goal = town[i][1]
  if goal in visited or con == K:
    return goal
  else:
    visited.append(goal)
    return teleport(goal,con + 1)

l = teleport(visited[0],0)

print([i + 1for i in visited])

if K <= len(visited):
  print(visited[K] + 1)
else:
  if l in visited:
    cs = visited.index(l)
    cycle = visited[cs:]
    K = K - len(visited) + len(cycle)
  print(cycle[K % len(cycle)] + 1)
  


### FIXED CODE ###

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

A = list(map(int,input().split()))
town = [[] for _ in range(N)]
visited = [0]
flag = [-1] * N

for i in range(N):
  town[i] = [i,A[i] - 1]

f = 0

while flag[f] == -1:
  t = town[f][1]
  flag[f] = t
  f = town[t][0]
  visited.append(t)
  
l = visited[-1]
lv = len(visited)

if K <= lv:
  print(visited[K] + 1)
else:
  cs = visited.index(l)
  cycle = visited[cs:-1]
  lc = len(cycle)
  print(cycle[(K - lv + 1) % lc] + 1)
##i
a = int(input("Please Enter Number: "))
b = int(input("Please Enter Number: "))

check = (a*b)%2
if check ==0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

a,b = map(int,input().split())
if(a*b % 2 == 0):
  print("Even")
else:
  print("Odd")
n=input()
if n%2==0:
  print(n/2)
if n%2==1:
  print((n+1)/2)

### FIXED CODE ###

n=int(input())
if n%2==0:
  print(int(n/2))
elif n%2==1:
  print(int((n+1)/2))
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
mod=10**9+7
total=0
from math import factorial
for i in range(n-k+1):
   f=int((factorial(n-i-1)/factorial(k-1)/factorial(n-k-i)))%mod
   total+=int((l[n-i-1]-l[i])*f)
   total%=mod
print(total)

### FIXED CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
mod=10**9+7
n_max=2*10**5
F,FI=[0]*(n_max+1),[0]*(n_max+1)
F[0],FI[0]=1,1
for i in range(n_max):
  F[i+1]=(F[i]*(i+1))%mod
  FI[i+1]=pow(F[i+1],mod-2,mod)
def comb(x,y):
  return (F[x]*FI[x-y]*FI[y])%mod
total=0
for i in range(n-k+1):
   f=comb(n-i-1,k-1)%mod
   total+=int((l[n-i-1]-l[i])*f)
   total%=mod
print(total)
x=str(N)
for y in x:
  if y=="7":
    return "Yes"
return "No"

### FIXED CODE ###

x=input()
z="No"
for y in x:
  if y=="7":
    z="Yes"
print(z)
h,w = map(int,input().split())
for i in range(h):
  c = list(map(int,input().split()))
  print(c)
  print(c)

### FIXED CODE ###

h,w = map(int,input().split())
for i in range(h):
  c = input()
  print(c)
  print(c)
n = int(input())
a = list(map(int, input().split()))
t = list(sorted(a[i] - (i + 1) for i in range(n)))
if len(t) % 2 == 0:
  b = (t[len(t)] + t[len(t + 1)]) // 2
else:
  b = t[len(t) // 2]
print(sum(abs(a[i] - (b + i + 1)) for i in range(n)))


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
t = list(sorted(a[i] - (i + 1) for i in range(n)))
b = t[len(t) // 2]
print(sum(abs(a[i] - (b + i + 1)) for i in range(n)))