Harryxun/stf_run huggingface dataset:
N = input()
input = input()
hights = [int(h) for h in input.split()]

print(hights)

eval = []

def chmin(a,b):
    if a > b:
        b = a
        return True
    return False

for i in range(N):
    if i == N:
        break
    elif i == 0:
        eval.append(0)
        continue
    elif i == 1:
        eval.append(abs(hights[i] - hights[i-1] ))
        continue

    to_next = abs(hights[i] - hights[i-1]) + eval[i-1]
    prev_to_next = abs(hights[i] - hights[i-2]) + eval[i-2]
    if prev_to_next > to_next:
        eval.append(to_next)
    else:
        eval.append(prev_to_next)
print(eval)
print(eval[N-1])

### FIXED CODE ###

N = int(input())

hights = [int(h) for h in input().split()]


eval = []

def chmin(a,b):
    if a > b:
        b = a
        return True
    return False

for i in range(N):
    if i == N:
        break
    elif i == 0:
        eval.append(0)
        continue
    elif i == 1:
        eval.append(abs(hights[i] - hights[i-1] ))
        continue

    to_next = abs(hights[i] - hights[i-1]) + eval[i-1]
    prev_to_next = abs(hights[i] - hights[i-2]) + eval[i-2]
    if prev_to_next > to_next:
        eval.append(to_next)
    else:
        eval.append(prev_to_next)
print(eval[N-1])
num = raw_input()
a = int(num[0])
b = int(num[2])

print a*b, (a+b)*2

### FIXED CODE ###

num = raw_input()

list = num.split(" ")

a = int(list[0])
b = int(list[1])

print a*b, (a+b)*2
import copy
n = int(input())
t = list(map(int, input().split()))
m = int(input())
c = []
for i in range(m):
	p, x = map(int, input().split())
	c = []
	c = copy.copy(t)
	c[p-1] = x
	print (sum(c))

### FIXED CODE ###

a, op, b = map(str, input().split())
if op == "+":
	print (int(a) + int(b))
else:
	print (int(a) - int(b))
L, R, D = map(int, input().split())
ANS = 0
if L % d == 0:
  ANS = 1

ANS += (R-L)//d
print(ANS)
  

### FIXED CODE ###

L, R, D = map(int, input().split())
ANS = 0
if L % D == 0:
  ANS = 1
elif R % D == 0:
  ANS += 1
 
ANS += (R-L)//D
print(ANS)
A = int(input())
B = int(input())
C = A + B 
if C >= 24:
    C -= 24
print(C)


### FIXED CODE ###

AB = input()
if len(AB) <= 2:
    ABL = [AB]
else:
    ABL= AB.replace("\n", " ").split(" ")



A = int(ABL[0])
if len(AB) <= 2:
    C = A
else:
    B = ABL[1]
    C = int(A) + int(B )
    
if C >= 24:
    C -= 24
print(C)
import sys
s=[]
dic={"A":["11","11"],"B":["1","1","1","1"],"C":["1111"],"D":["01","11","10"],
		"E":["110","011"],"F":["10","11","01"],"G":["011","110"]}
cnt=0
for line in sys.stdin:
	if line=="\n" or line=="":
		continue
	cnt+=1
	if cnt<8:
		s.append(line.rstrip('\n'))
	else:
		cnt=0
		while s[0]=="00000000":
			del s[0]
		while s[len(s)-1]=="00000000":
			del s[len(s)-1]
		i=0
		while i<len(s[0]):
			for l in s:
				if l[i]=="1":
					break
			else:
				for l in range(len(s)):
					s[l]=s[l][0:i]+s[l][i+1:len(s[l])]
				i-=1
			i+=1
		for d in dic.keys():
			if dic[d]==s:
				print d
				break
		while len(s)>0:
			del(s[0])

### FIXED CODE ###

import sys
dic={"A":["11","11"],"B":["1","1","1","1"],"C":["1111"],"D":["01","11","10"],
		"E":["110","011"],"F":["10","11","01"],"G":["011","110"]}
