Harryxun/stf_run huggingface dataset:
S = input()
out = ""

for i in range(S.len()):
  out += "x"

print(out)

### FIXED CODE ###

S = input()

tmp = ""

for i in range(len(S)):
  tmp += "x"

print(tmp)
if __name__=="__main__":
    n, m = map(int, input().split())
    p, s=[], []
    for i in range(m):
        pin, sin = map(str, input().split())
        p.append(int(pin))
        s.append(sin)

    cnt_wa = 0
    cnt_ac = 0
    pfin = 0
    for i in range(m):
        if pfin < p[i]:
            if s[i]=="WA":  
                cnt_wa += 1
            else:
                cnt_ac += 1
                pfin = p[i]
                if pfin==n:
                    break
        
    print("{} {}".format(cnt_ac, cnt_wa))

### FIXED CODE ###

abts = "abcdefghijklmnopqrstuvwxyz"
cin = str(input())
for i in range(len(abts)):
  if cin == abts[i]:
    print(abts[i+1])
dig, cnt = map(int, input().split())
ans = [-1]*dig

for i in range(cnt):
  place, num = map(int, input().split())
  place -= 1
  if ans[place] != -1:
    if ans[place] != num:
      print(-1)
      exit()
  elif num == 0 and place == 0:
      print(-1)
      exit()
  else:
    ans[place] = num
for i in range(cnt):
  if ans[i] == -1:
    if i == 0:
      ans[i] = 1
    elif ans[i] == -1:
      ans[i] = 0
  print(ans[i], end="")

### FIXED CODE ###

dig, cnt = map(int, input().split())
ans = [-1]*dig
 
for i in range(cnt):
  place, num = map(int, input().split())
  place -= 1
  if ans[place] != -1:
    if ans[place] != num:
      
      print(-1)
      exit()
  elif place == 0 and num == 0 and dig > 1:
    print(-1)
    exit()
  else:
    ans[place] = num
    
for i in range(dig):
  if ans[i] == -1:
    if dig > 1 and i == 0:
      ans[i] = 1
    else:
      ans[i] = 0
  print(ans[i], end="")
from fractions import gcd

d = math.gcd(*map(int, input().split()))
r = 1
for i in range(2, int(d ** 0.5) + 1):
    if d % i == 0:
        d //= i
        r += 1
    while d % i == 0:
        d //= i
print(r + (d > 1))


### FIXED CODE ###

R = lambda: map(int, input().split())
n, = R()
a = list(R())
print(*sorted(range(1, n + 1), key=lambda x: a[x - 1]))
n=int(input())
l= list(map(int, input().split()))
r= list(map(int, input().split()))
l=[0]+l
r.append(0)

res=1
max=1
if(max(l)!=max(r)):
	res=0
for i in range(n):
	if( (l[i]<l[i+1]) or (r[i]>r[i+1]) ):
		if( ( (l[i]<l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]!=r[i]) ):
			res*=0
	else:
		res*=min(l[i],r[i])
		res%=1000000007
print(res)

### FIXED CODE ###

n=int(input())
l= list(map(int, input().split()))
r= list(map(int, input().split()))
l=[0]+l
r.append(0)
 
res=1
if(l[-1]!=r[0]):
	res=0
for i in range(n):
	if( (l[i]<l[i+1]) or (r[i]>r[i+1]) ):
		if( ( (l[i]<l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]!=r[i]) ):
			res=0
		if( ( (l[i]<l[i+1]) and (r[i]==r[i+1]) ) and (l[i+1]>r[i]) ):
			res=0
		if( ( (l[i]==l[i+1]) and (r[i]>r[i+1]) ) and (l[i+1]<r[i]) ):
			res=0
	else:
		res*=min(l[i],r[i])
		res%=1000000007
print(res)
a, b, c = map(int, input().split())
print(10a+b if 10a+b>=10b+c else 10b+c)

### FIXED CODE ###

