Harryxun/stf_run huggingface dataset:
n = int(input())
stairs = [int(x) for x in input().split()]

minHeight = max(stairs[0] - 1, 0)

for i in stairs:
    if i < minHeight:
        result = False
        break
    else:
        if i > minHeight:
    	    minHeight = i - 1

if result:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n = int(input())
stairs = [int(x) for x in input(). split()]
 
minHeight = max(stairs[0] - 1, 0)
result = True

for i in stairs:
    if i < minHeight:
        result = False
        break
    else:
        if i > minHeight:
    	    minHeight = i - 1
 
if result:
    print("Yes")
else:
    print("No")
n, a, b = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
for i in range(1, n): ans+=min((x[i+1]-x[i])*a, b)
print(ans)

### FIXED CODE ###

n, a, b = map(int, input().split())
x = list(map(int, input().split()))
ans = 0
for i in range(1, n): ans+=min((x[i]-x[i-1])*a, b)
print(ans)
for cx in range(101):
    for cy in range(101):
        flag = True
        for _n in range(n):
            if s[_n][2] != 0:
                H = s[_n][2] + abs(s[_n][0] - cx) + abs(s[_n][1] - cy)
                if _n == 0:
                    H0 = H

### FIXED CODE ###

n = int(input())
xyh = [list(map(int, input().split())) for _ in range(n)]

xyh.sort(key=lambda x:x[2], reverse=True)
for cx in range(101):
    for cy in range(101):
        x, y, h = xyh[0]
        H = abs(x - cx) + abs(y - cy) + h
        f = True

        for i in range(1, n):
            x, y, h = xyh[i]
            h2 = max(0, H - abs(x - cx) - abs(y - cy))
            if h != h2:
                f = False
                break

        if f:
            ans = (cx, cy, H)

print(ans[0], ans[1], ans[2])
n = int(input())
a = list(map(int, input().split()))
r = 0
for j in a:
  if a % 2 == 0:
    r += 1
print(r)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
r = 0
for j in a:
  if j % 2 == 0:
    r += 1