s=[]
linecnt=0
for line in sys.stdin:
	if line=="\n" or line=="":
		continue
	linecnt+=1
	if linecnt<8:
		s.append(line.rstrip("\n"))
	else:
		s.append(line.rstrip("\n"))
		while s[0]=="00000000":
			del(s[0])
		while s[len(s)-1]=="00000000":
			del(s[len(s)-1])
		i=len(s[0])-1
		while i>=0:
			for l in xrange(len(s)):
				if s[l][i]=="1":
					break
			else:
				for l in xrange(len(s)):
					s[l]=s[l][0:i]+s[l][i+1:len(s[l])]
			i-=1
		for d in dic.keys():
			if dic[d]==s:
				print d
				break
		while len(s)>0:
			del(s[0])
		linecnt=0
import math
A, B, C, D = map(int, input().split())

ans = 0

c_n_min = math.ceil(A / C)
c_n_max = math.floor(B / C)
c_n = c_n_max - c_n_min + 1

d_n_min = math.ceil(A / D)
d_n_max = math.floor(B / D)
d_n = d_n_max - d_n_min + 1

cd = C * D /math.gcd(C,D)
cd_n_min = math.ceil(A / cd)
cd_n_max = math.floor(B / cd)
cd_n = cd_n_max - cd_n_min + 1

ans = (B - A + 1) - (c_n + d_n - cd_n)
print(ans)


### FIXED CODE ###

import math
import fractions
A, B, C, D = map(int, input().split())

ans = 0