a, b, c = sorted(map(int, input().split()), reverse=True)
print(10*a+b+c)
n=int(input())
if n==1:print("Hello World)
else:
    a=int(input())
    b=int(input())
    print(a+b)

### FIXED CODE ###

n=int(input())
if n==1:print("Hello World")
else:
    a=int(input())
    b=int(input())
    print(a+b)
N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
s_cost = a
cost = sum(s_cost)
for k in xrange(0,N):
    s_cost = [min(s_cost[x],a[y]) for (x,y) in zip( list(xrange(N)), list(xrange(N-k,N))+list(xrange(N-k)) )]
    cost = min(cost, k*x + sum(s_cost))

print(cost)


### FIXED CODE ###

N, x = list(map(int, input().split()))
a = list(map(int, input().split()))
s_cost = a.copy()
cost = sum(s_cost)
for k in range(1,N):
    for i in range(N):
        if s_cost[i] > a[(i-k)%N] :
            s_cost[i] = a[(i-k)%N]
    if cost > k*x + sum(s_cost):
        cost = k*x + sum(s_cost)
    else:
        break

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

def okikae(t, k):
    if k==0:
        print(t)
    elif t%k==0:
        print("0")
    elif int(k/2) >= t:
        print(t)
    else:
        okikae(abs(t-k), k)

okikae(N, K)

### FIXED CODE ###

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

def okikae(t, k):
    if k==0:
        print(t)
    elif int(k/2)+1 > t:
        print(t)
    elif t%k==0:
        print(0)
    elif t>k and t%k > 0:
        t = k+(t%k)
        okikae(abs(t-k), k)
    else:
        okikae(abs(t-k), k)

okikae(N, K)
N=int(input())
R=int(input())
 
if 0<N<10:
  T=100*(10-N)
  print((R+T))

elif N<0:
  print("error")
  
else:
  print(R)

### FIXED CODE ###

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

if 0<N<10:
  T=100*(10-N)
  print((R+T))
 
elif N<0:
  print("error")
  
else:
  print(R)
N = int(input())
S = []
nagasa = 51
for i in range(N):
    dam = input()
    S.append(dam)
    if len(list(dam)) < nagasa:
        nagasa = len(list(dam))
        saisyo=i
# print(S,saisyo)

flg=[0]*len(S[saisyo])
for i in range(len(S[saisyo])):
    for j in range(1,N):
        for k in range(len(S[j])):
            if S[saisyo][i] == S[j][k]:
                flg[i] +=1
                dammy = list(S[j])
                del dammy[k]
                S[j] = ''.join(dammy)
                break

out=[]
for i in range(len(S[saisyo])):
    if flg[i]==N-1:
        out.append(S[saisyo][i])
out=sorted(out)

print(''.join(out))


### FIXED CODE ###


N = int(input())
S = []
nagasa = 51
for i in range(N):
    dam = input()
    S.append(dam)
    if len(list(dam)) < nagasa:
        nagasa = len(list(dam))
        saisyo=i
# print(S,saisyo)

flg=[0]*len(S[saisyo])
for i in range(len(S[saisyo])):
    for j in range(N):
        if j==saisyo:
            continue
        else:
            for k in range(len(S[j])):
                if S[saisyo][i] == S[j][k]:
                    flg[i] +=1
                    l = list(S[j])
                    l[k] = 'A'
                    S[j] = ''.join(l)
                    # print(i,j,k,S)
                    break

out=[]
for i in range(len(S[saisyo])):
    if flg[i]==N-1:
        out.append(S[saisyo][i])
out=sorted(out)
# print(flg,oust)
print(''.join(out))
inf = pow(10, 9)+7

def nCr(n, r):
    r = min(r, n - r)
    if r == 0: return 1;
    if r == 1: return n;
    numerator = [n - r + i + 1 for i in range(r)]
    denominator  = [i + 1 for i in range(r)]
    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot
    result = 1
    for k in range(r):
        if numerator[k] > 1: 
            result *= numerator[k]
    return int(result)


n, k = map(int, input().split())
a = [int(x) for x in input().split()]
a.sort()

ans = 0
key = nCr(n-1, k-1)
for i in range(n-k+1):
    ans += ((a[-i-1] - a[i])%inf)*(key%inf)
    ans %= inf
    if n-i-1 != 0:
	    key = int(key*(n-k-i)/(n-1-i))
    else:
        break
print(ans)

### FIXED CODE ###

inf = pow(10, 9)+7

n, k = map(int, input().split())
a = [int(x) for x in input().split()]
a.sort()

ans = 0
comb = 1
for i in range(k, n+1):
    ans += (a[i-1]-a[-i])*comb
    ans %= inf
    comb = (comb * i * pow(i-k+1, inf-2, inf))%inf
print(ans)
import numpy as np
import sys

n,x,m = (int(i) for i in input().split())
l = np.array([x])
ans = x
memo_array = [False]*(m+1)
for i in range(1,n):
    ans = ans**2%m
    if memo_array[ans]:
        loop_start = int(np.where(l==ans)[0])
        loop_num, mod = divmod((n-loop_start),(i-loop_start))
        print(np.sum(l[:loop_start]) + np.sum(l[loop_start:])*(loop_num)+np.sum(l[loop_start:loop_start+mod]))
        sys.exit()
    l = np.append(l,ans)
    memo_array[ans]=True
print(np.sum(l))

### FIXED CODE ###

import sys

n,x,m = (int(i) for i in input().split())
l = [x]
ans = x
memo_array = [-1]*(m+1)

for i in range(1,n):
    ans = ans**2%m
    idx = memo_array[ans]
    if idx != -1:
        loop_num, mod = divmod((n-idx),(i-idx))
        print(sum(l[:idx]) + sum(l[idx:])*(loop_num)+sum(l[idx:idx+mod]))
        sys.exit()
    l.append(ans)
    memo_array[ans]=i
print(sum(l))
A,B,N = map(int, input().split(' '))
c = min(N,B)
if p % B == 0:
    print(int(A(c-1)/B))
else :
    print(int(A(c)/B))

### FIXED CODE ###

A,B,N = map(int, input().split())
c = min(N,B)
if c % B == 0:
    print(int(A*(c-1)/B))
else :
    print(int(A*(c)/B))
import sys
sys.setrecursionlimit(10**9)

def search_max_gcd(M, possible):
    if possible == 1:
        return 1
    elif (M % possible) == 0:
        return possible
    else:
        return search_max_gcd(M, possible-1)

def main():
    N, M = map(int, input().split())
    first_possible = M//N
    print(search_max_gcd(M, first_possible))

main()


### FIXED CODE ###

from math import *

def main():
    N, M = map(int, input().split())
    if N==1:
        print(M)
        return
    special_value = M//N
    divisor_set = set(i for i in range(1, (int(sqrt(M)) + 1)) if (M % i == 0))
    divisor_set = divisor_set.union(M/j for j in divisor_set)
    print(int(max([i for i in divisor_set if special_value >= i])))
    return

main()
N = int(input())
max_num = 1
cnt = 0
list_num = [int(x) for x input().split()]
for i in range(len(list_num)):
	if max_num <= a:
		cnt += 1
		max_num = list_num[i]
print(cnt)

### FIXED CODE ###

N = int(input())
max_num = 1
cnt = 0
list_num = [int(x) for x in input().split()]
for i in range(len(list_num)):
	if max_num <= list_num[i]:
		cnt += 1
		max_num = list_num[i]
print(cnt)
from math import sqrt

x = int(input()) - 1
if x >= 2:
    pnums = []
    for i in range(2, int(sqrt(x))+1):
        for j in pnums:
            if i % j == 0:
                break
        else:    
            pnums.append(i)

while True:
    x += 1
    x_sqrt = sqrt(x)
    if x_sqrt.is_integer():
        pnums.append(x_sqrt)
        break
    
    for a in pnums:
        if x % a == 0:
            break
    else:
        print(x)
        break
    

### FIXED CODE ###

from math import sqrt

x = int(input()) - 1
pnums = []
if x >= 4:
    for i in range(2, int(sqrt(x))+1):
        for j in pnums:
            if i % j == 0:
                break
        else:    
            pnums.append(i)

while True:
    x += 1
    x_sqrt = sqrt(x)
    if x_sqrt.is_integer():
        pnums.append(x_sqrt)
        continue
    
    for a in pnums:
        if x % a == 0:
            break
    else:
        print(x)
        break
c = str(input())
if c in [a,i,u,e,o]:
    print("vowel")
else:
    print("consonant")


### FIXED CODE ###

c = str(input())
if c in ["a","i","u","e","o"]:
    print("vowel")
else:
    print("consonant")
N = int(input())

# 長さが10で英小文字の文字列リスト
str_list = [input() for i in range(N)]

import itertools as iter
comb_list = list(iter.combinations(str_list, 2))

def from_cache(cache_dict, word):
    if word in cache_dict.keys():
        return cache_dict

    cnt_dict = {}
    for s in list(word):
        if s not in cnt_dict.keys():
            cnt_dict[s] = 0
        cnt_dict[s] += 1
    cache_dict[word] = sorted(cnt_dict.items(), key=lambda x:x[0])
    return cache_dict


cache_dict = {}
cnt = 0
for comb_str in comb_list:
    w1, w2 = comb_str[0], comb_str[1]

    cache_dict = from_cache(cache_dict, w1)
    cache_dict = from_cache(cache_dict, w2)

    if cache_dict[w1].keys() != cache_dict[w2].keys():
        continue

    if list(cache_dict[w1].values()) != list(cache_dict[w2].values()):
        continue

    cnt += 1


print(cnt)

### FIXED CODE ###


N = int(input())

cnt_dict = {}

for i in range(N):
    s_list = list(input())
    s_list.sort()
    s_str = "".join(s_list)
    if s_str not in cnt_dict.keys():
        cnt_dict[s_str] = 1
        continue
    cnt_dict[s_str] += 1

import itertools
comb = itertools.combinations

total = 0
for key in cnt_dict.keys():
    cnt = cnt_dict[key]
    if cnt < 2:
        continue
    total += cnt * (cnt - 1) // 2

print(total)
in1 = list(map(int, input().split()))
N = in1[0]
X = in2[1]

L = list(map(int, input().split()))
D = [0] * 10000

for i in range(1, N):
  D[i] = D[i-1] + L[i-1]
  if X < D[i]:
    print(D[i-1])

### FIXED CODE ###

in1 = list(map(int, input().split()))
N = in1[0]
X = in1[1]
 
L = list(map(int, input().split()))
L.append(0)
L.append(0)
D = 0
overflow = False
for i in range(1, N+2):
  if X < D:
    print(i-1)
    overflow = True
    break
  if X == D:
    print(i)
    overflow = True
    break
  D = D + L[i-1]

if not overflow:
  print(N+1)
string = input()
k = int(input())
if len(string) >= k:
    substrs = set()
    ls = sorted(list(string))
    for i in range(5):
        for s, c in enumerate(string):
            if c == ls[i]:
                for l in range(1, 5+1):
                    substrs.add(string[s:s+l])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])

