Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
snuke = [0] * N
for n in range(N-1):
    snack = int(input())
    d_snuke = map(int, input().split())
    for d in d_snuke:
        snuke[d-1] = snack
c = 0
for n in range(N-1):
    if snuke[n] == 0:
        c += 1
print(c)


### FIXED CODE ###

N, K = map(int, input().split())
snuke = [0] * N
for n in range(K):
    snack = int(input())
    d_snuke = map(int, input().split())
    for d in d_snuke:
        snuke[d-1] = snack
c = 0
for n in range(N):
    if snuke[n] == 0:
        c += 1
print(c)
n, q = map(int, input().split())
tree = {}
for i in range(n-1):
    a, b = map(int, input().split())
    tree[b] = a
ans = [0]*n
for i in range(q):
    a, b = map(int, input().split())
    ans[a-1] += b
for i in range(2, n+1):
    ans[i-1] += ans[tree[i]-1]
print(ans)

### FIXED CODE ###

from collections import deque

def main():
    n, q = map(int, input().split())
    tree = [[] for _ in range(n)]
    for i in range(n-1):
        a, b = map(int, input().split())
        tree[a-1].append(b-1)
        tree[b-1].append(a-1)
    
    ans = [0]*n
    for _ in range(q):
        p, x = map(int, input().split())
        ans[p-1] += x
    
    not_yet = deque([0])
    already = [False]*n
    already[0] = True
    
    while not_yet:
        key = not_yet.popleft()
        for value in tree[key]:
            if already[value]:
                continue
            already[value] = True
            not_yet.append(value)
            ans[value] += ans[key]
    
    print(*ans)

if __name__ == "__main__":
    main()
k = int(input())
x = 7 % k
for i in range(1, k+1):
    if x == 0:
        print(i)
        exit()
    x = (x*10+7)%k
print(-1)


### FIXED CODE ###

x,k,d = map(int, input().split())
x = abs(x)
kd = k*d

if kd<=x:
    print(x-kd)
else:
    count = x // d
    k_dash = k - count
    x -= count * d
    if k_dash % 2 == 0:
        print(x)
    else:
        print(d-x)
a = int(input())
b = int(input())

import math
if b < 10:
    c=a*10+b
elif b==100:
    c=a*1000+b
else:
    c=a*100+b

d= int(math.sqrt(c))
if d**2 == c:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from math import sqrt
a, b = input().split()
n = int(a+b)
if(int(sqrt(n))**2 == n):
    print("Yes")
else:
    print("No")
N, Q = map(int, input().split())

w = [[] for _ in range(N+1)]
for _ in range(N-1):
    A, B = map(int, input().split())
    w[A].append(B)

cnt = [0]*(N+1)
for _ in range(Q):
    P, X = map(int, input().split())
    cnt[P] += X

cnt_sum = [0]*(N+1)

def f(i, n):
    cnt_sum[i] = n+cnt[i]
    for t in w[i]:
        f(t, cnt_sum[i])
    return

f(1, 0)

print(" ".join([str(c) for c in cnt_sum[1:]]))

### FIXED CODE ###

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

w = [[] for _ in range(N+1)]
for _ in range(N-1):
    A, B = map(int, input().split())
    w[A].append(B)
    w[B].append(A)

cnt = [0]*(N+1)
for _ in range(Q):
    P, X = map(int, input().split())
    cnt[P] += X

flag = [False]*(N+1)

q = [1]
while q:
    n = q.pop()
    flag[n] = True
    for i in w[n]:
        if flag[i]:
            continue
        flag[i] = True
        cnt[i] += cnt[n]
        q.append(i)

print(" ".join([str(c) for c in cnt[1:]]))
NM = input().split(" ")
N = int(NM[0])
M = int(NM[1])

Xin= input().split(" ")


Xls = []
tousa = []
for i in range(0,M):
    Xls.append(int(Xin[i]))

Xls.sort()

if M != 1:
    for i in range(0,M-1):
        tousa.append(abs(Xls[i+1] - Xls[i]))




tousa.sort()

if N>M:
    w = M-1
else:
    w = N
for i in range(0,w):
    tousa.pop()

ret = 0

for i in tousa:
    ret = i + ret

print(ret)


### FIXED CODE ###

NM = input().split(" ")
N = int(NM[0])
M = int(NM[1])

Xin= input().split(" ")


Xls = []
tousa = []
for i in range(0,M):
    Xls.append(int(Xin[i]))

