Harryxun/stf_run huggingface dataset:
n,k = map(int,input().split())
light_power = list(map(int,input().split()))

max_power = [n for i in range(n)]
init_light = [0 for i in range(n)]
if k>50:
  k=42
for i in range(k):
  number_light = init_light
  for j,_power in enumerate(light_power):
    if _power == 0:
      number_light[j] += 1
    else:
      number_light = list(map(sum, zip(number_light, [1 if i>=(j+1-_power-0.5) and (j+1+_power+0.5)>=i else 0 for i in range(1,n+1)])))
  light_power = number_light
  if light_power == max_power:
    break
print(*light_power)

### FIXED CODE ###

s = input()
print(s[:3])
N,R=map(int,input().split())
if N < 10:
  return R+100*(10-n)
else:
  return R

### FIXED CODE ###

N,R=map(int,input().split())
if N < 10:
  print(R+100*(10-N))
else:
  print(R)
A,B,C=map(int,input().split())
total=abs(max(A,B,C)-A)+abs(max(A,B,C)-B)+abs(max(A,B,C)-C)

if total%2==0:
    print(total//2)
else:
    print((total+1)//2+

### FIXED CODE ###

A,B,C=map(int,input().split())
total=abs(max(A,B,C)-A)+abs(max(A,B,C)-B)+abs(max(A,B,C)-C)

if total%2==0:
    print(total//2)
else:
    print((total+1)//2+1)
import itertools


def main():
    n = int(input())

    a = []
    for i in range(n):
        a.append(int(input()))
    a.sort()
    if n == 2:
        print(abs(a[0] - a[1]))
        return
    if n == 3:
        tmp1 = abs(a[0] - a[1]) + abs(a[0] - a[2])
        tmp2 = abs(a[0] - a[2]) + abs(a[1] - a[2])
        print(max([tmp1, tmp2]))
        return
    if n < 10:
        ans = 0
        for a in itertools.permutations(a):
            tmp = 0
            for i in range(len(a) - 1):
                tmp += abs(a[i] - a[i + 1])
            ans = max([ans, tmp])
        print(ans)
        return
    ret1 = a[:n // 2 + (1 if n % 2 == 1 else 0)]
    ret2 = a[n // 2 + (1 if n % 2 == 1else 0):]
    ret1 = [ret1[-1]] + ret1[:-2] + [ret1[-2]]
    ret2 = ret2[1:] + [ret2[0]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret2) - 1):
        ans += abs(ret1[i] - ret2[i])
        ans += abs(ret1[i + 1] - ret2[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-2] - ret2[-1])

    # if n % 2 == 0:
    #     print(ans)
    #     return
    ans1 = ans

    ret1 = a[:n // 2 + (0 if n % 2 == 1 else 1)]
    ret2 = a[n // 2 + (0 if n % 2 == 1else 1):]
    # ret1 = ret1[1:] + [ret1[0]]
    ret2 = [ret2[0]] + ret2[2:] + [ret2[1]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret1) - 1):
        ans += abs(ret2[i] - ret1[i])
        ans += abs(ret2[i + 1] - ret1[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-1] - ret2[-2])
    print(max([ans, ans1]))


main()
7541

### FIXED CODE ###

import itertools


def main():
    n = int(input())

    a = []
    for i in range(n):
        a.append(int(input()))
    a.sort()
    if n == 2:
        print(abs(a[0] - a[1]))
        return
    if n == 3:
        tmp1 = abs(a[0] - a[1]) + abs(a[0] - a[2])
        tmp2 = abs(a[0] - a[2]) + abs(a[1] - a[2])
        print(max([tmp1, tmp2]))
        return
    if n < 10:
        ans = 0
        for a in itertools.permutations(a):
            tmp = 0
            for i in range(len(a) - 1):
                tmp += abs(a[i] - a[i + 1])
            ans = max([ans, tmp])
        print(ans)
        return
    ret1 = a[:n // 2 + (1 if n % 2 == 1 else 0)]
    ret2 = a[n // 2 + (1 if n % 2 == 1else 0):]
    ret1 = [ret1[-1]] + ret1[:-2] + [ret1[-2]]
    ret2 = ret2[1:] + [ret2[0]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret2) - 1):
        ans += abs(ret1[i] - ret2[i])
        ans += abs(ret1[i + 1] - ret2[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-2] - ret2[-1])

    if n % 2 == 0:
        print(ans)
        return
    ans1 = ans

    ret1 = a[:n // 2 + (0 if n % 2 == 1 else 1)]
    ret2 = a[n // 2 + (0 if n % 2 == 1else 1):]
    # ret1 = ret1[1:] + [ret1[0]]
    ret2 = [ret2[0]] + ret2[2:] + [ret2[1]]
    ans = 0

    ans += abs(ret1[-1] - ret2[-1])
    for i in range(len(ret1) - 1):
        ans += abs(ret2[i] - ret1[i])
        ans += abs(ret2[i + 1] - ret1[i])
    if len(ret1) != len(ret2):
        ans += abs(ret1[-1] - ret2[-2])
    print(max([ans, ans1]))


main()
val = input('Enter your name: ')

if len(val)<=3:
  val = input('Enter your name: ')
elif len(val)>=20:
  val = input('Enter your name: ')

else:

print(val)

print(len(val))

t = random.randint(0,len(val)-2)

print(val[t]val[t+1]val[t+2])
  

### FIXED CODE ###

val = input()
print(val[0:3])
a=[1,2,4,8,16,32,64,128]
    n=int(input())
    i=0
    while a[i]<=n:
        i+=1
    print(a[i-1] if i>0 else 0)

### FIXED CODE ###

print('ABC'+input())
import sys

q=input()
x=[int(i) for i in input().split()]
cnt=input()
j=0
y=[int(i) for i in input().split()]

if max(x) >= max(y): MAX=max(x)
else : MAX=max(y)

z=[0]*MAX

for k in x :
    z[k-1] += 1
    
j=0
for i in y :
    z[i-1] -= 1
    if z[i-1] == -1 :
        print('NO')
        j=1
        break
if j==0:
    print('YES')


### FIXED CODE ###


q=input()
x=[int(i) for i in input().split()]
cnt=input()
y=[int(i) for i in input().split()]

if max(x) >= max(y):
    MAX=max(x)
else:
    MAX=max(y)

dic = {}

for k in x :
    if k in dic.keys() :
        dic[k] += 1
    else :
        dic[k] = 1
    
for i in y :
    if i in dic.keys() :
        dic[i] -= 1
        if dic[i] == -1 :
            print('NO')
            exit()
    else :
        print('NO')
        exit()
print('YES')
# 入力
a,b = map(int, input().split())
# 積の計算、判定
if (a * b) % 2 == 0:
  print('Even')
else:
  ptint('Odd')

### FIXED CODE ###

# 入力
a,b = map(int, input().split())
# 積の計算、判定
if (a * b) % 2 == 0:
  print('Even')
else:
  print('Odd')
S=input()

i=0
flag=0
while i<len(S):
    if S[i] == 'h' and S[i+1] == 'i':
        i=i+2
    else:
        flag=1
        i=len(S)

if flag==0:
    print('Yes')
elif flag==1:
    print('No')

### FIXED CODE ###

S=input()

i=0
flag=0
while i<len(S) and len(S)%2==0:
    if S[i] == 'h' and S[i+1] == 'i':
        i=i+2
    else:
        flag=1
        i=len(S)

if flag==0 and len(S)%2==0:
    print('Yes')
else:
    print('No')
import math
N = int(input())
sheet = []
for i in range(N):
  line = input().split()
  sheet+=[(int(line[0]), int(line[1]))]
dic = {}
for i in range(N):
  start = sheet[i]
  for j in range(i+1, N):
    vec = [(sheet[j][0]-start[0]), (sheet[j][1]-start[1])]
    size = math.gcd(vec[0],vec[1])
    vec[0] = vec[0]//size
    vec[1] = vec[1]//size
    vec = tuple(vec)
    if vec not in dic.keys():
      dic[vec] = set([j])
    else:
      dic[vec].add(j)
m = 0
for s in dic.values():
  if len(s)>m:
    m = len(s)
print(N-m)

### FIXED CODE ###

N,*L = map(int, open(0).read().split())
ls = [0]*N
for i,c in enumerate(zip(*[iter(L)]*2)):
  ls[i] = c
ls.sort()
pls = []
for i in range(N):
  for j in range(i+1,N):
    a,b = ls[i]
    x,y = ls[j]
    pls += [(x-a,y-b)]
ans = 10**10
for X,Y in pls:
  s = set()
  m = 0
  for x,y in ls:
    if (x-X, y-Y) not in s:
      m += 1
    s.add((x,y))
  ans = min(m,ans)
if N==1:
  ans = 1
print(ans)
x = input()
if x == 'a' or x == 'i' or x == 'u' or x=='e' or x=='o':
  print ('vowel')
else
  print ('consonant')

### FIXED CODE ###

x = input()
if x == 'a' or x == 'i' or x == 'u' or x=='e' or x=='o':
  print ('vowel')
else:
  print ('consonant')
N=int(input())
num = list(map(int,input().split()))

num_sort = num.sorted()
ans = 0

for i in range(N):
  if num[i] == num_sorted[i]:
    continue
  else:
    ans += 1
    
if ans <= 2:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

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

num_sort = sorted(num)
ans = 0

for i in range(N):
  if num[i] == num_sort[i]:
    continue
  else:
    ans += 1
    
if ans <= 2:
  print("YES")
else:
  print("NO")
# ABC119B

n = int(input()

z = 0
for i in range(n):
    x, y = input().split()
    x = int(x)
    if y == 'JPY':
        z += x
    else:
        z += x*380000
print(z)


### FIXED CODE ###

# ABC119B

n = int(input())

z = 0
for i in range(n):
    x, y = input().split()
    x = float(x)
    if y == 'JPY':
        z += x
    else:
        z += x*380000
print(z)
n, m = map(int,input().split())
cor, war = 0,0
c = [[0,0] for k in range(n)] #[ACしたか,WA数]
for i in range(m):
  p,s = list(input().split())
  p = int(p)
  if s == "AC" and c[p][0] == 0: #初めてのACなら正答数を増やしてフラグを立て、ペナルティを誤答数分増やす
    cor += 1
    c[p][0] = 1
    war += c[p][1]
  if s == "WA" and c[p][0] == 0: #ACしていない状態でのWA数を記録
    c[p][1] += 1
print(cor,war)    
    

### FIXED CODE ###

n, m = map(int,input().split())
cor, war = 0,0
c = [[0,0] for k in range(n)] #[ACしたか,WA数]
for i in range(m):
  p,s = list(input().split())
  p = int(p)-1
  if s == "AC" and c[p][0] == 0: #初めてのACなら正答数を増やしてフラグを立て、ペナルティを誤答数分増やす
    cor += 1
    c[p][0] = 1
    war += c[p][1]
  if s == "WA" and c[p][0] == 0: #ACしていない状態でのWA数を記録
    c[p][1] += 1
print(cor,war)
import operator
num = int(input())
a = list(map(int, input().split()))
result = reduce(operator.mul,a)
if result > 1000000000000000000:
    print(-1)
else:
    print(result)

### FIXED CODE ###

ans = 1
flag = 0

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

if 0 in a:
    print(0)
else:
    for i in range(n):
        ans *= a[i]
        if ans > 1000000000000000000:
            flag = 1
            print(-1)
            break
    
    if flag == 0:
        print(ans)
x = X + Y/2
print(x)

### FIXED CODE ###

X, Y = map(int, input().split())

print(X + Y//2)
c = [input().split() for i in range(3)]
print(c[0][0] + c[1][1] + c[2][2])

### FIXED CODE ###

c = [input() for i in range(3)]
print(c[0][0] + c[1][1] + c[2][2])
def main():
    import sys
    input=sys.stdin.readline
    n,m=map(int,input().split())
    G=[[] for _ in range(n)]
    for _ in range(m):
        x,y,z=map(int,input().split())
        x-=1
        y-=1
        G[x].append(y)
        G[y].append(x)
    
    visited=[True]*n
    def dfs(i):
        visited[i]=False
        for e in G[i]:
            if visited[e]:
                dfs(e)
    
    cnt=0
    for i in range(n):
        if visited[i]:
            cnt+=1
            dfs(i)
    
    print(cnt)  

if __name__=='__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    input=sys.stdin.readline
    sys.setrecursionlimit(1000000000)
    n,m=map(int,input().split())
    G=[[] for _ in range(n)]
    for _ in range(m):
        x,y,z=map(int,input().split())
        x-=1
        y-=1
        G[x].append(y)
        G[y].append(x)
    
    visited=[True]*n
    def dfs(i):
        visited[i]=False
        for e in G[i]:
            if visited[e]:
                dfs(e)
    
    cnt=0
    for i in range(n):
        if visited[i]:
            cnt+=1
            dfs(i)
    
    print(cnt)  

if __name__=='__main__':
    main()
n=int(input())
a=list(map(int,input().split()))
a.sort()
if n%2==1:
    if a[0]!=0:
        print(0)
        exit()
    for i in range(n//2):
        if a[2*i+1]!=2*(i+1) or a[2*(i+1)]!=2*(i+1):
            print(0)
            exit()
    print((pow(2,n//2))%(1e9+7))
else:
    for i in range(n//2):
        if a[2*i]!=2*i+1 or a[2*i+1]!=2*i+1:
            print(0)
            exit()
    print(((pow(2,n//2))%(1e9+7)))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort()
if N % 2 == 1:
    if A[0] != 0:
        print(0)
        exit()
    for i in range(N // 2):
        if A[2 * i + 1] != 2 * (i + 1) or A[2 * i + 2] != 2 * (i + 1):
            print(0)
            exit()
    print(pow(2, N // 2) % (10 ** 9 + 7))
else:
    for i in range(N // 2):
        if A[2 * i] != 2 * i + 1 or A[2 * i + 1] != 2 * i + 1:
            print(0)
            exit()
    print((pow(2, N // 2)) % (10 ** 9 + 7))
import math
N, K=map(int, input().split())
A=list(map(int, input().split()))
i=1
j=10**9
while True:
    k=(i+j)//2
    if k>0 and sum([math.ceil(a/k)-1 for a in A])<=K:
        if k-1>0 and sum([math.ceil(a/(k-1))-1 for a in A])>K:
            print(k)
            break
        else:
            j=k-1
    else:
        i=k+1


### FIXED CODE ###

X=int(input())
if X>=30: print('Yes')
else: print('No')
n=int(input());s=input();k=int(input())
print(''.join([i if i==s[k-1]else*for i in s]))

### FIXED CODE ###

# coding: utf-8
# Your code here!

n=int(input())
s=input()
k=int(input())
'''
#a,b=map(int,input().split())
a=[int(i) in range(n)]
a=[0]*n
for i in range(n):
    a.append(int(i))
'''

t=s[k-1]
ans=''
for i in range(n):
    if s[i]==t:
        ans+=t
    else:
        ans+='*'
print(ans)
a=input().split()
if a[1]=='+':
  print(a[0]+a[2])
else:
  print(a[0]-a[2])

### FIXED CODE ###

a=input().split()
if a[1]=='+':
  print(int(a[0])+int(a[2]))
else:
  print(int(a[0])-int(a[2]))
r,g,b,n=map(int,input().split())
num=0
fot i in range(g+1):
  for j in range (b+1):
    if i+j>N:
      break
    if 0<=N-i-j<=r:
      num+=1
print(num)


### FIXED CODE ###

r,g,b,N=map(int,input().split())
num=0
for i in range(N+1):
  for j in range (N+1):
    s=(N-i*r-j*g)
    if s>=0 and s%b==0:
      num+=1
print(num)
# coding: utf-8
# Your code here!

import sympy

def cal_result(result_param,info_list):
    result = 0
    for num in info_list:
        num = int(num)
        result = result + (num-result_param)**2
    return result
    

def min_answear(info):
    param = sympy.Symbol('param')
    formula = sympy.Symbol('formula')
    
    formula = 0
    for num in info:
        num = int(num)
        calculate = sympy.Symbol('calculate')
        calculate = (num - param)**2
        formula = formula + calculate
        
    result_form = sympy.diff(formula , param)
    result = sympy.solve(result_form)
    result = str(result[0])
    result = result.split("/")
    result = int(result[0])/int(result[1])
    
    if result.is_integer():
        result = int(result)
        answear = cal_result(result,info)
    else:
        result1 = int(result)
        sub_answear1 = cal_result(result1,info)
        result2 = int(result) + 1
        sub_answear2 = cal_result(result2,info)
        if sub_answear1 <= sub_answear2:
            answear = sub_answear1
        else:
            answear = sub_answear2
    
    print(answear)
    
def main():
    join_num = int(input())
    
    join_info = input()
    join_info = join_info.split()
    min_answear(join_info)

if __name__ == "__main__":
    main()
    

### FIXED CODE ###

# coding: utf-8
# Your code here!

def main():
    number_of_human = int(input())
    position_list = list(map(int,input().split()))
    
    start_position = min(position_list)
    end_position = max(position_list)
    max_answear = sum([(item - start_position)**2 for item in position_list])
    while True:
        answear = sum([(item - start_position)**2 for item in position_list])
        if start_position == end_position:
            break
        start_position += 1
        if answear < max_answear:
            max_answear = answear
    
    print(max_answear)
if __name__ == "__main__":
    main()
N, K, C = map(int, input().split())
S = list(input())
countr = 0
countl = 0
switchr = 0
switchl = 0
left_greedy = [0]*len(S)
right_greedy=[0]*len(S)
#left
for l in range(len(S)):
    i = S[l]
    if switchl ==1:
        if i == 'o':
            if countl >= C:
                left_greedy[l]=1
                clist[l] = countl
                countl = 0
            else:
                countl+=1
                clist[l] = countl
        else:
            countl+=1
    else:
        if i == 'o':
            left_greedy[l]=1
            switchl+=1
#right_greedy
    r = len(S)-l-1
    i = S[r]
    if switchr ==1:
        if i == 'o':
            if countr >= C:
                right_greedy[r]=1
                
                countr = 0
            else:
                countr+=1
        else:
            countr+=1
            
    else:
        if i == 'o':
            right_greedy[r]=1
            switchr+=1
for i in range(len(S)):
    if S[i] ==  'o':
        l = left_greedy[0:i].count(1)
        r = right_greedy[i+1:len(S)].count(1)
        x = r+l
        if 1 in left_greedy[0:i][::-1]:
            if 1 in right_greedy[i+1:len(S)-1]:
                if left_greedy[0:i][::-1].index(1)+right_greedy[i+1:len(S)-1][::-1].index(1)+1 < C:
                    x+=-1
        if x < K:
            print(i+1)

### FIXED CODE ###

X, Y, Z = map(int, input().split())
print("{} {} {}".format(Z,X,Y))
n,k = map(int,input().split())
a = list(map(int,input().split()))

memo = [1]
setm = set(memo)
cnt = 1
to = 1
while cnt <= k:
    to = a[to-1]
    if to not in setm:
        memo.append(to)
        setm.add(to)
        cnt += 1
    else:
        break
        
idx = memo.index(to)
kidx = ((k - len(memo))%(len(memo)-idx))
if cnt<=k:
    print(memo[-2])
else:
    print(memo[-1] if kidx==0 else memo[idx:][kidx-1])

### FIXED CODE ###

import numpy as np

def main():
    N,K = map(int,input().split())
    A = [0]
    A += list(map(int,input().split()))
    A = np.array(A)
    
    i = 1
    pas = np.zeros(N)
    pas[0] = i
    k = 1
    pass_set = set(pas)
    while k <= K:
        if A[i] in pass_set:
            rps = np.where(pas==(A[i]))[0]
            ans = A[i]
            break
        pas[k] = A[i]
        pass_set.add(A[i])
        ans = A[i]
        i = A[i]
        k += 1

    if k >= K:
        print(ans)
    else:
        rpnum = (K-rps[0])%(k-rps)
        print(int(pas[rps[0]+rpnum]))

main()
import numpy as np
N, M = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(M)]

graph = np.zeros((N,N))
for A, B in AB:
  graph[A-1][B-1] = 1
  graph[B-1][A-1] = 1

ans = 0
for i in range(N):
  for j in range(N):
    h = 0
    if(graph[i][j]!=0):
      if(H[i]<=H[j]):
        h += 1
        break
  if(h==0):
    ans += 1
print(ans)

### FIXED CODE ###

import numpy as np
N, M = [int(x) for x in input().split()]
H = [float(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(M)]

max_h = [0 for _ in range(N)]

for A, B in AB:
  max_h[A-1] = max(max_h[A-1], H[B-1])
  max_h[B-1] = max(max_h[B-1], H[A-1])

ans = 0
for i in range(N):
  if(H[i]>max_h[i]):
    ans += 1
print(ans)
a = int(input)
b = int(input)
print(a*b/2)

### FIXED CODE ###

a,b,c = map(int,input().split())
print(a*b//2)
n,k = map(int,input().split())
li=range(n)
for i in range(n):
    li[i]=int(input())
li.sort()
ans=100000000000
for i in range(n-k+1):
    if ans>(li[i+k-1]-li[i]):
        ans=li[i+k-1]-li[i]
print(ans)
        
    

### FIXED CODE ###

n,k = map(int,input().split())
li=list(range(n))
for i in range(n):
    li[i]=int(input())
li.sort()
ans=100000000000
for i in range(n-k+1):
    if ans>(li[i+k-1]-li[i]):
        ans=li[i+k-1]-li[i]
print(ans)
import sys
sys.setrecursionlimit(100000000)

N,Q = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(N-1)]
px = [list(map(int,input().split())) for _ in range(Q)]

query = [[0] for _ in range(N)]
ans = [[0] for _ in range(N)]

for p,x in px:
    query[p-1] = query[p-1] + x
    
adj_list = [[] for _ in range(N)]
for a,b in ab:
    adj_list[a-1].append(b-1)
    adj_list[b-1].append(b-1)

memo = [True] * N

def dfs(v,val):
    child = adj_list[v]
    memo[v] = False
    val += query[v]
    ans[v] = val
    for s in child:
        if memo[s]:
            dfs(s,val)
        
dfs(0,0)
print(*ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)

import sys
input = sys.stdin.readline

N,Q = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(N-1)]
px = [list(map(int,input().split())) for _ in range(Q)]

query = [0] * N
ans = [0] * N

for p,x in px:
    query[p-1] = query[p-1] + x
    
adj_list = [[] for _ in range(N)]
for a,b in ab:
    adj_list[a-1].append(b-1)
    adj_list[b-1].append(b-1)

memo = [True] * N

def dfs(v,val):
    child = adj_list[v]
    memo[v] = False
    val += query[v]
    ans[v] = val
    for s in child:
        if memo[s]:
            dfs(s,val)
    return 
        
dfs(0,0)
print(*ans)
S=input()
count=0
result=[]
for i in S:
    if i=='A' or i=='T' or i=='G' or i=='C':
        count+=1
    else:
        result.append(count)
        count=0
print(max(result))

### FIXED CODE ###

S=input()
count=0
result=0
for i in S:
    if i in 'AGTC':
        count+=1
        result=max(result,count)
    else:
        count=0
print(result)
#!/usr/bin/env python3

import numpy as np

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

unique_array = np.unique(A, return_counts=True)

ans = 0
for i in range(len(unique_array[0])):
    tmp = unique_array[1][i]
    ans += (tmp * (tmp-1))//2


for i in range(N):
    num = A[i]
    index = np.where(unique_array[0] == num)[0]
    print(ans - unique_array[1][index][0] + 1)


### FIXED CODE ###

#!/usr/bin/env python3

import collections

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

c = collections.Counter(A)
values = c.keys()
counts = c.values()

subs = {}
a_sum = 0
for v, c in zip(values, counts):
    subs[v] = c
    a_sum += (c * (c-1)) // 2

for i in range(N):
    print(a_sum - subs[A[i]] + 1)
N, K = map(int, input().split())

mod = [i for i in range(K, N+1, K)]
ans += len(mod) ** 3

if K % 2 == 0:
    items = [i for i in range(K//2, N+1, K)]
    ans += len(items)

print(ans)


### FIXED CODE ###

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

mod = [i for i in range(K, N+1, K)]
ans = len(mod) ** 3

if K % 2 == 0:
    items = [i for i in range(K//2, N+1, K)]
    ans += len(items) ** 3

print(ans)
H, W = map(int(input().split()))
h, w = map(int(input().split()))
print((H-h)*(W-w))

### FIXED CODE ###

H, W = map(int,input().split())
h, w = map(int,input().split())
print((H-h)*(W-w))
n = int(input())
x = list(map(int,input().split()))
a = [-1]*(n+1)
def step(i):
    
    if i>=n-1:
        a[i]=0
        return x[-1]
    if(a[i]!=-1):return x[i]
    a[i] = min(abs(step(i+1)-x[i])+a[i+1],abs(step(i+2)-x[i])+a[i+2])
    return x[i]
step(0)
print(a[0])

### FIXED CODE ###

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

dp = [0, abs(h[1]-h[0])]
if n >2:
    for i in range(2,n):
        dp.append(min(abs(h[i]-h[i-2])+dp[-2], abs(h[i]-h[i-1])+dp[-1]))
else:
    print(dp[-1])
    exit()

print(dp[-1])