else:
    substrs = set()
    for leng in range(1, len(string)):
        for s in range(0, len(string) - leng):
            substrs.add(string[s:s+leng])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])


### FIXED CODE ###

string = input()
k = int(input())
if len(string) > k:
    substrs = set()
    ls = sorted(list(string))
    for i in range(k):
        for s, c in enumerate(string):
            if c == ls[i]:
                for l in range(1, k+1):
                    substrs.add(string[s:s+l])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])

else:
    substrs = set()
    for leng in range(1, len(string) + 1):
        for s in range(0, len(string) - leng + 1):
            substrs.add(string[s:s+leng])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])
# 両方から到達出来ないものに関する辺を無視してベルマンフォード
n, m, p = map(int, input().split())
edges = []
to = [[] for _ in range(n)]
ot = [[] for _ in range(n)]
reachable_from_1 = [False] * n
reachable_to_n = [False] * n
ok = [False] * n
INF = float('inf')


def dfs(v):
    if reachable_from_1[v]:
        return
    reachable_from_1[v] = True
    for nv in to[v]:
        dfs(nv)


def rdfs(v):
    if reachable_to_n[v]:
        return
    reachable_to_n[v] = True
    for nv in ot[v]:
        rdfs(nv)


for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    c -= p
    c = -c
    edges.append((a, b, c))
    to[a].append(b)
    ot[b].append(a)