Xls.sort()

if M != 1:
    for i in range(0,M-1):
        tousa.append(abs(Xls[i+1] - Xls[i]))




tousa.sort()


if N<M:
    for i in range(0,N-1):
        tousa.pop()
else:
    print(0)
    exit()
ret = 0

for i in tousa:
    ret = i + ret

print(ret)
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N; cin >> N;
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  // ll a, b, c; cin >> a >> b >> c;
  // string s; cin >> s;
  // vector<ll> a(N); rep(i, N) cin >> a[i];
  
  // ll ans = 0;
  // bool ok = false;

  // cout << ans << endl;
  // cout << (ok?"Yes":"No") << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


### FIXED CODE ###

h,a=map(int, input().split())
print((h-1)//a+1)
s = input()
if s == 'A':
    print('C')
elif s== 'C':
    print('A')
elif s == G:
    print('T')
else:
    print('G')

### FIXED CODE ###

s = input()
if s == 'A':
    ans = 'T'
elif s== 'T':
    ans = 'A'
elif s == 'G':
    ans = 'C'
elif s == 'C':
    ans = 'G'
else:
    print("error")
    
print(ans)
def B():
  s = input()
  t = input()
  count=0
  for i in range(len(s)):
    if s[i]!=t[i]:
        count = count+1
print(count)
B()

### FIXED CODE ###

#172B
def B():
    s = input()
    t = input()
    count = 0
    for i in range(len(s)):
        if s[i] != t[i]:
            count += 1
    print(count)
B()
n = int(input)
p = map(int, input().split())
v = sorted(p)
cou=0
if p==v:
    cou =2
else:
    for i in range(len(p)):
        if not p[i] == v[i]:
            print i
            cou+=1

if cou == 2:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
 
q = sorted(p)
cou = 0
for i in range(n):
    if p[i] != q[i]:
        cou += 1
 
if cou <= 2:
    print("YES")
else:
    print("NO")
print("AB"+["D","C"][n<1000])

### FIXED CODE ###

print("AB"+["D","C"][int(input())<1000])
a=input()
b=input()
ret='YES'
for i in range(3):
  if a[i]!=b[2-i]
    ret='NO'
    break
print(ret)

### FIXED CODE ###

a=input()
b=input()
ret='YES'
for i in range(3):
  if a[i]!=b[2-i]:
    ret='NO'
    break
print(ret)
a , b , c , k = map(int, input().split())

if  a + b = k:
  print(a)
else:
  print(2*a - k + b)



### FIXED CODE ###

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

if  a > k:
  print(k)
elif a + b >= k:
  print(a)
else:
  print(2*a - k + b)
N, L= input().split()
s = []
for i in range(int(N)):
    s.append(input())
print(''.join(s.sort()))


### FIXED CODE ###

n ,l = map(int, input().split())
s=sorted([input() for i in range(n)])
print(*s, sep="")
#AGC-040
S = input()
A = [0] * (len(S) + 1)

def check_left(n, S):
    count = 0
    for i in reversed(range(0, n)):
        if S[i] == "<":
            count += 1
        else:
            break
    return count

def check_right(n, S):
    count = 0
    for i in range(n, len(S)):
        if S[i] == ">":
            count += 1
        else:
            break
    return count

A[0] = max(check_left(i, S), check_right(i, S))

for i in range(1, len(S)+1):
    if A[i-1] != 0:
        if S[i-1] == "<":
            A[i] = A[i-1] + 1
        else: #elif S[i-1] == ">"
            if S[i] == "<":
                A[i] = 0
            else:
                A[i] = max(check_left(i, S), check_right(i, S))
    else:
        A[i] = max(check_left(i, S), check_right(i, S))

print(sum(A))

### FIXED CODE ###

S = input()
N = len(S) + 1
 
A = [0] * N
 
if S[0] == '<':
    A[0] = 0

if S[-1] == '>':
    A[-1] = 0

for i in range(1, N-1):
    if S[i-1] == '>' and S[i] == '<':
        A[i] = 0

for i in range(N-1):
    if S[i] == '<':
        A[i+1] = A[i] + 1

for i in range(N-1)[::-1]:
    if S[i] == '>':
        A[i] = max(A[i], A[i+1] + 1)

print(sum(A))
import numpy as np

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

array = np.array(lst)
po_array = array[array>=0]
ne_array = abs(array[array<0])
ne_array.sort()

if len(po_array) >= len(ne_array):
    long_array = po_array
    short_array = ne_array
else:
    long_array = ne_array
    short_array = po_array

if len(short_array) > k:
    min_len = k
else:
    min_len = len(short_array)
        
if min_len == 0:
    print(long_array[k-1])
else:
    min_dist = 10**10
    for i in range(min_len):
        if i == k-1:
            dist = short_array[i]
        else:
            dist = short_array[i]*2 + long_array[k-i-2]
        if min_dist > dist:
            min_dist = dist
    if len(long_array) >= k:
        if min_dist > long_array[k-1]:
            min_dist = long_array[k-1]
    print(min_dist)

### FIXED CODE ###

import numpy as np

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

array = np.array(lst)
po_array = array[array>=0]
ne_array = abs(array[array<0])
ne_array.sort()

if len(po_array) >= len(ne_array):
    long_array = po_array
    short_array = ne_array
else:
    long_array = ne_array
    short_array = po_array

if len(short_array) > k:
    min_len = k
else:
    min_len = len(short_array)
        
if min_len == 0:
    print(long_array[k-1])
else:
    min_dist = 10**10
    for i in range(min_len):
        dist = 10**10
        if i == k-1:
            dist = short_array[i]
        elif k-i-1 <= len(long_array): 
            dist = min(short_array[i]*2 + long_array[k-i-2], short_array[i] + long_array[k-i-2]*2)
        if min_dist > dist:
            min_dist = dist
    if len(long_array) >= k:
        if min_dist > long_array[k-1]:
            min_dist = long_array[k-1]
    print(min_dist)
(a, b, c) [int(x) for x in input().split()]

count = 0
for d in range(a, b + 1):
    if c % d == 0:
        count += 1

print(count)

### FIXED CODE ###

(a, b, c) = [int(x) for x in input().split()]

count = 0
for d in range(a, b + 1):
    if c % d == 0:
        count += 1

print(count)
S = input()
h = S/60
m = S%60/60
s = S%60%60

print(str(h) + ":" + str(m) +":" + str(s))

### FIXED CODE ###

Input = int(input())
h = Input//3600
m = (Input % 3600)//60
s = (Input % 3600) % 60
print(str(h) + ':' + str(m) + ':' + str(s))
N = input()
sum=1

for i in range(1, N+1):
    sum=(sum*i)%1000000007

print(sum)


### FIXED CODE ###

N = int(input())
sum=1

for i in range(1, N+1):
    sum=(sum*i)%1000000007

print(sum)
# import atexit
# import io
import sys
#
 _INPUT_LINES = sys.stdin.read().splitlines()
 input = iter(_INPUT_LINES).__next__
 _OUTPUT_BUFFER = io.StringIO()
 sys.stdout = _OUTPUT_BUFFER
#

 @atexit.register
 def write():
     sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

import math
R = lambda : map(int,input().split())
import math
ans = sys.maxsize
n,k = R()
for i in range(n,k+1):
    for j in range(i+1,k+1):
        ans = min(ans,(i*j)%2019)
        if ans==0:
          print(ans)
          exit()

print(ans)

### FIXED CODE ###

import atexit
import io
import sys

_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER


@atexit.register
def write():
    sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

import math
R = lambda : map(int,input().split())
ans = sys.maxsize
n,k = R()
for i in range(n,k):
    for j in range(i+1,k+1):
        ans = min(ans,(i*j)%2019)
        if ans==0:
            print(ans)
            exit()

print(ans)
from collections import deque
import sys
input = sys.stdin.buffer.readline

N = int(input())
edges = [[] for _ in range(N)]

for _ in range(N - 1):
    fr, to = map(lambda a: int(a) - 1, input().split())
    edges[fr].append(to)
    edges[to].append(fr)

def calcDist(fr):
    minDist = [10**18] * N
    que = deque([(fr, 0)])

    while que:
        now, dist = que.pop()

        if minDist[now] < dist:
            continue
        minDist[now] = dist

        for to in edges[now]:
            if minDist[to] > dist + 1:
                minDist[to] = dist + 1
                que.append((to, dist + 1))

    return minDist

D0 = calcDist(0)
R = max(calcDist(D0.index(max(D0)))) + 1

canFirstWin = [False] * (R + 1)
canFirstWin[1] = True
canFirstWin[2] = False

for i in range(3, R + 1):
    canFirstWin[i] = not(canFirstWin[i - 1] and canFirstWin[i - 2])

print('First' if canFirstWin[R] else 'Second')


### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.buffer.readline

N = int(input())
edges = [[] for _ in range(N)]

for _ in range(N - 1):
    fr, to = map(lambda a: int(a) - 1, input().split())
    edges[fr].append(to)
    edges[to].append(fr)

def calcDist(fr):
    minDist = [10**18] * N
    que = deque([(fr, 0)])

    while que:
        now, dist = que.pop()

        if minDist[now] < dist:
            continue
        minDist[now] = dist

        for to in edges[now]:
            if minDist[to] > dist + 1:
                minDist[to] = dist + 1
                que.append((to, dist + 1))

    return minDist

D0 = calcDist(0)
R = max(calcDist(D0.index(max(D0)))) + 1

print('Second' if R % 3 == 2 else 'First')
# 入力
x = int(input())
t = int(input())

# 処理
answer = x-t

# 出力
print(answer)

### FIXED CODE ###

# 入力
x, t = map(int, input().split())

# 処理
if x > t:
    answer = x - t
else:
    answer = 0

# 出力
print(answer)
import numpy as np

def solve(n,x,y):
  matrix = np.full((n,n), -1)
  x = x-1
  y = y-1
  for i in range(n):
    for j in range(i+1, n):
      if j >= x:
        matrix[i][j] = min(j-i, np.abs(j-y)+np.abs(x-i)+1)
      else:
        matrix[i][j] = j-i

  for i in range(1,n):
    print(np.count_nonzero(matrix==i))

if __name__ == "__main__":
  _n, _x, _y = map(int, input().split())
  solve(_n,_x,_y)


### FIXED CODE ###

def is_same(str):
  assert len(str) == 6
  if str[2] != str[3]:
    return False
  if str[4] != str[5]:
    return False
  return True

if __name__ == "__main__":
  s = list(input())

  if is_same(s):
    print('Yes')
  else:
    print('No')
#coding:utf-8
from copy import copy

MOD = 1000000007

def add(a, b):
    return (a + b) % mod

def sub(a, b):
    return (a + mod - b) % mod

def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def div(a, b):
    return mul(a, pow(b, mod-2, mod))

f = [1]
for i in range(10**5+5):
    f.append(f[-1]*(i+1)%MOD)
    
def nCr(n, r, mod=MOD):
    return f[n] * pow(f[r], mod-2, mod) * pow(f[n-r], mod-2, mod) % MOD

def nCr(n, r):
    return f[n] // (f[r] * f[n-r])
  
def main():
    n = int(input())
    li = list(map(int, input().split()))
    nums = [0] * n
    for num in li:
        nums[num - 1] += 1
        
    sumv = 0
    for num in nums:
        if num == 0:
            continue
        sumv += nCr(num, 2)
    
    for num in li:
        cnt = nums[num - 1]
        if cnt == 1:
            print(sumv)
            continue
        v = sumv + nCr(cnt-1, 2) - nCr(cnt, 2)
        print(v)
        
  
if __name__ == '__main__':
    main()

### FIXED CODE ###

#coding:utf-8


def nC2(n):
    return n * (n-1) // 2
  
def main():
    n = int(input())
    li = list(map(int, input().split()))
    nums = [0] * n
    for num in li:
        nums[num - 1] += 1
        
    sumv = 0
    for num in nums:
        if num == 0:
            continue
        sumv += nC2(num)
    
    for num in li:
        cnt = nums[num - 1]
        v = sumv + nC2(cnt-1) - nC2(cnt)
        print(v)
        
  
if __name__ == '__main__':
    main()
s = input().strip()
t = input().strip()
print ("Yes" if any(s[i:] + s[:i]  == t for i in range(len(s)) else "No")

### FIXED CODE ###

s = input().strip()
t = input().strip()
print ("Yes" if any(s[i:] + s[:i]  == t for i in range(len(s))) else "No")
x, y, a, b, c = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())))