c_n = (B // C) - ((A - 1) // C)
d_n = (B // D) - ((A - 1) // D)
cd = C * D // fractions.gcd(C,D)
cd_n = (B // cd) - ((A - 1) // cd)

ans = (B - A + 1) - (c_n + d_n - cd_n)
print(ans)
cache = []

def fib(x):
	if x in cache:
		return cache[x]
	elif x == 0 or x == 1:
		return 1
	else:
		v = fib(x - 1) + fib(x - 2)
		cache[x] = v
		return v

x = input()
print fib(x)

### FIXED CODE ###

cache = {}
def fib(x):
	if x in cache:
		return cache[x]
	elif x == 0 or x == 1:
		return 1
	else:
		v = fib(x - 1) + fib(x - 2)
		cache[x] = v
		return v

x = input()
print fib(x)
a,b=map(int,input().split())
if a%2=1 and b%2=1:
    print('Odd')
else:
    print('Even')

### FIXED CODE ###

a,b=map(int,input().split())
if (a%2==1) and (b%2==1):
    print('Odd')
else:
    print('Even')
N,M=[int(s) for s in input().split()]
if N==M:
  print(Yes)
else:
  print(No)

### FIXED CODE ###

N,M=[int(s) for s in input().split()]
if N==M:
  print('Yes')
else:
  print('No')
n = int(input())
if n == 1:
  p = int(input())
else:
  p = list(map(input().split()))
i = 1
cnt = 0
while i < len(p):
  if p[i] > p[i - 1] and p[i] < p[i + 1] :
    cnt += 1
  i += 1

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
i = 1
cnt = 0
while i < len(p) - 1:
  l = sorted([p[i - 1], p[i], p[i + 1]])
  if l[1] == p[i]:
    cnt += 1
  i += 1
print(cnt)
N = int(input())
2 ans = ''
3 while N > 0:
4 N -= 1
5 ans += chr(ord('a') + N % 26)
6 N //= 26
7 print(ans[::-1])

### FIXED CODE ###

N = int(input())
ans = ''
while N > 0:
  N -= 1
  ans += chr(ord('a') + N % 26)
  N //= 26
print(ans[::-1])
raw1 = input().split()
H = int(raw1[0])
W = int(raw1[1])

c = [0 for x in range(26)]

for i in range(H):
    raw = input()
    for j in range(W):
        c[ord(raw[j]) - 97] += 1

for i in range(len(c)):
    c[i] = c[i] % 4


if c.count(3) > 0 :
    print('No')
elif W%2 == 1 and H%2 == 1 and c.count(1) == 1 and c.count(2) == (H-1)/2 +(W-1)/2:
    print('Yes')
elif W%2 == 0 and H%2==0 and c.count(1)==0 and c.count(2) ==0:
    print('Yes')
elif W % 2 ==0 and  H % 2  == 1 and c.count(1) == 0 and c.count(2) == W/2:
    print('Yes')
elif W % 2 ==1 and  H % 2  == 0 and c.count(1) == 0 and c.count(2) == H/2:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

i = input()

if len(i) < 4:
    print('No')
elif i[:4] == 'YAKI':
    print('Yes')
else:
    print('No')
words = input()
lett = list(words)
numlist = []
for i in lett:
    num = lett.count(i)
    numlist += [num]
jud = []
for i in numlist:
    if i%2 == 0:
        jud += ['Yes']
    else:
        jud += ['No']

anslist = [x for x in set(jud) if jud.count(x) > 1]

ans = anslist[0]

print(ans)


### FIXED CODE ###

N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if N > K:
    print(K*X+(N-K)*Y)
else:
    print(N*X)
n, m = map(int, input.split())
a = list(map(int, input.split()))
final = sum(a)
if n > 0:
    print(n - a)
else:
    print(-1)
    

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
daytofinish = sum(A)
if N-daytofinish < 0:
    print(-1)
else:
    print(N-daytofinish)
N, K = map(int, input().split())
A = list(map(int, input().split()))

def minus(N, K,count):
    if N>K:
        N=N - (K - 1)
        count += 1
        return minus(N, K, count)
        
    elif N <= K:
        count += 1
        return count

print(minus(N,K,0))

### FIXED CODE ###

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

if N == K:
    print(1)
else:
    N = N - K
    count = 1
    while N>0:
        N -= K - 1
        count += 1
    print(count)
H*H=H
H*D=D
D*H=D
D*D=H
a,b=map(str,input().split())
print(a*b)

### FIXED CODE ###

a,b=map(str,input().split())
if a=="H":
  print(b)
else:
  if b=="H":
    print("D")
  else:
    print("H")
#!/usr/bin/env python3
n = int(input())
res = [(i, *input().split()) for i in range(n)]

res.sort(key=lambda x: (x[1], -int(x[2])))

for r in res:
    print(r[0] + 1)


### FIXED CODE ###

#!/usr/bin/env python3
n = int(input())
res = [[i] + input().split() for i in range(n)]

res.sort(key=lambda x: (x[1], -int(x[2])))

for r in res:
    print(r[0] + 1)
a = int(input())
b = int(input())
c = int(input())
d = int(input())

num_listx = []
num_listy = []

for num in range(b):
  if num >= a and <= b:
    num_listx.append(num)
for nums in range(d):
  if nums >= c and <= d:
    num_listy.append(nums)
    
print(max(num_listx) * max(num_listy))

### FIXED CODE ###

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

ans = max(a*c,a*d,b*c,b*d)

print(ans)
n,h=map(int,input().split())
l=[[map(int,input().split())] for _ in range(n)]
la=sorted(l,key=lambda x:x[0],reverse=True)
a=l[0][0]
lb=sorted(l,key=lambda x:x[1],reverse=True)
count=0
total=0
for i in lb:
    if i[1]>a:
        count+=1
        total+=i[1]
    else:
        break
print((h-total)//a+1+count

### FIXED CODE ###

N, H = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())

A = int(max(a))
B = [i for i in b if i > A]

B.sort(reverse=True)

Sum = 0

for i in range(len(B)):
    H -= B[i]
    Sum += 1
    if H <= 0:
        break

if H > 0:
    Sum += int((H-1)//A)+1


print(Sum)
import numpy as np

n = int(input())

n_list =np.arange(1,n+1)
# print(n_list)
ans = np.sum(n_list)- n_list[-1]
print(ans)

### FIXED CODE ###

n = int(input())
print(n*(n-1)//2)
N,M = map(int,input().split())
a = [0] * M
b = [0] * M
for i in range(M):
    a[i],b[i]= map(str, input().split())
s1=list()
s2=list()
p=0
w=0
for i in range(M) :
    if a[i] not in s2 and (b[i]=="WA"):
        s1 += a[i] 
    if a[i] not in s2 and (b[i]=="AC"):
        print(s2)
        p += 1 
        s2.append(a[i])
        w += int(s1.count(a[i]))
print(min(N,p),w)

### FIXED CODE ###

N,M = [int(x) for x in input().split()]
count = [0]*N
ac = 0
wa = 0
ireta = []
for i in range(M):
    a,b = input().split()
    a = int(a)
    if b == "AC" and count[a-1] == 0:
        count[a-1] = 1
        ac += 1
    elif count[a-1] == 0:
        ireta.append(a)
        wa += 1
for i in range(len(ireta)):
    if count[ireta[i]-1] == 0:
        wa -= 1
print(ac,wa)
i=1
x = int(input())
while x != 0 :
    print("Case {0}: {1}".format(i, x))
    x = int(input())
    i=i+


### FIXED CODE ###

import sys
 
i=1
for s in sys.stdin:
  n = int(s)
  if n == 0:
    break
  print("Case ",i,": ",n,sep="")
  i += 1
print x ** 3

### FIXED CODE ###

x = int(input())
print (x ** 3)
def count1(n):
    nx=bin(n)
    return nx.count('1')

N=int(input())
X=input()
for i in range(N):
    Ni2=X
    if X[i]=='0':
        Ni2=X[:i]+'1'+X[(i+1):] #文字列は変更できない
    else:
        Ni2=X[:i]+'0'+X[(i+1):]
    Ni=int(Ni2,2)
    ans=0
    #print(Ni)
    while Ni!=0:
        Ni=Ni%count1(Ni)
        ans+=1
    print(ans)


### FIXED CODE ###

L,R,d=map(int, input().split())
ans=R//d-(L-1)//d
print(ans)
from decimal import Decimal
import copy
n = int(input())
l = []
for i in range(n):
    a = str(input())
    if "." not in a:
        l.append(Decimal(a))
    else:
        dot = a.index(".")
        if len(a)-dot-1 <= 4:
            l.append(Decimal(a))
        else:
            flag = 1
            for j in range(dot+5,len(a)):
                if a[j] != "0":
                    flag = 0
            if flag: l.append(Decimal(a)) 
n = len(l)
a = [int(l[i]*10**4) for i in range(n)]
memo = [[0,0] for _ in range(n)]
for i in range(n):
    t = a[i]
    while t%2 == 0:
        t //= 2
        memo[i][0] += 1
    while t%5 == 0:
        t //= 5
        memo[i][1] += 1
a.sort()
memo.sort()
mem2 = [[0]*9 for _ in range(9)]
p = 0
for i in range(n):
    if memo[i][0] >= 8 and memo[i][1] >= 8:
        p += 1
    else:
        mem2[memo[i][0]][memo[i][1]] += 1
mems = copy.deepcopy(mem2)


for i in range(8,-1,-1):
    for j in range(7,-1,-1):
        mems[i][j] += mems[i][j+1]
for i in range(7,-1,-1):
    for j in range(8,-1,-1):
        mems[i][j] += mems[i+1][j]

s = 0
for i in range(9):
    for j in range(9):
        if i >= 4 and j >= 4:
            s += mem2[i][j] * (mems[8-i][8-j]-1)
        else:
            s += mem2[i][j] * mems[8-i][8-j]
s = s//2
s += p*(p-1)//2+p*(n-p)
print(s)

### FIXED CODE ###

import copy
n = int(input())
def point_shift(s,i):
    p = s.index(".")
    tale = len(s[p+1:])
    if tale <= i:
        return int(s[:p]+s[p+1:].ljust(i,"0"))
    else:
        return int(s[:p]+s[p+1:p+i+1])

a = []
for i in range(n):
    s = input()
    if "." not in s:
        a.append(int(s)*10**9)
    else:
        a.append(point_shift(s,9))

memo = [[0,0] for _ in range(n)]
for i in range(n):
    t = a[i]
    while t%2 == 0:
        t //= 2
        memo[i][0] += 1
    while t%5 == 0:
        t //= 5
        memo[i][1] += 1

l0 = [[0]*100 for _  in range(100)]
for i in range(n):
    l0[memo[i][0]][memo[i][1]] += 1

l1 = copy.deepcopy(l0)
for i in range(100):
    for j in range(98,-1,-1):
        l1[i][j] += l1[i][j+1]
for i in range(98,-1,-1):
    for j in range(100):
        l1[i][j] += l1[i+1][j]


ans = 0
for i in range(100):
    for j in range(100):
        x0,y0 = i,j
        x1,y1 = max(0,18-x0),max(0,18-y0)
        if x0 >= 9 and y0 >= 9:
            ans += l0[x0][y0]*(l1[x1][y1]-1)
        else:
            ans += l0[x0][y0]*l1[x1][y1]
print(ans//2)
3
500 300 200

### FIXED CODE ###

import heapq

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

heapq.heapify(v)
work = heapq.heappop(v)

for _ in range(n - 1):
    work += heapq.heappop(v)
    work /= 2

print(work)
import math
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm_list([28,40,35]))

### FIXED CODE ###

import copy
import fractions
import sys
n,m=map(int,input().split())
A=list(map(int,input().split()))
a=copy.copy(A[0])
c=0
while a%2==0:
  a=a//2
  c=c+1
d=2**c
for i in range(n):
  if A[i]//d!=float(A[i])/d or A[i]//(2*d)==float(A[i])/(2*d):
    print(0)
    sys.exit()
B=[]
for i in range(n):
  B.append(A[i]//2)
b=1
for i in range(n):
  b=b*B[i]//fractions.gcd(b,B[i])
  if b>m:
    print(0)
    sys.exit()
if b>m:
  print(0)
else:
  print(1+(m-b)//(2*b))
n = int(input()) 
t = list(map(int,input().strip().split()))[:n] 
m = int(input())
p=[]
x=[]
for _ in range(m):
    a,b = map(int,input().split())
    p.append(a)
    x.append(b)
s=sum(t)
for i in range(m):
    s-=t[p[i]-1]
    s+=x[p[i]-1]
    print(s)


### FIXED CODE ###

n = input()
a = map(int, raw_input().split())
s = sum(a)
m = input()
for i in xrange(m):
	p, x = map(int, raw_input().split())
	p -= 1
	print s - a[p] + x
N = int(input())

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

dis = True
count = 0
for i in range(0, N-1):
    if A[i] > A[i+1]:
        count += 1
        dis = False
        if count == 1:
            tmp1 = i
        elif count == 2:
            tmp2 = i+1

if dis == False:
    tmp = A[tmp1]
    A[tmp1] = A[tmp2]
    A[tmp2] = tmp

    count = 0
    for i in range(0, N - 1):
        if A[i] > A[i + 1]:
            count += 1
            dis = False
            if count == 1:
                tmp1 = i
            elif count == 2:
                tmp2 = i + 1
    if count == 0:
        dis = True

if dis == True:
    print('YES')
else:
    print('NO')


### FIXED CODE ###


N = int(input())

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

dis = True
count = 0
for i in range(0, N-1):
    if A[i] > A[i+1]:
        count += 1
        dis = False
        if count == 1:
            tmp1 = i
        elif count == 2:
            tmp2 = i+1

if dis == False and count > 1:
    tmp = A[tmp1]
    A[tmp1] = A[tmp2]
    A[tmp2] = tmp

    count = 0
    for i in range(0, N-1):
        if A[i] > A[i + 1]:
            count += 1
            dis = False
            if count == 1:
                tmp1 = i
            elif count == 2:
                tmp2 = i + 1
    if count == 0:
        dis = True

if dis == True:
    print('YES')
else:
    print('NO')
N = int(input())
name_list = [input() for name in range(N)]
char_list = ['M', 'A', 'R', 'C', 'H']
count_list = [0 for _ in range(N)]

flag = False

for name in name_list:
    if name[0] in char_list:
        count_list[char_list.index(name[0])] += 1
score=0
for x in range(5):
    for y in range(x+1,5):
        for z in range(y+1,5):
            try:
                score+=count_list[x]*count_list[y]*count_list[z]
            except:
                print("0")
                exit()



print(score)


### FIXED CODE ###

N = int(input())
name_list = [input() for name in range(N)]
char_list = ['M', 'A', 'R', 'C', 'H']
count_list = [0 for _ in range(len(char_list))]

flag = False

for name in name_list:
    if name[0] in char_list:
        count_list[char_list.index(name[0])] += 1
score = 0
for x in range(5):
    for y in range(x + 1, 5):
        for z in range(y + 1, 5):
            score += count_list[x] * count_list[y] * count_list[z]

print(score)
x  = (list(map(int,input().split()))
x = sum(x)
ans = 15-x
print(ans)

### FIXED CODE ###

x  = (list(map(int,input().split())))
x = sum(x)
ans = 15-x
print(ans)
b = input()
if b == "A":
  print("C")
elif b == "C":
  print("A"):
elif b == "T":
  print("G"):
elif b == "G":
  print("T"):



### FIXED CODE ###

b = input()
if b == "A":
  print("T")
elif b == "C":
  print("G")
elif b == "T":
  print("A")
elif b == "G":
  print("C")
h, w = map(int, input().split())
s = [input() for i in range(h)]
t = [[None] * w for i in range(h)]
d = [(1, 0), (0, 1), (-1, 0), (0, -1)]
def dfs(i, j, bw):
    global h, w
    if not (0 <= i < h and 0 <= j < w) or s[i][j] == bw or t[i][j]:
        return 0, 0
    t[i][j] = True
    W, b = 0, 0
    if s[i][j] == "#":
        b += 1
    else:
        W += 1
    for k in d:
        n, m = dfs(i + k[0], j + k[1], s[i][j])
        W += n
        b += m
    return W, b
ans = 0
for i in range(h):
    for j in range(w):
        X, Y = dfs(i, j, "u shi ta pu ni chi a ku n wara")
        ans += X * Y
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)
h, w = map(int, input().split())
s = [input() for i in range(h)]
t = [[None] * w for i in range(h)]
d = [(1, 0), (0, 1), (-1, 0), (0, -1)]
def dfs(i, j, bw):
    global h, w
    if not (0 <= i < h and 0 <= j < w) or s[i][j] == bw or t[i][j]:
        return 0, 0
    t[i][j] = True
    W, b = 0, 0
    if s[i][j] == "#":
        b += 1
    else:
        W += 1
    for k in d:
        n, m = dfs(i + k[0], j + k[1], s[i][j])
        W += n
        b += m
    return W, b
ans = 0
for i in range(h):
    for j in range(w):
        X, Y = dfs(i, j, "u shi ta pu ni chi a ku n wara")
        ans += X * Y
print(ans)
N,L = map(int,input().split())
    eat = N - 1
    for m in range(N):
        if abs(L + m) < abs(L + eat):
            eat = m
aj = N*(N-1)//2
pie = (N-1)*L + aj - eat
print(pie)


### FIXED CODE ###

N,L = map(int,input().split())
if L >=0:
    eat = 0
else:
    eat = N - 1
    for m in range(N):
        if abs(L + m) < abs(L + eat):
            eat = m
aj = N*(N-1)//2
pie = (N-1)*L + aj - eat
print(pie)
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, K = mapint()

def segfunc(x, y):
    return max(x, y)

ide_ele = -1

class SegTree:
    """
    init(init_val, ide_ele): 配列init_valで初期化 O(N)
    update(k, x): k番目の値をxに更新 O(logN)
    query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
    """
    def __init__(self, init_val, segfunc, ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        res = self.ide_ele

        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

seg = SegTree([0]*N, segfunc, ide_ele)
for _ in range(N):
    a = int(input())
    maxi = seg.query(max(0, a-K-1), min(N, a+K))
    seg.update(a-1, maxi+1)
print(seg.query(0, N))

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, K = mapint()

def segfunc(x, y):
    return max(x, y)

ide_ele = 0

class SegTree:
    """
    init(init_val, ide_ele): 配列init_valで初期化 O(N)
    update(k, x): k番目の値をxに更新 O(logN)
    query(l, r): 区間[l, r)をsegfuncしたものを返す O(logN)
    """
    def __init__(self, init_val, segfunc, ide_ele):
        n = len(init_val)
        self.segfunc = segfunc
        self.ide_ele = ide_ele
        self.num = 1 << (n - 1).bit_length()
        self.tree = [ide_ele] * 2 * self.num
        for i in range(n):
            self.tree[self.num + i] = init_val[i]
        for i in range(self.num - 1, 0, -1):
            self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

    def update(self, k, x):
        k += self.num
        self.tree[k] = x
        while k > 1:
            self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
            k >>= 1

    def query(self, l, r):
        res = self.ide_ele

        l += self.num
        r += self.num
        while l < r:
            if l & 1:
                res = self.segfunc(res, self.tree[l])
                l += 1
            if r & 1:
                res = self.segfunc(res, self.tree[r - 1])
            l >>= 1
            r >>= 1
        return res

size = 10**5*3+10
seg = SegTree([0]*size, segfunc, ide_ele)
for _ in range(N):
    a = int(input())
    maxi = seg.query(max(0, a-K), min(size, a+K+1))
    seg.update(a, maxi+1)
print(seg.query(0, size))
from math import log2

N, K = map(int, input().split())
A = [int(s) for s in input().split()]


def cntbit(bit):
    cnt = 0
    for a in A:
        if a & bit:
            cnt += 1
    return cnt


def getans(bink):
    if len(bink) == 1:
        if bink == "0":
            return cntbit(1)
        else:
            return N - cntbit(1)

    ans = 0
    bit = 1 << (len(bink) - 1)
    if bink[0] == "0":
        return bit * cntbit(bit) + getans(bink[1:])
    else:
        ans1 = bit * (N - cntbit(bit)) + getans(bink[1:])
        ans2 = 0
        ans2 += bit * cntbit(bit)
        for i in range(len(bink) - 1):
            bit = 1 << i
            cnt = cntbit(bit)
            ans2 += bit * max(cnt, N - cnt)
        return max(ans1, ans2)


bink = bin(K)[2:]
bink = "0" * (40 - len(bink)) + bink
print(getans(bink))


### FIXED CODE ###

N, K = map(int, input().split())
A = [int(s) for s in input().split()]


def cntbit(bit):
    cnt = 0
    for a in A:
        if a & bit:
            cnt += 1
    return cnt


def getans(bink):
    if len(bink) == 1:
        if bink == "0":
            return cntbit(1)
        else:
            return N - cntbit(1)

    ans = 0
    bit = 1 << (len(bink) - 1)
    if bink[0] == "0":
        return bit * cntbit(bit) + getans(bink[1:])
    else:
        ans1 = bit * (N - cntbit(bit)) + getans(bink[1:])
        ans2 = 0
        ans2 += bit * cntbit(bit)
        for i in range(len(bink) - 1):
            bit = 1 << i
            cnt = cntbit(bit)
            ans2 += bit * max(cnt, N - cnt)
        return max(ans1, ans2)


bink = bin(K)[2:]
bink = "0" * (40 - len(bink)) + bink
print(getans(bink))
N,M=map(int,input())

ans=1900M+100(N-M)*2^M
print(ans)

### FIXED CODE ###

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

ans=(1900*M+100*(N-M))*(2**M)
print(ans)