dfs(0)
rdfs(n - 1)
for i in range(n):
    ok[i] = reachable_from_1[i] and reachable_to_n[i]
d = [INF] * n
d[0] = 0
upd = True
step = 0
while upd:
    upd = False
    for e in edges:
        frm, to, cost = e
        if not ok[frm]:
            continue
        if not ok[to]:
            continue
        nd = d[frm] + cost
        if nd < d[to]:
            d[to] = nd
            upd = True
    step += 1
    if step > n:
        print(-1)
        exit()
ans = -d[n - 1]
ans = max(0, ans)
print(ans)


### FIXED CODE ###

# 両方から到達出来ないものに関する辺を無視してベルマンフォード
import sys
sys.setrecursionlimit(10**6)
n, m, p = map(int, input().split())
edges = []
to = [[] for _ in range(n)]
ot = [[] for _ in range(n)]
reachable_from_1 = [False] * n
reachable_to_n = [False] * n
ok = [False] * n
INF = float('inf')


def dfs(v):
    if reachable_from_1[v]:
        return
    reachable_from_1[v] = True
    for nv in to[v]:
        dfs(nv)


def rdfs(v):
    if reachable_to_n[v]:
        return
    reachable_to_n[v] = True
    for nv in ot[v]:
        rdfs(nv)