A = sorted(P[:x] + Q[:y])
ans = sum(A)

for i in range(c):
    if A[i] < R[-1]:
        ans = ans + R[-1] - A[i]
        R.pop(-1)

print(ans)


### FIXED CODE ###

x, y, a, b, c = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())))

A = sorted(P[:x] + Q[:y])
ans = sum(A)

for i in range(min(c, len(A))):
    if A[i] < R[-1]:
        ans = ans + R[-1] - A[i]
        R.pop(-1)

print(ans)
import sys
sys.setrecursionlimit(10000000)

def findSumOfDigits(n):
    sum = 0
    while n > 0.1:
        sum = sum + (n % 10)
        #print(n % 10)
        n = n - (n % 10)
        n = n / 10
    return sum

# 整数の入力
n = input()
n = int(n)

a = input()
a = int(a)

b = input()
b = int(b)

ans = 0

for i in range(1,n+1):
    #print(i)
    test = findSumOfDigits(i)
    if a <= test <= b:
        ans = ans + i

print(int(ans))


### FIXED CODE ###


# スペース区切りの整数の入力
a, b, c, d = map(int, input().split())

if a+b > c+d:
    print('Left')
elif a+b < c+d:
    print('Right')
else:
    print('Balanced')
N, K = map(int,input().split())
S = input()

