Harryxun/stf_run huggingface dataset:
n,k=map(int,input().split())
a=list(map(int,input().split()))
data=[0]*(n+1)
data[1]=1
ans=[1]
res=0
for i in range(n):
  p=a[res]
  if data[p]==0:
    data[p]=1
    ans.append(p)
    res=p-1
  else:
    res=ans.index(p)
    break
if len(ans)>=k:
  print(ans[k])
else:
  m=len(ans)-res
  k-=res
  d=k%m
  print(ans[res+d])

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
data=[0]*(n+1)
data[1]=1
ans=[1]
res=0
for i in range(n):
  p=a[res]
  if data[p]==0:
    data[p]=1
    ans.append(p)
    res=p-1
  else:
    res=ans.index(p)
    break
if len(ans)>k:
  print(ans[k])
else:
  m=len(ans)-res
  k-=res
  d=k%m
  print(ans[res+d])
N =int(input())
lst = []

N = str(N)

list_num = list(N)

N = [int(s) for s in list_num]
ans = sum(N)

if ans % 9 == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import math
N, X, T = map(float, input().split())

ans = N / X

ans = math.ceil(ans)

time = ans * T

print(int(time))
s = int(input())
s = s % 60
m = s // 60 % 60
h = s // 60 // 60
print({0}{1}{2}.format(h,m,s))

### FIXED CODE ###

S = int(input())

s = S % 60
m = S // 60 % 60
h = S // 60 // 60

print("{0}:{1}:{2}".format(h,m,s))
n= int(input())
v,c= list(map(int, input().split()))

ans=0
for i in range(n):
    if v[i] > c[i]:
        ans+=v[i]-c[i]
print(ans)


### FIXED CODE ###

n= int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans=0
for i in range(n):
    if v[i] > c[i]:
        ans+=v[i]-c[i]
print(ans)
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

n, m = map(int, input().split())
s = list(input())
t = list(input())

s1 = ['*'] * lcm(n, m)
l = len(s1)

