Harryxun/stf_run huggingface dataset:
import sys

sys.setrecursionlimit(10**6)

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

cnt = [0 for i in range(n)]

for i in range(n):
    cnt[a_l[i]]+=1
ans = 0

for a in cnt:
    ans += a*(a-1)/2
for i in range(n):
    print(int(ans - (cnt[a_l[i]]-1)))

### FIXED CODE ###

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

from collections import Counter
count = Counter(A)
 
s = 0
for c in list(count.values()):
    s += c*(c-1)/2

ans = 0
for a in A:
    n = count[a]
    ans = s - n*(n-1)/2 + (n-1)*(n-2)/2
    print(int(ans))
A = int(input())
B = int(input())

print((A-1)*(B-1))

### FIXED CODE ###

A,B = input().split()
A = int(A)
B = int(B)

print((A-1)*(B-1))
# C - Multiple Clocks
# import math mathはatcoderでは使えない
from fractions import gcd
N = int(input())
T = [int(input()) for i in range(N)]
# 最小公倍数を求める
DP = [0]*(N-1)
DP[0] = (T[0]*T[1])//gcd(T[0],T[1])
for i in range(1,N-1):
    DP[i] = (DP[i-1]*T[i+1]) // gcd(DP[i-1],T[i+1])

print(DP[-1])

### FIXED CODE ###

# C - Multiple Clocks
# import math mathはatcoderでは使えない
from fractions import gcd
N = int(input())
T = [int(input()) for i in range(N)]
# 最小公倍数を求める
if N == 1:
    print(T[0])
else:
    DP = [0]*(N-1)
    DP[0] = (T[0]*T[1])//gcd(T[0],T[1])
    for i in range(1,N-1):
        DP[i] = (DP[i-1]*T[i+1]) // gcd(DP[i-1],T[i+1])
    print(DP[-1])
n, m = map(int, input().split())

xy_dict = {}
for i in range(1,n+1):
    xy_dict[i] = []

for i in range(m):
    x,y = map(int, input().split())
    xy_dict[x].append(y)

dp = [-1]*(n+1)

def get_longest(x):
    global dp

    if( dp[x] > 0):
        return dp[x]
    else:
        y_list = xy_dict[x]
        temp_max = 0
        for y in y_list:
            temp_max = max(temp_max, get_longest(y)+1)

        dp[x] = temp_max
        return temp_max

for i in range(1,n+1):
    get_longest(i)

print(max(dp))

### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(10 ** 7)

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

xy_dict = {}
for i in range(1,n+1):
    xy_dict[i] = []

for i in range(m):
    x,y = map(int, input().split())
    xy_dict[x].append(y)

dp = [-1]*(n+1)
dp[0] = 0

def get_longest(x):
    global dp

    if( dp[x] >= 0):
        return dp[x]
    else:
        y_list = xy_dict[x]
        temp_max = 0
        for y in y_list:
            temp_max = max(temp_max, get_longest(y)+1)

        dp[x] = temp_max
        return temp_max

ans = 0
for i in range(1,n+1):
    ans = max(ans, get_longest(i))

print(ans)
n = int(input())
a = [float(input()) for _ in range(n)]
a = [i*10**9 for i in a]
MAX = 25
p_mat = [[0 for _ in range(MAX)] for _ in range(MAX)]

for i in a:
    b_cnt = 0
    while i % 2 == 0:
        i /= 2
        b_cnt += 1
    f_cnt = 0
    while i % 5 == 0:
        i /= 5
        f_cnt += 1
    p_mat[b_cnt][f_cnt] += 1

ans = 0
for b1 in range(MAX):
    for f1 in range(MAX):
        for b2 in range(MAX):
            for f2 in range(MAX):
                if b1+b2 >= 18 and f1+f2 >= 18:
                    if b1 == b2 and f1 == f2 and p_mat[b1][f1] > 0:
                        ans += p_mat[b1][f1] * (p_mat[b2][f2] - 1)
                    else:
                        ans += p_mat[b1][f1] * p_mat[b2][f2]