pos = 0
i_s = [pos]
continue_s = S[0]
while True:
    pos += 1
    if pos == N :
        break
    s = S[pos]
    if continue_s == s:
        continue
    else:
        continue_s = s
        i_s.append(pos)


i_length = len(i_s) - 1
X = []
rev = K * 2
for n,i in enumerate(i_s):
    if S[i] == "1":
        if i_length - n >= rev-1:
            if i_length - n == rev-1:
                X.append(N-i)
            elif i_length - n == rev:
                X.append(N-i)
            else:
                X.append(i_s[n+rev+1]-i)

print(max(X))




### FIXED CODE ###

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

i = 0
for j in range(N):
    if S[j] == "0" and (j==0 or S[j-1] == "1"):
        K -= 1
    if (K<0):
        if(S[i]=="0" and S[i+1] == "1"):
            K += 1
        i+=1

print(N-i)
from collections import deque
N, M = map(int, input().split())
X = list(map(int, input().split()))
sortX = sorted(X)
dist = []
if M == 1:
    print(0)
else:
    for i in range(M-1):
        dist.append(sortX[i + 1] - sortX[i])
    for i in range(N - 1):
        dist.pop(dist.index(max(dist)))
    print(sum(dist))

### FIXED CODE ###

from collections import deque
N, M = map(int, input().split())
X = list(map(int, input().split()))
sortX = sorted(X)
dist = []
if N-M>=0:
    print(0)