for i in range(n):
    s1[(l//n) * i] = s[i]

for j in range(m):
    if s1[(l//m) * j] != '*' and s1[(l//m) * j] != t[j]:
        print(-1)
        break
    if j == m - 1:
        print(l)

### FIXED CODE ###

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

def lcm(a, b):
    return a * b // gcd(a, b)

n, m = map(int, input().split())
s = list(input())
t = list(input())

for i in range(gcd(n, m)):
    if s[i * (n // gcd(n, m))] != t[i * (m // gcd(n, m))]:
        print(-1)
        break
    if i == gcd(n, m) - 1:
        print(lcm(n, m))
h, w = map(int,input().split())
li = [list(input()) for i in range(h)]

for i in range(h):
    for j in range(w):
        x = 0 #縦OK
        y = 0 #横OK
        if li[i][j] == "#":
            if i == 0:
                if li[i+1][j] == "#":
                    x = 1
            elif i == w-1:
                if li[i-1][j] == "#":
                    x = 1
            else:
                if li[i+1][j] == "#" or li[i-1][j] == "#":
                    x = 1
            if j == 0:
                if li[i][j+1] == "#":
                    y = 1
            elif j == h-1:
                if li[i][j-1] == "#":
                    y = 1
            else:
                if li[i][j+1] == "#" or li[i][j-1] == "#":
                    y = 1 

            if x == 0 and y == 0:
                print("No")
                exit()

print("Yes")

### FIXED CODE ###

h, w = map(int,input().split())
li = [list(input()) for i in range(h)]

if h == 1 or w == 1:
    print("No")
    exit()

for i in range(h):
    for j in range(w):
        x = 0 #縦OK
        y = 0 #横OK
        if li[i][j] == "#":
            if i == 0:
                if li[i+1][j] == "#":
                    x = 1
            elif i == h-1:
                if li[i-1][j] == "#":
                    x = 1
            else:
                if li[i+1][j] == "#" or li[i-1][j] == "#":
                    x = 1
            if j == 0:
                if li[i][j+1] == "#":
                    y = 1
            elif j == w-1:
                if li[i][j-1] == "#":
                    y = 1
            else:
                if li[i][j+1] == "#" or li[i][j-1] == "#":
                    y = 1 

            if x == 0 and y == 0:
                print("No")
                exit()

print("Yes")
s = input()
t = input()

cnt = []
for i in range(len(t)):
    for k in range(i + 1, len(t)):
        if t[i:k] in s[i:]:
            cnt.append(k - i)
            #print(t[i:k])
#print(cnt)
print(len(t) - max(cnt))


### FIXED CODE ###

s = input()
t = input()

cnt = []
for i in range(len(s) - len(t) + 1):
    cnt1 = 0
    for k in range(len(t)):
        if t[k] == s[i: i + len(t)][k]:
            cnt1 += 1
            cnt.append(cnt1)
            #print(t[i:k], s[i:], k-i)
    else:
        cnt.append(0)
            #print(t[i:k], k - i)
#print(cnt)
print(len(t) - max(cnt))
def f(k):
    if k < 0:
        return True
    if k == 0:
        return False
    return any([not f(k-a) for a in A])


n, k = map(int, input().split())
*A, = map(int, input().split())
print(f(k))


### FIXED CODE ###

n, k = map(int, input().split())
*A, = map(int, input().split())
DP = [False] * (k+1)
for i in range(k+1):
    for a in A:
        if i+a <= k and not DP[i]:
            DP[i+a] = True
if DP[k]:
    print('First')
else:
    print('Second')
S = input()
ans = 0

for n in range(3, len(S)):
    for i in range(len(S)-n):
        ans += 1 if int(S[i:i+n+1]) % 2019 == 0 else 0

print(ans)

### FIXED CODE ###

S, W = map(int, input().split())
if S <= W:
    print('unsafe')
else:
    print('safe')
r = input()
print(int(r*r))

### FIXED CODE ###

r = int(input())
print(r**2)
s = input()
a = [int(c) for c in s]

if bool(a[0]!=7 and a[1]!=7 and a[2]!=7):
        print("No")
else
        print("Yes")


### FIXED CODE ###

s = input()
a = [int(c) for c in s]

if bool(a[0]!=7 and a[1]!=7 and a[2]!=7):
        print("No")
else:
        print("Yes")
# -*- coding: utf-8 -*-

def Judge(a, b, c):
    if a > c:
        return 'No'
    elif c > b:
        return 'No'
    else:
        return 'Yes'

Judge(map(int, raw_input().split()))


### FIXED CODE ###

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

def Judge(a, b, c):
    if a > c:
        return 'No'
    elif c > b:
        return 'No'
    else:
        return 'Yes'

a,b,c = map(int, input().split())
print(Judge(a,b,c))
S=input()
 
print S/3600+':'+(S%3600)/60+':'+S%60

### FIXED CODE ###

S=input()
 
print str(S/3600)+':'+str((S%3600)/60)+':'+str(S%60)
n,k,*a = map(int,open(0).read().split())
def func(b):
  c = k
  for i in a:
    c -= i//b
    if c < 0:
      return False
  return True
l = 0
r = max(a)
while(r>l):
  lr = (l+r)//2
  if func(lr):
    r = lr
  else:
    l = lr + 1
print(r)

### FIXED CODE ###

n,k,*a = map(int,open(0).read().split())
def func(b):
  c = k
  for i in a:
    c -= (i-1)//b
    if c < 0:
      return False
  return True
l = 1
r = max(a)
while(r>l):
  lr = (l+r)//2
  if func(lr):
    r = lr
  else:
    l = lr + 1
print(r)
N, A, B, C = [int(i) for i in input().split()]

ans = list()
l = list()

for i in range(N):
    l.append(input())


def dfs(i, a, b, c):
    if i == N:
        return True

    ss = l[i]
    if ss == 'AB':
        if a == 0 and  b == 0:
            return False
        if a > 0 and dfs(i + 1, a - 1, b + 1, c):
            ans.append('B')
            return True
        if b > 0 and dfs(i + 1, a + 1, b - 1, c):
            ans.append('A')
            return True
        else:
            return False
    elif ss == 'AC':
        if a == 0 and  c == 0:
            return False
        if a > 0 and dfs(i + 1, a - 1, b, c + 1):
            ans.append('C')
            return True
        if c > 0 and dfs(i + 1, a + 1, b, c - 1):
            ans.append('A')
            return True
        else:
            return False
    elif ss == 'BC':
        if b == 0 and  c == 0:
            return False
        if b > 0 and dfs(i + 1, a, b - 1, c + 1):
            ans.append('C')
            return True
        if c > 0 and dfs(i + 1, a, b + 1, c - 1):
            ans.append('B')
            return True
        else:
            return False

dfs(0, A, B, C)

if len(ans) > 0:
    print('Yes')
    for a in ans:
        print(a)
else:
    print('No')

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5 + 10)

N, A, B, C = [int(i) for i in input().split()]

ans = list()
l = list()

for n in range(N):
    l.append(input())

def dfs(i, a, b, c):
    if i == N:
        return True

    ss = l[i]
    if ss == 'AB':
        if a == 0 and b == 0:
            return False
        if b > 0 and dfs(i + 1, a + 1, b - 1, c):
            ans.append('A')
            return True
        if a > 0 and dfs(i + 1, a - 1, b + 1, c):
            ans.append('B')
            return True
    if ss == 'AC':
        if a == 0 and c == 0:
            return False
        if c > 0 and dfs(i + 1, a + 1, b, c - 1):
            ans.append('A')
            return True
        if a > 0 and dfs(i + 1, a - 1, b, c + 1):
            ans.append('C')
            return True
    if ss == 'BC':
        if b == 0 and c == 0:
            return False
        if c > 0 and dfs(i + 1, a, b + 1, c - 1):
            ans.append('B')
            return True
        if b > 0 and dfs(i + 1, a, b - 1, c + 1):
            ans.append('C')
            return True
    return False

dfs(0, A, B, C)

if len(ans) > 0:
    print('Yes')
    for x in reversed(ans):
        print(x)
else:
    print('No')
D,N = map(int,input().split())

if N = 100:
  print(100**D*101)
else:
  print(100**D*N)

### FIXED CODE ###

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

if N == 100:
  print(100**D*101)
else:
  print(100**D*N)
from collections import deque

n,m,k=map(int,input().split())
fre=[[]for _ in range(n)]
blo=[[] for _ in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    fre[a-1].append(b-1)
    fre[b-1].append(a-1)
for i in range(k):
    c,d=map(int,input().split())
    blo[c-1].append(d-1)
    blo[d-1].append(c-1)

cnt=[0]*n
l=deque()
x=1
dic={}
for i in range(n):
    if cnt[i]==0:
        l.append(i)
    while l:
        now=l.popleft()
        for to in fre[now]:
            if cnt[to]==0:
                cnt[to]=x
                if x in dic:
                    dic[x]+=1
                else:
                    dic[x]=1
                l.append(to)
    x+=1

for i in range(n):
    k=len(fre[i])
    for b in blo[i]:
        if cnt[b]==cnt[i]:
            k+=1
    if dic=={}:
        print(0)
    else:
        print(dic[cnt[i]]-k-1)

### FIXED CODE ###

from collections import deque

n,m,k=map(int,input().split())
fre=[[]for _ in range(n)]
blo=[[] for _ in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    fre[a-1].append(b-1)
    fre[b-1].append(a-1)
for i in range(k):
    c,d=map(int,input().split())
    blo[c-1].append(d-1)
    blo[d-1].append(c-1)

cnt=[0]*n
l=deque()
x=1
dic={}
for i in range(n):
    if cnt[i]==0:
        l.append(i)
    while l:
        now=l.popleft()
        for to in fre[now]:
            if cnt[to]==0:
                cnt[to]=x
                if x in dic:
                    dic[x]+=1
                else:
                    dic[x]=1
                l.append(to)
    x+=1

for i in range(n):
    if dic=={}:
        print(0)
    else:
        k=len(fre[i])
        for b in blo[i]:
            if cnt[b]==cnt[i]:
                k+=1
        if cnt[i] in dic:
            print(dic[cnt[i]]-k-1)
        else:
            print(0)
n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = c[0]
jud = []
for i in range(n):
    if i not in jud:
        l = []
        j = p[i] - 1
        while j not in jud:
            jud.append(j)
            l.append(c[p[j]-1])
            j = p[j] - 1
        le = len(l)
        if le == 0:
            continue
        l *= (k//le +2)
        for ii in range(le):
            val = l[ii]
            ans = max(ans,val)
            for cnt in range(ii+1, ii + k):
                val += l[cnt]
                ans = max(val, ans)

print(ans)

### FIXED CODE ###

n, k = map(int, input().split())
p = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = c[0]
jud = []
for i in range(n):
    if i not in jud:
        l = []
        j = p[i] - 1
        while j not in jud:
            jud.append(j)
            l.append(c[p[j]-1])
            j = p[j] - 1
        le = len(l)
        su = sum(l)
        l *= 2
        if su > 0:
            v = (k//le)*su
            ans = max(ans, v)
        for ii in range(le):
            val = 0
            for cnt in range(0, le):
                val += l[ii + cnt]
                if su > 0:
                    v = val + ((k - cnt - 1)//le)*su
                    ans = max(ans, v)
                else:
                    ans = max(ans, val)

print(ans)
x, y = map(int, input().split())
tmp = 2*y - x
if tmp%3 != 0:
    print(0)
    exit()
up = tmp // 3
total = y - up*2 + up

n = total
k = up
mod = 10**9 + 7

modinv_table = [-1] * (k+1)
modinv_table[1] = 1
for i in range(2, k+1):
    modinv_table[i] = (-modinv_table[mod % i] * (mod // i)) % mod

def binomial_coefficients(n, k):
    ans = 1
    for i in range(k):
        ans *= n-i
        ans *= modinv_table[i + 1]
        ans %= mod
    return ans

print(binomial_coefficients(n, k))

### FIXED CODE ###

x, y = map(int, input().split())
tmp = 2*y - x
if tmp%3 != 0:
    print(0)
    exit()
up = tmp // 3
total = y - up*2 + up

n = total
k = up
mod = 10**9 + 7

#print(n)
#print(k)

if k == 0:
    print(1)
    exit()
try:
    modinv_table = [-1] * (k+1)
    modinv_table[1] = 1
    for i in range(2, k+1):
        modinv_table[i] = (-modinv_table[mod % i] * (mod // i)) % mod
except:
    k = total - up
    modinv_table = [-1] * (k + 1)
    modinv_table[1] = 1
    for i in range(2, k + 1):
        modinv_table[i] = (-modinv_table[mod % i] * (mod // i)) % mod

def binomial_coefficients(n, k):
    ans = 1
    for i in range(k):
        ans *= n-i
        ans *= modinv_table[i + 1]
        ans %= mod
    return ans

print(binomial_coefficients(n, k))
a =int(input())
m =0
for i in range(N):
  p=int(input())
  m=max(m,p)
a=int(sum(p)-m/2)
print(a)

### FIXED CODE ###

N = int(input())
sm,mx = 0,0
for i in range(N):
  P = int(input())
  sm += P
  mx = max(mx, P)

a = int(sm - mx / 2)
print(a)
sys.setrecursionlimit(20000)

class UnionFind:
    def __init__(self,N):
        self.par = [i for i in range(N)]
 
    def root(self,x):
        if self.par[x] == x:
            return x
        self.par[x] = self.root(self.par[x])
        return self.par[x]
 
    def unite(self,x,y):
        self.rx = self.root(x)
        self.ry = self.root(y)
        if self.rx == self.ry:
            return
        self.par[self.rx] = self.ry
 
    def same(self,x,y):
        self.rx = self.root(x)
        self.ry = self.root(y)
        return self.rx == self.ry
 
N,M = [int(i) for i in input().split()]
uf = UnionFind(N)
 
for _ in range(M):
    x,y,_ = [int(i)-1 for i in input().split()]
    uf.unite(x,y)
 
ans = set()
for i in range(N):
    ans.add(uf.root(i))
 
print(len(ans))


### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)

class UnionFind:
    def __init__(self,N):
        self.par = [i for i in range(N)]
 
    def root(self,x):
        if self.par[x] == x:
            return x
        self.par[x] = self.root(self.par[x])
        return self.par[x]
 
    def unite(self,x,y):
        self.rx = self.root(x)
        self.ry = self.root(y)
        if self.rx == self.ry:
            return
        self.par[self.rx] = self.ry
 
    def same(self,x,y):
        self.rx = self.root(x)
        self.ry = self.root(y)
        return self.rx == self.ry
 
N,M = [int(i) for i in input().split()]
uf = UnionFind(N)
 
for _ in range(M):
    x,y,_ = [int(i)-1 for i in input().split()]
    uf.unite(x,y)
 
ans = set()
for i in range(N):
    ans.add(uf.root(i))
 
print(len(ans))
alphabet = input()
alphabet = ord(alphabet)+1
print(chr(alphabet)

### FIXED CODE ###

moji = input()
moji = ord(moji)+1
print(chr(moji))
time =input())
h=0
h = int(time/(60*60))
m=int(time/60-h*60)
s=int(time-h*60*60-m*60)
print(str(h)+":"+str(m)+":"+str(s))javascript:void(0)


### FIXED CODE ###

time =int(input())
h = int(time/(60*60))
m=int(time/60-h*60)
s=int(time-h*60*60-m*60)
print(str(h)+":"+str(m)+":"+str(s))
s = input()
correct_count = 0
wrong_char_index_list = []

for i in range(len(s)):
    if s[i] == "keyence"[correct_count]:
        correct_count += 1
        if correct_count == len("keyence"):
            break
    else:
        wrong_char_index_list.append(i)

# 全部間違い
if len(wrong_char_index_list) == len(s):
    print("NO")
    exit()

# 間違い箇所が飛んでたらダメ
if len(wrong_char_index_list) >= 2:
    for i in range(1, len(wrong_char_index_list) + 1):
        if wrong_char_index_list[i] - wrong_char_index_list[i-1] != 1:
            print("NO")
            exit()

print("YES")
exit()

### FIXED CODE ###

s = input()
l = len(s)

for i in range(l):
    for j in range (i, l):
        if 'keyence' == (s[:i] + s[j:]):
            print("YES")
            exit()

print("NO")
kosu = [0] * 100
k = 1
while True:
    try:
        n = int(input())
        kosu[n - 1] += 1
    except (EOFError,ValueError):
        ma = max(kosu)
        num = kosu.index(ma) + k
        print(num)
        
        
        kosu.remove(max(kosu))
        while True:
            if ma > max(kosu):
                break
            k += 1
            num = kosu.index(ma) + k
            kosu.remove(max(kosu))
            print(num)

### FIXED CODE ###

kosu = [0] * 100
k = 1
while True:
    try:
        n = int(input())
        kosu[n - 1] += 1
    except (EOFError,ValueError):
        ma = max(kosu)
        num = kosu.index(ma) + k
        print(num)
        
        
        kosu.remove(max(kosu))
        while True:
            if ma > max(kosu):
                break
            k += 1
            num = kosu.index(ma) + k
            kosu.remove(max(kosu))
            print(num)
        break
a = set(list(input()))
print("Yes" if ~("N" in a ^ "S" in a) and ~("W" in a ^ "E" in a) else "No")

### FIXED CODE ###

a = list(input())
print("No" if (("N" in a) ^ ("S" in a)) or (("W" in a) ^ ("E" in a)) else "Yes")
a,b,c = map(int, input().split())

f a == b:
    if b == c:
        print('No')
    else:
        print('Yes')
elif b == c:
    print('Yes')
elif c == a:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

if a == b:
    if b == c:
        print('No')
    else:
        print('Yes')
elif b == c:
    print('Yes')
elif c == a:
    print('Yes')
else:
    print('No')
def mpow(x: int, k: int, MOD=1000000007) -> int:
    """
    x^kのmodを返します
    """
    res = 1
    y = x
    while (k):
        if(k % 2 == 1):
            res = (res * y) % MOD
        y = (y ** 2) % MOD
        k = k // 2
    return res
'''
def cmb(n, x, mod=10**9+7):
    # nCx
    # 組み合わせ
    # ex) combination(5, 2) = 10
    factorial = [1] * (n+1)
    t = 1
    for i in range(1, n+1):
        t = (t * i) % mod
        factorial[i] = t
    tmp = factorial[n]
    tmp = (tmp * pow(factorial[x], mod-2, mod)) % mod
    tmp = (tmp * pow(factorial[n-x], mod-2, mod)) % mod
    return tmp
'''
mod = 10**9+7 #出力の制限

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

print(mpow(2,10**9))

num = 1000000000 + 7

MAX_NUM = N
MOD = 10**9+7

fac  = [0 for _ in range(MAX_NUM)]
finv = [0 for _ in range(MAX_NUM)]
inv  = [0 for _ in range(MAX_NUM)]

fac[0]  = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1

for i in range(2,MAX_NUM):
    fac[i] = fac[i-1] * i % MOD
    inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
    finv[i] = finv[i-1] * inv[i] % MOD

def cmb(n,k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD

#print(mpow(2,N))

print(mpow(2,N)- cmb(N, a) - cmb(N, b) -1)

### FIXED CODE ###

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

if N < 10:
    print(K+100*(10-N))
else:
    print(K)
import bisect

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

cnt = 0
L = list(set(L))
L = sorted(L)


if N >= 3:
    for i in range(len(L)-2):
        for j in range(i+1, len(L)-1):
            ind = bisect.bisect_left(L, L[i]+L[j])
            cnt += max(0, ind-j)
    print(cnt)

else:
    print(0)


### FIXED CODE ###

X, K, D = map(int, input().split())

if abs(K*D) > abs(X):
    A = X//D
    A %= 2
    if K % 2 == A:
        print(X%D)
    else:
        print(D-X%D)
else:
    print(abs(X)-abs(K*D))
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
Graph = [[] for _ in range(N+1)]
is_good = [False] + [True] * N
seen = [True] + [False] * N

def dfs(cur):
    global Graph, seen, H
    seen[cur] = True
    for nex in Graph[cur]:
        if H[nex] >= H[cur]:
            is_good[cur] = False
        if seen[nex]:
            continue
        dfs(nex)


for _ in range(M):
    a, b = map(int, input().split())
    Graph[a].append(b)
    Graph[b].append(a)

for i in range(1, N+1):
    if not seen[i]:
        dfs(i)

print(is_good.count(True))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5 + 5)
N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
Graph = [[] for _ in range(N+1)]
is_good = [False] + [True] * N
seen = [True] + [False] * N

def dfs(cur):
    global Graph, seen, H
    seen[cur] = True
    for nex in Graph[cur]:
        if H[nex] >= H[cur]:
            is_good[cur] = False
        if seen[nex]:
            continue
        dfs(nex)


for _ in range(M):
    a, b = map(int, input().split())
    Graph[a].append(b)
    Graph[b].append(a)

for i in range(1, N+1):
    if not seen[i]:
        dfs(i)

print(is_good.count(True))
n = int(input())
a = map(int, input().split())
m = []
for i in range(n - 2):
    if a[i] < a[i + 1] < a[i + 2] or a[i + 2] < a[i + 1] < a[i]:
        m.append(0)
    if a[i + 1] < a[i] < a[i + 2] or a[i + 1] < a[i + 2] < a[i]:
        m.append(1)
    if a[i] < a[i + 2] < a[i + 1] or a[i + 2] < a[i] < a[i + 3]:
        m.append(3)

s = sum(abs(a[i] - a[i + 1]) for i in range(n - 1))

print(s - abs(a[0] - a[1]))
for i in m:
    if i == 0:
        print(s)
    elif i > 0:
        print(s - 2 * abs(a[i - 1] - a[i]))
    elif i > 0:
        print(s - 2 * abs(a[i] - a[i + 1]))
print(s - abs(a[n - 1] - a[n]))


### FIXED CODE ###

n = int(input())
a = [0] + list(map(int, input().split())) + [0]
m = []
for i in range(n):
    if a[i] <= a[i + 1] <= a[i + 2] or a[i + 2] <= a[i + 1] <= a[i]:
        m.append(0)
    elif a[i] <= a[i + 2] <= a[i + 1] or a[i + 1] <= a[i + 2] <= a[i]:
        m.append(1)
    elif a[i + 1] <= a[i] <= a[i + 2] or a[i + 2] <= a[i] <= a[i + 1]:
        m.append(-1)

s = sum(abs(a[i] - a[i + 1]) for i in range(n + 1))

for i, m0 in enumerate(m):
    if m0 == 0:
        print(s)
    elif m0 == 1:
        print(s - 2 * abs(a[i + 1] - a[i + 2]))
    elif m0 == -1:
        print(s - 2 * abs(a[i] - a[i + 1]))
def sum_part(N, k):
  return k*(2*N-k+1)/2-k*(k-1)/2+1
  
N, K = map(int, input().split())
ans = 0
for k in range(K,N+2)
  ans += sum_part(N, k)
  
print(ans)


### FIXED CODE ###

def sum_part(N, k):
  return k*(2*N-k+1)/2-k*(k-1)/2+1
  
N, K = map(int, input().split())
ans = 0
for k in range(K,N+2):
  ans += sum_part(N, k)
  
ans = ans % (10**9 + 7)
  
print(int(ans))
mport math
def check(lis,k,mid):
	for i in lis:
		k-=(i//mid)
	return k>=0
n,k=map(int,input().split())
lis=list(map(int,input().split()))
a,b=1,max(lis)
ans=b
while(a<=b):
	mid=(a+b)/2
	if(check(lis,k,mid)):
		ans=mid
		b=mid-0.000001
	else:
		a=mid+0.000001
print(int(math.ceil(ans)))

### FIXED CODE ###

def check(lis,k,mid):
	for i in lis:
		if(i%mid==0):
			k+=1
		k-=(i//mid)
	return k>=0
n,k=map(int,input().split())
lis=list(map(int,input().split()))
a,b=1,max(lis)
ans=b
while(a<=b):
	mid=(a+b)//2
	if(check(lis,k,mid)):
		ans=mid
		b=mid-1
	else:
		a=mid+1
print(ans)
n=int(input())
a=list(map(int,input().split()))
s=0
for _ i range(n):
  b=a[_]
  while b%2==0:
    b=b/2
    s+=1
print(s)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
s=0
for _ in range(n):
  b=a[_]
  while b%2==0:
    b=b/2
    s+=1
print(s)
a,b,k=map(int,input().split())
if a-b<=c:
  for i in range[a:b]:
    print(i)
else:
  for i in range[a:a+c-1]:
    print(i)
  for y in range[b-c+1:b]:
    print(y)

### FIXED CODE ###

a,b,k=map(int,input().split())
if b-a+1<=k*2:
  for i in range(a,1+b):
    print(i)
else:
  for i in range(a,a+k):
    print(i)
  for y in range(b-k+1,b+1):
    print(y)