print(r)
A,B,C = [int(v) for v in input().split()]
print(max(A//B,C)

### FIXED CODE ###

A,B,C = [int(v) for v in input().split()]
print(min(B//A,C))
n, q = map(int, input().split())
lis = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    lis[a].append(b)
    lis[b].append(a)
c_plus = [0 for _ in range(n)]
for _ in range(q):
    p, x = map(int, input().split())
    p -= 1
    c_plus[p] += x
ans = [-1 for _ in range(n)]
def dfs(inp):
    now = inp[0]
    count = inp[1]
    count += c_plus[now]
    ans[now] = count
    for next in lis[now]:
        if ans[next] == -1:
            dfs([next, count])
dfs([0,0])
for i in range(n):
    ans[i] = str(ans[i])
print(" ".join(ans))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
n, q = map(int, input().split())
lis = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    lis[a].append(b)
    lis[b].append(a)
c_plus = [0 for _ in range(n)]
for _ in range(q):
    p, x = map(int, input().split())
    p -= 1
    c_plus[p] += x
ans = [-1 for _ in range(n)]
def dfs(inp):
    now = inp[0]
    count = inp[1]
    count += c_plus[now]
    ans[now] = count
    for next in lis[now]:
        if ans[next] == -1:
            dfs([next, count])
dfs([0,0])
for i in range(n):
    ans[i] = str(ans[i])
print(" ".join(ans))
N=int(input())
K=int(input())
if N%K==0:
    print(0)
else :
    print(1)

### FIXED CODE ###

N, K = input().split()
N=int(N)
K=int(K)
if K==0:
    print("ZeroDivisionError!!")
elif N % K ==0:
    print(0)
else :
    print(1)
N,M=map(int,input().split())
T=[]
frag=[0 for y in range(N)]
p=[0 for y in range(N)]
a=0
for i in range(M):
  s=list(map(str,input().split()))
  T.append(s)
for i in range(M):
  if T[i][1]=='WA' and frag[int(T[i][0])-1]==0:
    p[i]=p[i]+1
  elif T[i][1]=='AC' and frag[int(T[i][0])-1]==0:
    a=a+1
    frag[int(T[i][0])-1]=1
for i in range(N):
  if frag[i]==0:
    p[i]=0
print(a,sum(p))

### FIXED CODE ###

N,M=map(int,input().split())
T=[]
frag=[0 for y in range(N)]
p=[0 for y in range(N)]
a=0
for i in range(M):
  s=list(map(str,input().split()))
  T.append(s)
for i in range(M):
  if T[i][1]=='WA' and frag[int(T[i][0])-1]==0:
    p[int(T[i][0])-1]=p[int(T[i][0])-1]+1
  elif T[i][1]=='AC' and frag[int(T[i][0])-1]==0:
    a=a+1
    frag[int(T[i][0])-1]=1
for i in range(N):
  if frag[i]==0:
    p[i]=0
print(a,sum(p))
input_line=input().rstrip().split(" ")
a=int(input_line[0])
b=int(input_line[1])
c=int(input_line[2])
if a==b==5 or a==c==5 or b==C==5:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

input_line=input().rstrip().split(" ")
five=int(input_line.count("5"))
seven=int(input_line.count("7"))
if five==2 and seven==1:
    print("YES")
else:
    print("NO")
N = int(input())
L = int(input().split(' '))

L2 = list(set(L)) # 重複を削除

ans = 0

for i in range(len(L2)):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)      
    

### FIXED CODE ###

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

L2 = list(set(L)) # 重複を削除

ans = 0

for i in range(len(L2)):
  for j in range(i+1, len(L2)):
    for k in range(j+1, len(L2)):
      l = [L2[i], L2[j], L2[k]]
      l = sorted(l, reverse = True)
      if l[0] < l[1] + l[2]:
        ans += L.count(L2[i]) * L.count(L2[j]) * L.count(L2[k])

print(ans)
while 1:
	n = input()
	if n == 0: break
	ans = {}
	for i in range(n):
		group,name = raw_input().split(":")
		if i == 0: first = group
		ans[group] = set(name[:-1].split(","))
		while 1:
			for key in ans:
				for key1 in ans:
					if key in ans[key1]:
						ans[key1] |= ans[key]
						ans[key1].discard(key)
						del ans[key]
						break
				if key not in ans:
					break
			else:
				break
	print len(ans[first])

### FIXED CODE ###

while 1:
	n = input()
	if n == 0: break
	ans = {}
	for i in range(n):
		group,name = raw_input().split(":")
		if i == 0: first = group
		ans[group] = set(name[:-1].split(","))
	while 1:
		for key in ans:
			flag = 0
			if key == first: continue
			for key1 in ans:
				if key in ans[key1]:
					ans[key1] |= ans[key]
					ans[key1].discard(key)
					flag = 1
			if flag:
				del ans[key]
				break
		if flag == 0: break
	print len(ans[first])
K = int(input())
X = int(input())

total = 500 * K;
answer = 'Yes' if total >= X else 'No';

print(answer);


### FIXED CODE ###

inputted = list(map(int, input().split()))
K = inputted[0]
X = inputted[1]

total = 500 * K;
answer = 'Yes' if total >= X else 'No';

print(answer);
a,b = str(input().split())
x,y = int(input().split())
k = str(input())

if "a" == "k" :
  print(x-1,y)
elif "b" == "k" :
  print(x,y-1)
else:
  print(x,y)

### FIXED CODE ###

S,T = input().split()
A,B = map(int, input().split())
U = input()

if S==U:
    A -= 1
else:
    B -= 1
print(A,B)
a,p=map(int,input().split())
ans=(a*3+b)//2
print(ans)


### FIXED CODE ###

a,p=map(int,input().split())
ans=(a*3+p)//2
print(ans)
n = int(input())
a = []
for i in range(n):
	x, y = map(int, input().split())
	a.append((x, y))
d = {}
for i in range(n):
	tc = a[i]
	for j in range(i + 1, n):
		nd = a[j]
		x1, y1, = tc[0], tc[1]
		x2, y2, = nd[0], nd[1]
		rz1 = abs(x1- x2)
		rz2 = abs(y1 - y2)
		d[(rz1, rz2)] = d.get((rz1,rz2), 0) + 1
print(n - max(d.values()))

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
	x, y = map(int, input().split())
	a.append((x, y))
d = {}
if n == 1:
	print(1)
	exit()
a = sorted(a)
for i in range(n):
	tc = a[i]
	for j in range(i + 1, n):
		nd = a[j]
		x1, y1, = tc[0], tc[1]
		x2, y2, = nd[0], nd[1]
		rz1 = x1 - x2
		rz2 = y1 - y2
		d[(rz1, rz2)] = d.get((rz1,rz2), 0) + 1
print(n - max(d.values()))
import numpy as np
N=int(input())
a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
A=np.zeros(11,dtype=int)
for i in range(11):
  A[i]=(26**(i+1))
B=np.cumsum(A)
for i in range(11):
  if N<=B[i]:
    name=[" "]*(i+1)
    if i==0:
      N=N
    else:
      N-B[i-1]
    for j in reversed(range(i+1)):
      if j>=1:
        if N==0:
          name[i-j]="z"
        else:
          name[i-j]=a[(N-1)//A[j-1]-1]
        N-=N//A[j-1]*A[j-1]
      else:
        if N==0:
          name[i-j]="z"
        else:
          name[i-j]=a[N-1]
    break

print(''.join(name))

### FIXED CODE ###

import numpy as np
N=int(input())
a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
A=np.zeros(11,dtype=int)
for i in range(11):
  A[i]=(26**(i+1))
B=np.cumsum(A)
for i in range(11):
  if N<=B[i]:
    name=[" "]*(i+1)
    if i==0:
      N=N
    else:
      N-=B[i-1]
    for j in reversed(range(i+1)):
      if j>=1:
        if N==0:
          name[i-j]="z"
        else:
          name[i-j]=a[(N-1)//A[j-1]]
        N-=N//A[j-1]*A[j-1]
      else:
        if N==0:
          name[i-j]="z"
        else:
          name[i-j]=a[N-1]
    break

print(''.join(name))
N, M = map(int, input().split())
lists = [list(map(int, input().split())) for i in range(N)]
ans = set(lists[0][1:])
for i in range(1, N):
    ans = set(lists[i][1:]) * ans
print(*list(ans), sep='')

### FIXED CODE ###

N, M = map(int, input().split())
lists = [list(map(int, input().split())) for i in range(N)]
ans = set(lists[0][1:])
for i in range(1, N):
    ans = set(lists[i][1:]) & ans
print(len(list(ans)))
ans=0
N=int(input())
c=round(N/2)
for i in range(1,c):
	for j in range(1,N-c):
    	cnt=i+j
        if cnt=N:
        	ans+=1
print(ans)

### FIXED CODE ###

N=int(input())
c=-(-N//2)-1
print(c)
a,b,c,d,e,f=map(int,input().split())
a=100*a
b=100*b
dp1=[0]*(f+1)
dp2=[0]*(f+1)
for i in range(f+1):
    if i%a==0:
        if i+a<=f:
            dp1[i+a]=1
for i in range(f+1):
    if i==0 or dp1[i]==1:
        if i+b<=f:
            dp1[i+b]=1
for i in range(f+1):
    if i%c==0:
        if i+c<=f:
            dp2[i+c]=1
for i in range(f+1):
    if i==0 or dp2[i]==1:
        if i+d<=f:
            dp2[i+d]=1

ans=[-1,-1,-1]
for i in range(f+1):
    if dp1[i]==1:
        x=min(f-i,(i//100)*e)
        k=-1
        for j in range(x,-1,-1):
            if dp2[j]==1 or j==0:
                k=j
                if ans[0]<100*k/(i+k):
                    ans=[100*k/(i+k),i+k,k]
                break
print(str(ans[1])+" "+str(ans[2]))

### FIXED CODE ###

n=int(input())
a=int(input())
print(n**2-a)
import itertools
import numpy as np
import math

n, p = map(int, input().split())
if n != 1:
    table = [0] * (math.sqrt(p) + 1)

    pl = []
    ans = 1

    for i in range(2, math.sqrt(p)+1):
        if table[i] == 0:
            pl.append(i)
            for j in range(i + i, math.sqrt(p)+1, i):
                table[j] = 1

    a = 0

    for i in range(len(pl)):
        q = p
        while q % pl[i] == 0:
            a += 1
            q = q / pl[i]
        ans = ans * (pl[i] ** (int(a//n)))
        a = 0
else:
    ans = p
print(ans)

### FIXED CODE ###

import itertools
import numpy as np
import math

n, p = map(int, input().split())
if n != 1:
    table = [0] * (int(math.sqrt(p)) + 1)

    pl = []
    ans = 1

    for i in range(2, int(math.sqrt(p)) + 1):
        if table[i] == 0:
            pl.append(i)
            for j in range(i + i, int(math.sqrt(p)) + 1, i):
                table[j] = 1

    a = 0

    for i in range(len(pl)):
        q = p
        while q % pl[i] == 0:
            a += 1
            q = q / pl[i]
        ans = ans * (pl[i] ** (int(a//n)))
        a = 0
else:
    ans = p

print(ans)
N = int(input())
count = 0
for i in range(2, int(N ** 0.5 + 1)):
    div, rem = divmod(N, i)
    if not rem:
        count += 1
        N = div
print(count + (N > i))

### FIXED CODE ###

from itertools import accumulate
from bisect import bisect_right
def prime_factorize_dict(n):
    d = dict()
    while not n & 1:
        d[2] = d.get(2, 0) + 1
        n >>= 1
    f = 3
    while f * f <= n:
        if not n % f:
            d[f] = d.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        d[n] = d.get(n, 0) + 1
    return d

N = int(input())
l = list(prime_factorize_dict(N).values())
L = list(accumulate(range(10 ** 6)))
print(sum(bisect_right(L, item) - 1 for item in l))
S = input()
K = int(input())

inner_difference = 0
  
if len(set(list(S))) == 1:
  print(K*len(S)//2)
else:
  i = 0
  while i < len(S)-1:
    if S[i] == S[i+1]:
      inner_difference += 1
      i += 1
    i += 1

  if (S[0] != S[-1])or(S[0]==S[1])or(S[N-1]==S[N-2]):
    print(inner_difference*K)
  else:
    print(inner_difference*K + K-1)

### FIXED CODE ###

S = input()
K = int(input())
 
INNER = 0
  
if len(set(list(S))) == 1:
  print(K*len(S)//2)
else: 
  i = 0
  while i < len(S)-1:
    if S[i] == S[i+1]:
      INNER += 1
      i += 1
    i += 1
  
  if (S[0] != S[-1]):#最初の文字と最後の文字が違うなら、
    print(INNER*K)
  else:
    same_from_start = 0
    same_from_end = 0
    
    count_from_start = 0
    count_from_end = 0
    
    flag_same_from_start = 0
    flag_same_from_end = 0
    
    while flag_same_from_start == 0:
      if S[count_from_start] == S[count_from_start+1]:
        count_from_start += 1
      else:
        count_from_start += 1
        flag_same_from_start = 1
    
    while flag_same_from_end == 0:
      if S[len(S)-count_from_end-1] == S[len(S)-count_from_end-2]:
        count_from_end += 1
      else:
        count_from_end += 1
        flag_same_from_end = 1
    print(INNER*K + (K -1) * ((count_from_start+count_from_end)//2 -\
                              count_from_start//2- count_from_end//2))
n,m=map(int,input().split())
a_s=[]
b_s=[]
for i in range(m):
  a,b=map(int,input().split())
  a_s.append(a)
  b_s.append(b)

for i in range(1,N+1):
  print(a_s.count(i)+b_s.count(i))

### FIXED CODE ###

n,m=map(int,input().split())
a_s=[]
b_s=[]
for i in range(m):
  a,b=map(int,input().split())
  a_s.append(a)
  b_s.append(b)

for i in range(1,n+1):
  print(a_s.count(i)+b_s.count(i))
import sys
input=sys.stdin.readline  #危険！基本オフにしろ！

def BELLMANFORD(point,n,d,p):
    cost       = [-float("inf")]*(n+1)  #infじゃないと閉路検出がうまくいかない
    cost[point]= 0
    for i in range(n-1):                                  #経路の長さは最大n-1であるため
        for nownode,nextnode,c in d:
            if cost[nextnode]<cost[nownode]+c-p:
                cost[nextnode]=cost[nownode]+c-p

    negative=[0]*(n+1)                                        #負閉路の長さは最大nであるため
    
    for i in range(n):                  #閉路判定 negativeの1は閉路に入っている部分を表す
        for nownode,nextnode,c in d:
            if negative[nownode]==1:
                negative[nextnode]=1
            if cost[nextnode]<cost[nownode]+c-p:
                cost[nextnode]=cost[nownode]+c-p
                negative[now]=1
 
    return cost,negative

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

    d=[tuple(map(int,input().split()))for i in [0]*m]
    
    x,y=(BELLMANFORD(1,n,d,p))
    
    if y[n]==1:
        print(-1)
    else:
        print(max(x[n],0))

    
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input=sys.stdin.readline  #危険！基本オフにしろ！


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

d={}
for s in range(m):
    a,b,c=map(int,input().split())
    if a in d:
        d[a].append((b,c))
    else:
        d[a]=[(b,c)]

#print(d)


def BELLMANFORD(point,d,p):
    cost       = [-float("inf") for node in range(n+1)]  #infじゃないと閉路検出がうまくいかない
    cost[point]= 0
    for i in range(n-1):                                  #経路の長さは最大n-1であるため
        for now,lis in d.items():
            for nex,c in lis:
                if cost[nex]<cost[now]+c-p:
                    cost[nex]=cost[now]+c-p

    negative=[0]*n                                        #負閉路の長さは最大nであるため
    
    for i in range(n):                  #閉路判定 negativeの1は閉路に入っている部分を表す
        for now,lis in d.items():
            for nex,c in lis:
                if negative[now-1]==1:
                    negative[nex-1]=1
                if cost[nex]<cost[now]+c-p:
                    cost[nex]=cost[now]+c-p
                    negative[now-1]=1
 
    return cost,negative

def main():
    x,y=(BELLMANFORD(1,d,p))
    
    if y[n-1]==1:
        print(-1)
    else:
        print(max(x[n],0))

    
if __name__ == '__main__':
    main()
N = int(input())
s = str(input())
red = 0
blue = 0
if "R" in s:
    red += 1
elif "B" in s:
    blue += 1

if red > blue:
    print("Yes")
elif red == blue or red < blue:
    print("No")


### FIXED CODE ###

A,B,C = map(int, input().split())
if A == B == C:
    print("Yes")
else:
    print("No")
N, M = [int(k) for k in input().split()]
nodes = {k:set() for k in range(1,N+1)}
visited = [False for i in range(N+1)]

for i in range(M):
  a, b = [int(k) for k in input().split()]
  nodes[a].add(b)
  nodes[b].add(a)
  
def dfs(i):
  visited[i] = True
  cnt = 1
  for j in nodes[i]:
    if not visited[j]:
      cnt += dfs(j)
      
  return cnt
  

   
ans = -1
if M == 0:
  ans = N
else:
  for i in nodes:
    if not visited[i]:
      ans = max(dfs(i),ans)

print(ans)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]    
      
def program():
  N, M = map(int, input().split())
  uf = UnionFind(N)
  for i in range(M):
    a, b = map(int, input().split())
    uf.union(a-1,b-1)
  
  ans = max([uf.size(i) for i in range(N)])
  return ans

print(program())
import numpy as np

def main():
    inputs = [input() for _ in range(2)]
    numbers = np.array([float(i) for i in inputs[1].split('\s')])
    numbers = np.reciprocal(numbers)
    answer = 1 / sum(numbers)
    print(answer)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import numpy as np

def main():
    inputs = [input() for _ in range(2)]
    numbers = np.array([float(i) for i in inputs[1].split(' ')])
    numbers = np.reciprocal(numbers)
    answer = 1 / sum(numbers)
    print(answer)

if __name__ == '__main__':
    main()
s=input()
k=int(input())
cnt=0
tmp=1
for i in range(1,len(s)):
    if s[i]==s[i-1]:
        tmp+=1
    else:
        cnt+=tmp//2
        tmp=1
cnt+=tmp//2
if s[0]!=s[1] and s[-1]!=s[-2] and s[0]==s[-1]:
    cnt+=1

print(cnt*k)

### FIXED CODE ###

s = list(input())
k = int(input())
n=len(s)
if n!=1:
    cnt=[]
    tmp=1
    for i in range(1,n):
        if s[i]==s[i-1]:
            tmp+=1
        else:
            cnt.append((s[i-1], tmp))
            tmp=1
        if i==n-1:
            cnt.append((s[i], tmp))

    ans=0
    if len(cnt)==1:
        ans=cnt[0][1]*k//2
    elif cnt[0][0]!=cnt[-1][0]:
        for x,y in cnt:
            ans+=y//2
        ans*=k
    else:
        for x,y in cnt:
            ans+=y//2
        ans*=k
        if (cnt[0][1]+cnt[-1][1])%2==0:
            ans+=k-1
    print(ans)

else:
    print(k//2)
h, a = map(int, input().split)

if h%a == 0:
  print((int))h/a))
else:
  print((int)(h/a)+1)

### FIXED CODE ###

h, a = map(int, input().split())

if h%a == 0:
  print((int)(h/a))
else:
  print((int)(h/a)+1)
H, W, K = map(int,input().split())
dp = [[0]*W for _ in range(H+1)]
dp[0][0] = 1

ck = [0]*9
ck[0] = 1
for i in range(1,9):
  for j in range(2**(i-1)):
    for k in range(i-1):
      if (j>>k)&(j>>(k+1))==True:
        break
    else:
      ck[i] += 1
print(ck)

mod = 10**9+7
for i in range(1,H+1):
  for j in range(W):
    if j == 0:
      dp[i][j] = dp[i-1][j]*ck[W-2]+dp[i-1][j+1]*ck[W-3]
    elif j == W-1:
      dp[i][j] = dp[i-1][j]*ck[W-2]+dp[i-1][j-1]*ck[W-3] 
    else:
      dp[i][j] = dp[i-1][j+1]*(ck[j-1]+ck[W-j-3])+dp[i-1][j]*(ck[j-1]+ck[W-2-j])+dp[i-1][j-1]*(ck[max(0,j-2)]-1+ck[W-j-2])

print(dp[H][K-1]%mod)

### FIXED CODE ###

H, W, K = map(int,input().split())
dp = [[0]*W for _ in range(H+1)]
dp[0][0] = 1

ck = [0]*9
ck[0] = 1
for i in range(1,9):
  for j in range(2**(i-1)):
    for k in range(i-1):
      if (j>>k)&(j>>(k+1))==True:
        break
    else:
      ck[i] += 1

mod = 10**9+7
for i in range(1,H+1):
  for j in range(W):
    if (j == 0)&(j == W-1):
      dp[i][j] = dp[i-1][j]*(ck[j]*ck[W-1-j])
    elif j == 0:
      dp[i][j] = dp[i-1][j+1]*(ck[j]*ck[W-j-2])+dp[i-1][j]*(ck[j]*ck[W-1-j])
    elif j == W-1:
      dp[i][j] = dp[i-1][j]*(ck[j]*ck[W-1-j])+dp[i-1][j-1]*(ck[j-1]*ck[W-j-1])
    else:
      dp[i][j] = dp[i-1][j+1]*(ck[j]*ck[W-j-2])+dp[i-1][j]*(ck[j]*ck[W-1-j])+dp[i-1][j-1]*(ck[j-1]*ck[W-j-1])

print(dp[H][K-1]%mod)
import sys

sys.setrecursionlimit(100000)

def input_from_console():
    n = int(input().strip())
    h_list = list(map(int, input().split()))
    return n, h_list


def solve(n, h_list):
    dp = [-1] * (n+2)
    dp[0] = 0
    dp[1] = abs(h_list[1]- h_list[0])
    def dp_solve(i):
        if dp[i] != -1:
            return dp[i]
        dp[i] = min(
            dp_solve(i-1) + abs(h_list[i] - h_list[i-1]),
            dp_solve(i-2) + abs(h_list[i] - h_list[i-2]),
        )
        return dp[i]
    return dp_solve(n-1)


def main():
    n, h_list = input_from_console()
    print(solve(n, h_list))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()


### FIXED CODE ###

import sys

sys.setrecursionlimit(1000000)

def input_from_console():
    n = int(input().strip())
    h_list = list(map(int, input().split()))
    return n, h_list


def solve(n, h_list):
    dp = [-1] * (n+2)
    dp[0] = 0
    dp[1] = abs(h_list[1]- h_list[0])
    def dp_solve(i):
        if dp[i] != -1:
            return dp[i]
        dp[i] = min(
            dp_solve(i-1) + abs(h_list[i] - h_list[i-1]),
            dp_solve(i-2) + abs(h_list[i] - h_list[i-2]),
        )
        return dp[i]
    return dp_solve(n-1)


def main():
    n, h_list = input_from_console()
    print(solve(n, h_list))


if __name__ == "__main__":
    import sys

    if sys.gettrace():  # Check if the python interpreter is in debug mode or not.
        check_cases()
    else:
        main()