print(ans//2)

### FIXED CODE ###

import collections
from decimal import Decimal

n = int(input())
a = [Decimal(input()) for _ in range(n)]
a = [int(i*10**9) for i in a]
MAX = 19
p_dict = collections.defaultdict(int)

for i in a:
    b_cnt = 0
    while i % 2 == 0 and b_cnt < 18:
        i //= 2
        b_cnt += 1
    f_cnt = 0
    while i % 5 == 0 and f_cnt < 18:
        i //= 5
        f_cnt += 1
    p_dict[(b_cnt, f_cnt)] += 1

ans = 0
for b1, f1 in p_dict:
    for b2, f2 in p_dict:
        if b1+b2 >= 18 and f1+f2 >= 18:
            if b1 == b2 and f1 == f2:
                ans += p_dict[(b1, f1)] * (p_dict[(b2, f2)] - 1)
            else:
                ans += p_dict[(b1, f1)] * p_dict[(b2, f2)]
print(ans//2)
t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in rnage(1,t):
	s+=l[i]
    s/=2
print(s)

### FIXED CODE ###

t=int(input())
l=sorted(map(int, input().split()))
s=l[0]
for i in range(1,t):
  
  s+=l[i]
  s/=2
print(s)
#関数リスト
import sys
input = sys.stdin.readline
from collections import defaultdict, deque

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    h, w, k = MI()
    x1, y1, x2, y2 = MI()
    x1 -= 1
    y1 -= 1
    x2 -= 1
    y2 -= 1

    mylist = [0] * h

    #tableの読み込み
    for i in range(h):
        temp = input().rstrip()
        temp = [temp[j] for j in range(w)]
        mylist[i] = temp
    #初期化
    distance = [[float('inf') for i in range(w)] for j in range(h)]
    distance[x1][y1] = 0
    d = deque()
    start = tuple(x1, y1)
    goal = [x2, y2]
    d.append(start)
    move = tuple([-1,0],[1,0],[0,1],[0,-1])

    while d and index <= k:
        pos = d.pop()
        x = pos[0]
        y = pos[1]
        dist = distance[x][y]
        for i in move:
            #tempxの初期化
            tempx = x
            tempy = y
            for l in range(k):
                tempx += i[0]
                tempy += i[1]
                if not ((tempx >= 0 and tempx <= h-1) and (tempy >= 0 and tempy <= w - 1)):
                    break
                if dist + 1 < distance[tempx][tempy] and mylist[tempx][tempy] == ".":
                    distance[tempx][tempy] = dist + 1
                    d.append(tuple(tempx, tempy))
                else:
                    break
    if distance[x2][y2] == float('inf'):
        print(-1)
    else:
        print(distance[x2][y2])
        
main()


### FIXED CODE ###

#関数リスト
import sys
input = sys.stdin.readline
from collections import defaultdict, deque

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    h, w, k = MI()
    x1, y1, x2, y2 = MI()
    x1 -= 1
    y1 -= 1
    x2 -= 1
    y2 -= 1

    mylist = [0] * h

    #tableの読み込み
    for i in range(h):
        temp = input().rstrip()
        temp = [temp[j] for j in range(w)]
        mylist[i] = temp
    #初期化
    distance = [[-1 for i in range(w)] for j in range(h)]
    distance[x1][y1] = 0
    d = deque()
    start = (x1, y1)
    goal = [x2, y2]
    d.append(start)
    move = ([-1,0],[1,0],[0,1],[0,-1])

    while d:
        pos = d.popleft()
        x = pos[0]
        y = pos[1]
        if x == x2 and y == y2:
            print(distance[x2][y2])
            exit()
        dist = distance[x][y]
        for i in move:
            #tempxの初期化
            tempx = x
            tempy = y
            for l in range(k):
                tempx += i[0]
                tempy += i[1]
                if not ((tempx >= 0 and tempx <= h-1) and (tempy >= 0 and tempy <= w - 1)):
                    break
                elif mylist[tempx][tempy] == "." and distance[tempx][tempy] == -1:
                    distance[tempx][tempy] = dist + 1
                    d.append((tempx, tempy))
                elif dist + 1 <= distance[tempx][tempy] and mylist[tempx][tempy] == ".":
                    distance[tempx][tempy] = dist + 1
                else:
                    break
    print(-1)            
        
main()
[A, B, C] = list(map(int, input().split(' ')))

print(C + ' ' + A + ' ' + B)

### FIXED CODE ###

[A, B, C] = list(map(str, input().split(' ')))

print(C + ' ' + A + ' ' + B)
N, Q = list(map(int, input().split()))
nodes = {i:[] for i in range(N)}
for i in range(N-1):
  r, e = list(map(int, input().split()))
  r, e = r - 1, e - 1
  nodes[r].append(e)
  nodes[e].append(r)
#print(nodes)

result = [0] * N
for i in range(Q):
  r, s = list(map(int, input().split()))
  result[r-1] += s

def dfs(r, prev=-1):
  for i in nodes[r]:
    if i == prev:
      continue
    result[i] += result[r]
    dfs(i, r)

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

### FIXED CODE ###

#人の（ほぼ同じなのにうまくいかないので）
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

N, Q = map(int, input().split())
lines = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    lines[a-1].append(b-1)
    lines[b-1].append(a-1)
ans = [0]*N
for _ in range(Q):
    p, x = map(int, input().split())
    ans[p-1] += x

def dfs(v, parent):
    for u in lines[v]:
        if u != parent:
            ans[u] += ans[v]
            dfs(u, v)

dfs(0, -1)
print (*ans)
N = int(input())
a = [[] for _ in range(N)]
ans = [0]*N
for _ in range(N-1):
  u, v, w = map(int, input().split())
  a[u-1].append([v-1, w])
  a[v-1].append([u-1, w])
def calc(u, b):
  for v, w in a[u]:
    ans[v]=(ans[u] + w)
    if not b == v:
      calc(v, u)

calc(0, -1)
for i in ans:
  if i % 2 == 0:
    print(0)
  else:
    print(1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
N = int(input())
a = [[] for _ in range(N)]
ans = [0]*N
for _ in range(N-1):
  u, v, w = map(int, input().split())
  a[u-1].append([v-1, w])
  a[v-1].append([u-1, w])
def calc(u, b):
  for v, w in a[u]:
    if not b == v:
      ans[v]=(ans[u] + w)%2
      calc(v, u)
calc(0, -1)
for i in ans:
  if i % 2 == 0:
    print(0)
  else:
    print(1)
import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * (110000)
def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(x)
        return root[x]
    

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
        

for _ in range(m):
    a, b = map(int, input().split())
    unite(a, b)

ans = 0
for i in range(1, n+1):
    if root[i]  < 0:
        ans += 1
print(ans-1)
print(root)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * n
def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]
    

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
        

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    unite(a, b)

ans = len([i for i in root if i < 0]) - 1
print(ans)
n= int(input())
branchdict = {}
for i in range(n-1):
    a,b,c= map(int,input().split())
    branchdict[a-1] = branchdict.get(a-1,[]) + [(b-1,c)]
    branchdict[b-1] = branchdict.get(b-1,[]) + [(a-1,c)]
q,k= map(int,input().split())
cost = [0] * n
def dfs(curnode,pre,addcost):
    cost[curnode]=addcost
    if curnode in branchdict.keys():
        for abr in branchdict[curnode]:
            if abr[0]!=pre:
                dfs(abr[0],curnode,addcost+abr[1])
dfs(k-1,-1,0)
for i in range(q):
    x,y= map(int,input().split())
    print(cost[x-1]+cost[y-1])

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
input = sys.stdin.readline
n= int(input())
bd = [[] for _ in range(n)]
for i in range(n-1):
    a,b,c= map(int,input().split())
    bd[a-1].append((b-1,c))
    bd[b-1].append((a-1,c))
q,k= map(int,input().split())
cost = [0] * n
def dfs(curnode,pre,addcost):
    for abr in bd[curnode]:
        if abr[0]!=pre:
            cost[abr[0]]=addcost+abr[1]
            dfs(abr[0],curnode,addcost+abr[1])
dfs(k-1,-1,0)
for i in range(q):
    x,y= map(int,input().split())
    print(cost[x-1]+cost[y-1])
import sys
import math

def main():
    n, m = map(int,input().split())
    s = input()
    t = input()

    l = n * m // math.gcd(n,m)

    nlist = [0 for i in range(n)]
    mlist = [0 for i in range(m)]
    for i in range(n):
        nlist[i] =  i*l//n

    for i in range(m):
        mlist[i] =  i*l//m

    src_set = set(nlist)
    tag_set = set(mlist)
    matched_list = list(src_set.intersection(tag_set))

    for i in matched_list:
        s_index = nlist.index(i)
        t_index = mlist.index(i)

        if s[s_index] != t[t_index]:
            print("-1")
            exit()

    print(l)


if __name__ == "__main__":
        main()


### FIXED CODE ###

def main():
    n, m = map(int,input().split())
    s = input()
    t = input()

    l = n * m // gcd(n,m)

    nlist = [0 for i in range(n)]
    mlist = [0 for i in range(m)]
    for i in range(n):
        nlist[i] =  i*l//n

    for i in range(m):
        mlist[i] =  i*l//m

    src_set = set(nlist)
    tag_set = set(mlist)
    matched_list = list(src_set.intersection(tag_set))

    for i in matched_list:
        s_index = nlist.index(i)
        t_index = mlist.index(i)

        if s[s_index] != t[t_index]:
            print("-1")
            exit()

    print(l)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

if __name__ == "__main__":
        main()
S=input()
a=int(input())
List=list(S)
res = 1
for i in range(a):
  if List[i] != "1":
    res = List[i]
print(res)

### FIXED CODE ###

S=input()
a=int(input())
List=list(S)
res = 1
for i in range(a):
  if List[i] != "1":
    res = List[i]
    break
print(res)
print("bust") if sum(A) >= 22 else print("win")

### FIXED CODE ###

A = [int(i) for i  in input().split()]
print("bust") if sum(A) >= 22 else print("win")
n,m=map(int,input().split())
A=list(int(input()) for i in range(m))
dp=[0]*(n+1)
dp[0]=1
j=0
for i in range(1,n+1):
    if i==A[j]:
        dp[i]=0
        j +=1
    else:
        dp[i]=(dp[i-1]+dp[i-2])

print(dp[n]%1000000007)

### FIXED CODE ###

n,m=map(int,input().split())
A=list(int(input()) for i in range(m))+[-1]
dp=[0]*(n+1)
dp[0]=1
j=0
for i in range(1,n+1):
    if i==A[j]:
        dp[i]=0
        j +=1
    else:
        dp[i]=(dp[i-1]+dp[i-2])

print(dp[n]%1000000007)
from collections import deque

f = open("input.txt")
n = int(f.readline())
dll = deque()

for i in range(n):
    input_line = [str(s) for s in f.readline().split()]
    if input_line[0] == "insert":
        dll.appendleft(int(input_line[1]))
    elif input_line[0] == "delete":
        try:
            dll.remove(int(input_line[1]))
        except ValueError:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
print(*dll)

### FIXED CODE ###

from collections import deque
   
n = int(input())
dll = deque()
   
for i in range(n):
    input_line = input().split()
    if input_line[0] == "insert":
        dll.appendleft(input_line[1])
    elif input_line[0] == "delete":
        try:
            dll.remove(input_line[1])
        except:
            pass
    elif input_line[0] == "deleteFirst":
        dll.popleft()
    else:
        dll.pop()
           
print(*dll)
N, K = map(int, input().split())
X = list(map(int, input().split()))

minp = 0
while X[minp] < 0:
    minp += 1
lidx = 0
if minp > K:
    lidx = minp - K
ridx = lidx + K - 1
left = X[lidx]
right = X[ridx]
mind = right - left + min(abs(left), abs(right))

while ridx < N and left <= minp:
    left = X[lidx]
    right = X[ridx]
    mind = min(mind, right - left + min(abs(left), abs(right)))
    lidx += 1
    ridx += 1

print(mind)

### FIXED CODE ###

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

minp = 0
if X[N-1] <0:
    minp = N-1
else:
    while X[minp] < 0:
        minp += 1

lidx = 0
if minp > K:
    lidx = minp - K
ridx = lidx + K - 1
left = X[lidx]
right = X[ridx]
mind = right - left + min(abs(left), abs(right))

while ridx < N and left <= minp:
    left = X[lidx]
    right = X[ridx]
    mind = min(mind, right - left + min(abs(left), abs(right)))
    lidx += 1
    ridx += 1

print(mind)
n=input()
print("No" if n%sum(map(int,n)) else "Yes")

### FIXED CODE ###

n=input()
print("No" if int(n)%sum(map(int,n)) else "Yes")
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
n=len(a)
j=0
k=0
for i in range(n):
    while j<n and b[j]<=a[i]:
        j+=1
    while k<n and c[k]<=b[j]:
        k+=1



### FIXED CODE ###

n,y=map(int,input().split())
y//=1000
for i in range(y//10+1):
    #we are gonna use i 10 notes
    cur=y-10*i
    for j in range(cur//5+1):
        #we are gonna use j 5 notes
        k=cur-5*j
        if k>=0 and i+j+k==n and 10*i+5*j+k==y:
            print(i,j,k)
            import sys
            sys.exit()
print('-1 -1 -1')
N = int(input())
graph = {}
root = -1
for n in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1

    if root == -1:
        root = u
    if u not in graph:
        graph[u] = {}
    if v not in graph:
        graph[v] = {}
    graph[u][v] = w
    graph[v][u] = w    

answer = [-1] * N
def search(node, depth):
    answer[node] = depth
    for n in graph[node]:
        if answer[n] == -1:
            search(n,depth + graph[node][n])
if N == 1:
    print('0')
else:
    search(root, 0)
    for a in answer:
        print('0' if a % 2 else '1')

### FIXED CODE ###

N = int(input())
graph = {}
root = -1
for n in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1

    if root == -1:
        root = u
    if u not in graph:
        graph[u] = {}
    if v not in graph:
        graph[v] = {}
    graph[u][v] = w
    graph[v][u] = w    

answer = [-1] * N
queue = [[root, 0]]
counter = -1
while counter < N - 1:
    counter += 1
    node = queue[counter][0]
    depth = queue[counter][1]
    answer[node] = depth
    for n in graph[node]:
        if answer[n] == -1:
            queue.append([n, depth + graph[node][n]])

for a in answer:
   print('0' if a % 2 else '1')
def calcH(x, cx, y, cy, h):
    return abs(x-cx)+abs(y-cy)+h
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
Hmax = 10**9
lst = [[x, y] for x in range(101) for y in range(101)]
for i, j in lst:
    k = 0
    flag = True
    for x, y, h in xyh:
        H_ = calcH(x, i, y, j, h)
        if k > 0:
            if H_ != H and flag and h != 0:
                flag = False
                break
            elif H_ != H and h == 0:
                continue
            elif H_ != H:
                H = H_
                flag = True
            else:
                flag = True
                continue
        else:
            H = H_
        if h == 0 and k != n-1:
            flag = False
        k += 1
    if flag == False or H > Hmax:
        continue
    else:
        Cx = i
        Cy = j
        Ch = H
    break
print(Cx, Cy, Ch)

### FIXED CODE ###

def calcCh(cx, cy, x, y, h):
    return abs(x-cx)+abs(y-cy)+h
def calcH(cx, cy, ch, x, y, h):
    return max(ch - calcCh(cx, cy, x, y, 0), 0)
n = int(input())
xyh = [list(map(int, input().split())) for i in range(n)]
xyh = sorted(xyh, key = lambda x: x[2])[::-1]
lst = [[x, y] for x in range(101) for y in range(101)]
for Cx, Cy in lst:
    Ch = calcCh(Cx, Cy, *xyh[0])
    if all(xyh[i][2] == calcH(Cx, Cy, Ch, *xyh[i]) for i in range(n)):
        break
print(Cx, Cy, Ch)
N,L = map(int,input().split())

apples = [i+L-1 for i in range(1,N+1)]

ans = float("inf")

for apple in apples:
  ans = min(ans,abs(apples))
  
print(ans)

### FIXED CODE ###

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

apples = [i+L-1 for i in range(1,N+1)]

ans = float("inf")
res = float("inf")

for apple in apples:
  if ans > abs(apple):
    ans = min(ans,abs(apple))
    res = apple
  
print(sum(apples) - res)
import sys
sys.setrecursionlimit(10**6)


def DFS(num):
    if color[num]=="white":
        ans[num]=C.pop()
        color[num]="black"
        for i in T[num]:
            DFS(i)


n=int(input())
AB=[list(map(int,input().split())) for _ in range(n-1)]
C=sorted(list(map(int,input().split())))
color=["white" for _ in range(n)]

T=[[] for _ in range(n)]
for a,b in AB:
    T[a-1].append(b-1)
    T[b-1].append(a-1)

ans=[0 for _ in range(n)]
DFS(0)

point=0
color=["white" for _ in range(n)]
for i in range(1,n+1):
    if len(T[i])>0:
        color[i-1]="black"
        for j in T[i]:
            if color[j-1]=="white":
                point +=min(ans[i-1],ans[j-1])
                color[j-1]="black"

print(point)
print(*ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)


def DFS(num,pre):
    global point
    if color[num]=="white":
        ans[num]=C.pop()
        point +=min(ans[num],pre)
        color[num]="black"
        for i in T[num]:
            DFS(i,ans[num])


n=int(input())
AB=[list(map(int,input().split())) for _ in range(n-1)]
C=sorted(list(map(int,input().split())))
color=["white" for _ in range(n)]

T=[[] for _ in range(n)]
for a,b in AB:
    T[a-1].append(b-1)
    T[b-1].append(a-1)

ans=[0 for _ in range(n)]
point=0
DFS(0,0)

print(point)
print(*ans)
from math import pi
r=float(import())
print(pi*r*r, 2*pi*r)

### FIXED CODE ###

from math import pi
r=float(input())
print("{0:.5f} {1:.5f}".format(pi*r*r, 2*pi*r))
c,a,b = map(int,inpput().split())

print(c*a/2)

### FIXED CODE ###

c,a,b = map(int,input().split())

print(int((c*a)/2))
import math

n, k = map(int, input().split())
if n > k:
	if n+1 >= 2*k
		for i in range(k):
			j = i+1
			c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
			c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
			comb = c_blue * c_div
			print(comb % 1000000007)
			
	else :
		for i in range(n-k+1):
			j = i+1
			c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
			c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
			comb = c_blue * c_div
			print(comb % 1000000007)
		for _ in range(2*k -n -1):
			print(0)
else:
	print(1)
	for i in range(n-1):
		print(0)

### FIXED CODE ###

import math

n, k = map(int, input().split())
if n > k:
	if n+1 >= 2*k:
		for i in range(k):
			j = i+1
			c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
			c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
			comb = c_blue * c_div
			print(comb % 1000000007)
			
	else :
		for i in range(n-k+1):
			j = i+1
			c_blue = (math.factorial(n-k+1))//((math.factorial(j))*(math.factorial(n-k+1-j)))
			c_div = (math.factorial(k-1))//((math.factorial(j-1))*(math.factorial(k-1-j+1)))
			comb = c_blue * c_div
			print(comb % 1000000007)
		for _ in range(2*k -n -1):
			print(0)
else:
	print(1)
	for i in range(n-1):
		print(0)
N,Y = map(int,input().split())

for x in range(N+1):
  for y in range(N+1):
    z = N - x - y
    if z < 0:
      continue
    if 10000 * x + 5000 * y + 1000 * z == Y:
      print(x,y,z)
      exit()

print(-1,-1,-1)


### FIXED CODE ###

a = input().split('/')
print('2018/' + a[1] + '/' + a[2])
i = input()
a,b,c = map(int, i.split())

set = {}

set.add(a)
set.add(b)
set.add(c)

if len(s) == 2: 
  print("Yes")
else:
  print("No")

### FIXED CODE ###

i = input()
a,b,c = map(int, i.split())

s = set()

s.add(a)
s.add(b)
s.add(c)

if len(s) == 2: 
  print("Yes")
else:
  print("No")
N = int(input())
h = input().split()
count = 0
max = 0
for i in range(n):
    if max <= h[i]:
        max = h[i]
        count += 1
print(count)

### FIXED CODE ###

N = int(input())
h = list(map(int, input().split()))
count = 0
max = 0
for i in range(N):
    if max <= h[i]:
        max = h[i]
        count += 1
print(count)
k = int(input())

for (int i = 0; i++; i< k)
	print("ACL")

### FIXED CODE ###

k = int(input())

for i in range(k):
	print("ACL" , end = "")
n,k = map(int,input().split())
h = list(map(int,input().split()))
print(h)
import numpy as np
h = np.array(h)
dp = np.zeros(n,dtype=int)
for i in range(1,n):
  s=(0,i-k)
  dp[i]=np.min(dp[s:i]+np.abs(h[s:i]-h[i]))
  
print(dp[-1])

### FIXED CODE ###

n , k = map(int,input().split())
h = list(map(int,input().split()))
import numpy as np
h = np.array(h)
dp =np.zeros(n,dtype = int)
for i in range(1,n):
    s = max(0,i-k)
    dp[i] = np.min(dp[s:i] + np.abs(h[s:i] - h[i]))
print(dp[-1])