else:
    for i in range(M-1):
        dist.append(sortX[i + 1] - sortX[i])
    dist.sort()
    print(sum(dist[:M-N]))
n = int(input())

keta = 0
tmp = 26
beki = [26]

while True:
    if n <= beki[-1]:
        break
    tmp *= 26
    beki.append(beki[-1] + tmp)
    keta += 1
n_tmp = n
ans_num = []

n_tmp -= beki[keta - 1] + 1
for i in range(keta):
    waru = 26**(keta - i)
    x = (n_tmp) // waru
    ans_num.append(x)
    n_tmp -= x * waru

ans_num.append(n_tmp)
ans = ''

for d in ans_num:
    ans += chr(d + 97)

if n <= 26:
    print(chr(n + 96))
else:
    print(ans)

### FIXED CODE ###

x = input()
if x.upper() == x:
    print("A")
else:
    print("a")
t=list(input())

if t[0]=="A" and not t[1]=="C" and not t[-1]=="C":
    rs=1
else:
    rs=0

if t[1].isupper==True or t[-1].isupper==True:
    rs -=1

del t[:2]
del t[-1]

if not t.count("C")==1:
    rs -=1

if rs==1:
    t.remove("C")

for i in t:
    if i.isupper()==True:
        rs -=1

if rs==1:
    print("AC")
else:
    print("WA")


### FIXED CODE ###

t=int(input())

if t<1200:
    print("ABC")
elif t<2800:
    print("ARC")
else:
    print("AGC")
K = int(input())

def calculate(k):

    res = 1

    n = 7

    if k % 2 == 0:
        print(-1)
        return

    if k % 5 == 0:
        print(-1)
        return

    while n % k > 0:
        n = n % k
        n = n * 10 + 7
        res += 1

    print(res)

calculate(K)


K = int(input())

### FIXED CODE ###

K = int(input())