for _ in range(m):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    c -= p
    c = -c
    edges.append((a, b, c))
    to[a].append(b)
    ot[b].append(a)
dfs(0)
rdfs(n - 1)
for i in range(n):
    ok[i] = reachable_from_1[i] and reachable_to_n[i]
d = [INF] * n
d[0] = 0
upd = True
step = 0
while upd:
    upd = False
    for e in edges:
        frm, to, cost = e
        if not ok[frm]:
            continue
        if not ok[to]:
            continue
        nd = d[frm] + cost
        if nd < d[to]:
            d[to] = nd
            upd = True
    step += 1
    if step > n:
        print(-1)
        exit()
ans = -d[n - 1]
ans = max(0, ans)
print(ans)
N = int(input())
A = [0]*N

for i in range(N):
    A[i] = int(input())

mx = max(A)
mxi = A.index(max(A))

for i in range(N):
    if i == 0:
        print(max(A[1:N]))
    elif i != mxi:
        print(mx)
    elif i == N-1:
        print(max(A[mxi+1:N]))
    else:
        print(max(max(A[0:i]),max(A[i+1:N])))


### FIXED CODE ###

N = int(input())
A = [0]*N

for i in range(N):
    A[i] = int(input())

mx = max(A)
mxi = A.index(max(A))

for i in range(N):
    if i != mxi:
        print(mx)
    elif i == 0:
        print(max(A[1:N]))
    elif i == N-1:
        print(max(A[0:N-1]))
    else:
        print(max(max(A[0:i]),max(A[i+1:N])))
import sympy
sympy.divisors(10**9)

num = int(input())

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

l = make_divisors(n)
cnt = 0

for z in l[2:]:
    if num == 1:
        print(cnt)
    elif num % z == 0:
        num /= z
        cnt += 1