def calculate(k):

    if k % 2 == 0:
        print(-1)
        return

    if k % 5 == 0:
        print(-1)
        return

    res = 1

    m = (((10 ** res) - 1) // 9) * 7


    while m % k > 0:
        res += 1
        m = m % k
        m = m * 10 + 7

    print(res)


calculate(K)
n, k = map(int, input().split())
s = str(input())

x = s[k-1]
y = x.capitalize()
s[k-1] = y

print(s)

### FIXED CODE ###

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

if s[k-1] == 'A':
    print(s[:k-1] + 'a' + s[k:])

elif s[k-1] == 'B':
    print(s[:k-1] + 'b' + s[k:])

else:
    print(s[:k-1] + 'c' + s[k:])
n,h,l=int(input()),int(input()),list(map(int,input().split()))
c=[0]*n
c[1]=abs(l[0]-l[1])
for i in range(2,n):
  c[i]=min( c[i-j]+abs(l[i]-l[i-j]) for j in range(1,h+1) if i-j > -1 )
print(c[-1])

### FIXED CODE ###

n,h=map(int,input().split())
l=list(map(int,input().split()))
c=[10**9]*n
c[0]=0
c[1]=abs(l[0]-l[1])
for i in range(2,n):
    c[i]=min( c[j]+abs(l[i]-l[j]) for j in range(max(0,i-h),i) )
print(c[-1])
n=int(input())
nums=[]
for i in range(1,n):
  if factorize(n).len()==8
  nums.append(i)
print(nums.len())


def factorize(n):
  i=2
  facors=[1]
  while True:
    if n%i==0:
      factors.append(i)
    else:
      i+=1
    if i==n:
      break

### FIXED CODE ###

def factorize(n):
  factors=[1]
  i=2
  while n>1:
    if n%i==0:
      factors.append(i)
    if i==n:
      break
    else:
      i+=1
  return factors
      
n=int(input())
nums=[]
for i in range(1,n+1):
  if i%2==1:
    if len(factorize(i))==8:
      nums.append(i)
print(len(nums))
S = input()
chars = "abcdefghijklmnopqrstuvwxyz"
if len(S) < 26:
    for c in chars:
        if c not in S:
            Ans = S+c
            break
else:
    if S == chars[::-1]:
        Ans = -1
    else:
        for i in range(26):
            if S[i] != chars[i]:
                Ans = S[0:i] + chars[i]
                break
print(Ans)

### FIXED CODE ###

S = input()
chars = "abcdefghijklmnopqrstuvwxyz"
if len(S) < 26:
    for c in chars:
        if c not in S:
            Ans = S+c
            break
else:
    if S == chars[::-1]:
        Ans = -1
    else:
        for i in range(25):
            if S[25-i] > S[25-i-1]:
                break
        for j in range(25): # index out of rangeにならない？大丈夫？
            if chr(ord(S[25-i-1])+1+j) not in S[0:25-i-1]:
                break
        Ans = S[0:25-i-1]+chr(ord(S[25-i-1])+1+j)
print(Ans)
import sys
N,M = map(int,input().split())
s = [0] * M
c = [0] * M
a = ["1"] + ["0"] * (N-1)
for i in range(M):
    s[i],c[i] = map(int,input().split())
for j in range(N):
    if s[j] == 1 and c[j] == 0:
        print(-1)
        sys.exit()
    elif a[s[j]-1] == "0" or (s[j] == 1 and a[0] == "1"):
        a[s[j]-1] = str(c[j])
    elif a[s[j]-1] == str(c[j]):
        pass
    else:
        print(-1)
        sys.exit()
ans = "".join(a)
print(int(ans))

### FIXED CODE ###

import sys
N,M = map(int,input().split())
s = [0] * M
c = [0] * M
a = ["-1"] * (N)
if N == 1 and M == 0:
    print(0)
    sys.exit()
for i in range(M):
    s[i],c[i] = map(int,input().split())

for j in range(M):
    if s[j] == 1 and c[j] == 0 and N != 1:
        print(-1)
        sys.exit()
    elif a[s[j]-1] == "-1":
        a[s[j]-1] = str(c[j])
    elif a[s[j]-1] == str(c[j]):
        pass
    else:
        print(-1)
        sys.exit()
if a[0] == "-1":
    a[0] = "1"
for h in range(1,N):
    if a[h] == "-1":
        a[h] = "0"
ans = "".join(a)
print(int(ans))
a, b = map(str, input().split())
if a==b:
    print("H")
else:
    pritn("D")

### FIXED CODE ###

a, b = map(str, input().split())
if a==b:
    print("H")
else:
    print("D")