### FIXED CODE ###

n = int(input())

def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

f = factorize(n)
ans = 0
for i,j in f:
    ans += int((-1+pow(1+8*j,0.5))/2)
print(ans)
n,k = map(int,input().split())
A = list(map(int,input().split()))
B = []
B.append(A[0])
b = 0
c = 1
while True:
  b = A[c-1]
  c = A[b-1]
  B.append(c)
  if A[-1] == A[-2]:
    break
  if len(B) == len(A):
    break
print(B[k])


### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
pos = 0
visit = [0] * N
move = []
roop = []
while visit[pos]!=2:
    if visit[pos]==0:
        move.append(pos)
    else:
        roop.append(pos)
    visit[pos] += 1
    pos = A[pos] - 1
if len(move)>K:
    print(move[K]+1)
else:
    print(roop[(K-(len(move)-len(roop)))%len(roop)]+1)
health = int(input())
decrease = int(input())
attack = 0
while health > 0:
    health = health - decrease
    attack += 1
print(attack)

### FIXED CODE ###

h, a = map(int, input().split())
print((h+a-1) // a)
N = int(input())
for i in range(N):
    x, u = list(map(str, input().split()))
    if u == "JPY":
        sum+=int(x)
    else:
        sum+=float(x)*380000
print(sum)

### FIXED CODE ###

N = int(input())
sum=0
for i in range(N):
    x, u = list(map(str, input().split()))
    if u == "JPY":
        sum+=int(x)
    else:
        sum+=float(x)*380000
print(sum)
from collections import deque
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=deque(sorted(list(map(int,input().split())),reverse=True))
p=deque(p[:x])
q=deque(q[:y])
ans=sum(p)+sum(q)

while p[-1]<r[0] or q[-1]<r[0]:
  if p[-1]<q[-1]:
    ans+=r[0]-p[-1]
    r.popleft()
    p.pop()
  else:
    ans+=r[0]-q[-1]
    r.popleft()
    q.pop()
  if p==[] or q==[] or r==[]:
    break
print(ans)

### FIXED CODE ###

from collections import deque
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=deque(sorted(list(map(int,input().split())),reverse=True))
p=deque(p[:x])
q=deque(q[:y])
ans=sum(p)+sum(q)

while p[-1]<r[0] or q[-1]<r[0]:
  if p[-1]<q[-1]:
    ans+=r[0]-p[-1]
    r.popleft()
    p.pop()
  else:
    ans+=r[0]-q[-1]
    r.popleft()
    q.pop()
  if p==deque([]) or q==deque([]) or r==deque([]):
    break
if r==deque([]):
  pass
elif p==deque([]):
  while q[-1]<r[0]:
    ans+=r[0]-q[-1]
    r.popleft()
    q.pop()
    if q==deque([]) or r==deque([]):
      break
elif q==deque([]):
  while p[-1]<r[0]:
    ans+=r[0]-p[-1]
    r.popleft()
    p.pop()
    if p==deque([]) or r==deque([]):
      break
  
print(ans)
List = [int(i) for i in input().split()]
Sort = list.sort()
print(' '.join([str(i) for i in Sort]))

### FIXED CODE ###

L = [int(i) for i in input().split()]
print(' '.join([str(i) for i in sorted(L)]))
N=int(input())
count=0
a=list(map(int,input().split()))
w=[]
s=[]
maxi=max(a)
mini=min(a)
num=[0]*(maxi-mini+N+N)
maxi=max(a)
for i in range(N):
  w.append(1+i+a[i])
  s.append(1+i-a[i])
  num[1+i-a[i]+(maxi-mini+N+N)//2]+=1
for i in range(N):
  count+=num[w[i]+(maxi-mini+N+N)//2]
print(count)

### FIXED CODE ###

N=int(input())
count=0
a=list(map(int,input().split()))
w=[]
s=[]
num=[0]*N
maxi=max(a)
for i in range(N):
  s.append(1+i-a[i])
  if 1+i+a[i]<N:
    num[1+i+a[i]]+=1
for i in range(N):
  if s[i]>=0:
    count+=num[s[i]]
print(count)
import numpy as np
N, K = [int(i) for i in input().split()]
H = np.array([int(i) for i in input().split()])

dp = np.zeros(N)
for i in range(1, N):
    L = []
    for j in range(max(0, i-K), i):
        L.append(dp[j] + abs(H[i] - H[j]))
    dp[i] = min(L)

print(int(dp[-1])

### FIXED CODE ###

def func():
    N, K = [int(i) for i in input().split()]
    H = [int(i) for i in input().split()]
    
    dp = [0]*N
    for i in range(1, N):
        L = []
        for j in range(max(0, i-K), i):
            L.append(dp[j] + abs(H[i] - H[j]))
        dp[i] = min(L)

    print(dp[-1])
    
if __name__=="__main__":
    func()
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {		
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		String[] strArray = reader.readLine().split(" ");
		int[] a = new int[n];
		int[] c = new int[10000];
		int k = Integer.MIN_VALUE;
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(strArray[i]);
			k = Math.max(k, a[i]);
			c[a[i]]++;
		}
		int[] b = new int[n];
		countingSort(a, b, c, k);
		System.out.print(b[0]);
		for (int i = 1; i < n; i++) {
			System.out.print(" " + b[i]);
		}
		System.out.println("");
	}

	private static void countingSort(int[] a, int[] b, int[] c, int k) {
		for (int i = 1; i <= k; i++) {
			c[i] = c[i] + c[i - 1];
		}
		for (int i = a.length - 1; i >= 0; i--) {
			b[c[a[i]] - 1] = a[i];
			c[a[i]]--;
		}
	}
}



### FIXED CODE ###

n=int(input())
A=[0]*(n+1)
B=[0]*(n+1)
i=0
mx=(1<<30)*-1
for v in list(map(int,input().split())):
	A[i+1] = v
	mx=max(mx,A[i+1])
	i+=1	

C=[0]*(mx+1)
for i in range(n):
	C[A[i+1]]+=1
for i in range(1,mx+1):
	C[i] += C[i-1]
for i in range(n,0,-1):
	B[C[A[i]]] = A[i]
	C[A[i]]-=1

st=str(B[1])
for i in range(2,n+1):
	st += ' ' + str(B[i])
print(st)
s = input()
z = int(input())
list = [chr(i) for i in range(97,97+26)]
d = []
for j in list:
  indexes = [i for i,x in enumerate(s) if x==j]
  if len(indexes)==0:
    continue
  for k in indexes:
    for l in range(len(s)-k):
      d.append(s[k:l+k+1])
      if len(s[k:l+k+1])==z:
        break
print(sorted(set(d))[z-1])

### FIXED CODE ###

a,b,c,d = map(int, input().split())
if abs(a-c)<=d:
  print('Yes')
  exit()
if abs(b-a)<=d and abs(c-b)<=d:
  print('Yes')
  exit()
print('No')
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
answer = 0
 
for i in range(N):
  index = A[i]
  answer = answer + B[index-1]

  if i != 0:
    if A[i] == A[i-1]+1:
      answer = answer + C[A[i-1]-1]
      
print(answer)

### FIXED CODE ###

N = int(input())
print(N*N*N)
from math import factorial

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

if N == 0:
    combN = 0
else:
    combN = factorial(N) // (factorial(N - 2) * factorial(2))

if M == 0:
    combM = 0
else:
    combM = factorial(M) // (factorial(M - 2) * factorial(2))

print(combN + combM)


### FIXED CODE ###

from math import factorial

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

if N <= 1:
    combN = 0
else:
    combN = factorial(N) // (factorial(N - 2) * factorial(2))

if M <= 1:
    combM = 0
else:
    combM = factorial(M) // (factorial(M - 2) * factorial(2))

print(combN + combM)