Harryxun/stf_run huggingface dataset:
a,b=map(int,input().split())
if a<=b<0:
  if 
  print('Negative' if (-1)**(a-b-1)==-1 else 'Positive')
elif a<=0<=b:
  print('Zero')
else:
  print('Positive')

### FIXED CODE ###

a,b=map(int,input().split())
if a<=b<0:
  print('Negative' if (-1)**(a-b-1)==-1 else 'Positive')
elif a<=0<=b:
  print('Zero')
else:
  print('Positive')
import fractions,sys

n,m=map(int,input().split())
a = list(map(int, input().split()))
# ans = a[0]
# for i in range(1,n):
#     ans = ans * a[i] // fractions.gcd(ans, a[i])
 
 
b = [int(i/2) for i in a]
b_list=[i%4==0 for i in b]
bb=sum(b_list)
if bb!=0 and bb!=n:
    print(0)
    exit()

ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // fractions.gcd(ans2, b[i])

tf=[(ans2/i)%2==0 for i in b]
if ans2>m and any(tf):
    print(0)
else:
    print((m-ans2)//(ans2*2)+1)

### FIXED CODE ###

import fractions,sys

n,m=map(int,input().split())
a = list(map(int, input().split()))
# ans = a[0]
# for i in range(1,n):
#     ans = ans * a[i] // fractions.gcd(ans, a[i])
ff=[]
for j in  a:
    count=0
    for i in range(1,36):
        if j%(2**i)==0:
            count+=1
    ff.append(count)
ff=[i==ff[0] for i in ff]

 
b = [int(i/2) for i in a]
# b_list=[i%4==0 for i in b]
# bb=sum(b_list)
# if bb!=0 and bb!=n:
if all(ff)==False:
    print(0)
    exit()

ans2= b[0]
for i in range(1,n):
    ans2 = ans2 * b[i] // fractions.gcd(ans2, b[i])

# tf=[(ans2/i)%2==0 for i in b]
# and any(tf)
if ans2>m:
    print(0)
else:
    print((m-ans2)//(ans2*2)+1)
n,d = input()

count = 0
for i in range(n):
  x,y = input()
  
  r = (int(x)**2+int(y)**2)**(1/2)
  
  if r <= int(d):
    count += 1
print(count)

### FIXED CODE ###

n,d = input().split(" ")

count = 0
for i in range(int(n)):
  x,y = input().split(" ")
  
  r = (int(x)**2+int(y)**2)**(1/2)
  
  if r <= int(d):
    count += 1
print(count)
while True:
    try:
        h = 0
        a=["","","",""]
        for i in range(8):
            tmp = raw_input()
            if int(tmp) != 0:
            a[h] = tmp
            h += 1
    	if h == 1:
            print "C"
        elif h == 2:
            c = a[0].index("1") - a[1].index("1")
            if c == 0:
                print "A"
            elif c == -1:
                print "E"
            else:
                print "G"
        elif h == 3:
            c = a[0].index("1") - a[2].index("1")
            print "D" if c == 1 else "F"
        else:
            print "B"
    	raw_input()
    except:
	break

### FIXED CODE ###

while True:
    try:
        h = 0
        a=["","","",""]
        for i in range(8):
            tmp = raw_input()
            if int(tmp) != 0:
                a[h] = tmp
                h += 1
    	if h == 1:
            print "C"
        elif h == 2:
            c = a[0].index("1") - a[1].index("1")
            if c == 0:
                print "A"
            elif c == -1:
                print "E"
            else:
                print "G"
        elif h == 3:
            c = a[0].index("1") - a[2].index("1")
            print "D" if c == 1 else "F"
        else:
            print "B"
    	raw_input()
    except:
	break
x,y=map(str,input().split().strip())
d={}
d["A"]=1
d["B"]=2
d["C"]=3
d["D"]=4
d["E"]=5
d["F"]=6
xn=int(d[x])
yn=int(d[n])

if xn > yn:
  print(">")
elif xn < yn:
  print("<")
else:
  print("=")

### FIXED CODE ###

x,y=map(str,input().strip().split())
d={}
d["A"]=1
d["B"]=2
d["C"]=3
d["D"]=4
d["E"]=5
d["F"]=6
xn=int(d[x])
yn=int(d[y])

if xn > yn:
  print(">")
elif xn < yn:
  print("<")
else:
  print("=")
x, y = map(int, input().split())
for i in range(x+1):
  if((i*2 + (x-i)*4) == y) or ((i*4 +(x-i)*2) == y):
    print("Yes")
	break
  else:
	print("No")
	break

### FIXED CODE ###

x, y = map(int, input().split())
res = 'No'
for i in range(x+1):
  k = x-i
  if(i*2 + k*4) == y:
    res = 'Yes'
print(res)
n=int(input())
A = [int(x) for x in input().split()]
list=[]*(n+2)

for i in range(n-1):
  list[A[i]]+=1
for i in range(n+1):
  print(list[i])

### FIXED CODE ###

n=int(input())
A = list(map(int, input().split()))
list=[0]*(n+2)

for i in range(n-1):
  list[A[i]]+=1
for i in range(1,n+1):
  print(list[i])
a, b = map(int, input().split())
if a == b:
	Print('Yes')
else:
	Print('No')

### FIXED CODE ###

a, b = map(int, input().split())
if a == b:
	print('Yes')
else:
	print('No')
n, x, t = map(int, input().plist())
if n%x==0:
  print(n*t/x)
else:
  print(((math.floot(n/x))+1)*t)

### FIXED CODE ###

n, x, t = map(int, input().split())
if n%x==0:
  print((n//x)*t)
else:
  print( ((n//x)+1)*t )
n,k = map(int,input().split())
a_li = list(map(int,input().split()))
 
for i in range(k,n):
    if a_li[i-k] < a_li[i]:
        print("Yes")
    else:
        print("No")
n,k = map(int,input().split())
a_li = list(map(int,input().split()))

for i in range(k,n):
    if a_li[i-k] < a_li[i]:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

n,k = map(int,input().split())
a_li = list(map(int,input().split()))
 
for i in range(k,n):
    if a_li[i-k] < a_li[i]:
        print("Yes")
    else:
        print("No")
l = sorted(map(int, input().split()))
if ''.join(l) == '1479':
    print('YES')
else:
    print('NO')

### FIXED CODE ###

l = sorted(input().split())
if ''.join(l) == '1479':
    print('YES')
else:
    print('NO')
x, n = map(int, input().split())
lst = [int(input()) for _ in range(n)]
a = 100
b = ''

for i in range(1, 102):
  if i in lst:
    continue

  if a > abs(x-i):
    a = abs(x-i)
    b = i

print(i)

### FIXED CODE ###

x, n = map(int, input().split())
lst = []
if n > 0:
  lst = list(map(int, input().split()))
a = 100
b = 0

for i in range(0, 102):
  if i in lst:
    continue

  if a > abs(x-i):
    a = abs(x-i)
    b = i

print(b)
a=int(input())
b=list(input())
c=0
for i in range(a):
  if b[i]="A":
    if b[i+1]="B":
    else:
      pass
      if b[i+2]="C":
        c+=1
      else:
        pass
else:
  pass
print(c)


### FIXED CODE ###

n=int(input())
s=list(input())
d=0
for i in range(n):
  if n-(i+1)>=2:
    if s[i]=='A' and s[i+1]=='B' and s[i+2]=='C':
      d+=1
  else:
    pass
print(d)
import numpy as np

list1=[]

try:
    list1=list(map(int, input().split()))
except:
    quit();

N=list1[0]
W=list1[1]

inp=[]

for _ in range(N):
    try:
        inp.append(list(map(int, input().split())))
    except:
        quit();

inp=np.array(inp)
inp=inp.T
wlist=inp[0]
vlist=inp[1]

dp=np.zeros((N+1,W+1))

for i in range(N+1):
    if i >= 1:
        for j in range(W+1):
            if wlist[i-1] > j:
                dp[i][j]=dp[i-1][j]
            else:
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-wlist[i-1]]+vlist[i-1])

print(int(dp[N][W]))


### FIXED CODE ###

N=int(input())

try:
    h = list(input().split())
    #listA<-[1,2,2,3,1]
    #print(listA)
    #ここに逐次処理を書けばいいと思う。
except:
    quit();
    #または、quit(),os.exit()をして止める。

dp=[]

for i in range(N):
    dp.append(0)

dp[1]=abs(int(h[0])-int(h[1]))

for j in range(2,N):
    min=float('inf')
    for i in range(j-2,j):
        num=abs(int(h[i])-int(h[j])) + dp[i]
        if num < min:
            min=num
    dp[j]=min

print(dp[N-1])
n = int(input())

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

c = 0

for i in range(n):
  if a[i] == 'A' and a[i+1] == 'B' and a[i+2] == 'C':
    c +=1
  else:
    continue
    
print(c)

### FIXED CODE ###

n = int(input())

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

c = 0

for i in range(n-2):
  if a[i] == 'A' and a[i+1] == 'B' and a[i+2] == 'C':
    c +=1
  else:
    continue
    
print(c)
num = [0,0,0]
num[0] = int(input())
num[1] = int(input())
num[2] = int(input())

num.sort().reverse()

print(int(str(num[0]) + str(num[1])) + num[2])

### FIXED CODE ###

s = input()

num = list(s)

num.sort()
num.reverse()

print(int(num[0] + num[1]) + int(num[2]))
import math
N, D = map(int, input().split())

print(math.ceil(N/(2*D+1))

### FIXED CODE ###

import math
N,D = map(int, input().split())
print(math.ceil(N/(2*D+1)))
n = int(input())
alist = list(map(int,input().split()))
dic = {}
for i in range(n):
    if alist[i] not in dic:
        dic[alist[i]] = 0
    dic[alist[i]] += 1
k = 0
while n-k-1 >= 2:
    p = n-k-1
    if p == 0:
        if dic[p] != 1:
            print(0)
            exit()
    else:
        if dic[p] != 2:
            print(0)
            exit()
    k += 2
else:
    print(2**(n//2))


### FIXED CODE ###

n = int(input())
cnts = [0]*n
alist = list(map(int,input().split()))
mod = 10**9+7

for i in range(n):
    cnts[alist[i]] += 1

p = n%2
if p == 1:
    cnts[0] += 1

for i in range(n):
    if p != (i%2):
        if cnts[i] != 2:
            print(0)
            exit()
    else:
        if cnts[i] != 0:
            print(0)
            exit()
print(pow(2,(n//2))%mod)
import numpy as np
x, y = map(int, input().split())
table = np.zeros((x+1, y+1))
for i in range(x):
  table[i,0] = 0
for j in range(y):
  table[0,j] = 0
table[0,0] = 1



#if table is not global but pass to function will this work?
def knight(x,y):
  if x >= 0 and y >= 0:
    if table[x,y] != -1:
      return table[x,y]
    else:
      ans = knight(x-2, y-1) + knight(x-1, y-2)
      table[x,y] = ans
      return ans
  else:
    return 0
ans = knight(x, y)
print(int(ans % (1e9+7)))


### FIXED CODE ###

def ext_gcd(p, a):
  #require a, m be relative prime
  #m > a  
  if a == 0:
    return 1, 0
  else:
    x1, y1 = ext_gcd(a, p%a)
    y = x1 - y1 * int(p/a)
    x = y1
    return x, y

x, y = map(int, input().split())

n = (2 * y - x)/3
m = (2 * x - y)/3

if n != int(n) or m != int(m) or n<0 or m<0:
  ans = 0
else:
   n = int(n)
   m = int(m)
   if n < m :
      c = m
      m = n
      n = c
   # (n+m!)/(n!)(m!) mod (1e9+7)
   ans = 1
   prime = 1000000007 
   for i in range(n+1,m+n+1):
        ans = int(ans * i) 
        ans = (ans % prime)
   for i in range(1, m+1):
      ori_inv = int(ext_gcd(prime, i)[1])
      while ori_inv < 0 :
        ori_inv += prime
      ans = int(ans * ori_inv)  
      ans = (ans % prime)
print(ans)
alpha = 'abcdefghijklmnopqrstuvwxyz'
alp_num = dict(zip(alpha,range(26)))
num_alp = dict(zip(range(26),alpha))
alp_num[' ']=' ' ; num_alp[' ']=' ' ; alp_num['.']='.' ; num_alp['.']='.'
while True:
	
	cipher = raw_input()
	if len(cipher) != 0:
		numcipher = [alp_num[val] for val in cipher]
		while True:
			cipher = ''
			for val in numcipher: cipher += str(num_alp[val])
			if 'the'in cipher or 'this'in cipher or 'that'in cipher:
				print cipher; break
			else: 
				numcipher2 = []
				for val in numcipher:
					if val == ' ': numcipher2.append(' ')
					elif val == '.': numcipher2.append('.')
					elif val == 25: numcipher2.append(0)
					else: numcipher2.append(val+1)
				numcipher = numcipher2
				continue
	else: break

### FIXED CODE ###

alpha = 'abcdefghijklmnopqrstuvwxyz'
alp_num = dict(zip(alpha,range(26)))
num_alp = dict(zip(range(26),alpha))
alp_num[' ']=' ' ; num_alp[' ']=' ' ; alp_num['.']='.' ; num_alp['.']='.'
while True:
	try:
		cipher = raw_input()
		numcipher = [alp_num[val] for val in cipher]
		while True:
			cipher = ''
			for val in numcipher: cipher += str(num_alp[val])
			if 'the'in cipher or 'this'in cipher or 'that'in cipher:
				print cipher; break
			else: 
				numcipher2 = []
				for val in numcipher:
					if val == ' ': numcipher2.append(' ')
					elif val == '.': numcipher2.append('.')
					elif val == 25: numcipher2.append(0)
					else: numcipher2.append(val+1)
				numcipher = numcipher2
				continue
	except: break
def nibun_right(a, x):
 lo, hi = 0, len(a)
 while lo < hi:
  mid = (lo+hi)//2
  if x < a[mid][0]: hi = mid
  else: lo = mid+1
 return lo
N,D,A=map(int,input().split())
lst=[0]*N
for i in range(N):
 lst[i]=list(map(int,input().split()))
lst.sort()
ans=0
print(ans)


### FIXED CODE ###

h,a=map(int,input().split())
b=int((h-1)/a)+1
print(b)
mod=10**9+7
r=[[(j-k)*9%13 for j in range(10)] for k in range(13)]
dp=[1]+[0]*12
for c in input():
  dp = [sum(dp[j] for j in k)%mod for k in r] if c>'9' else [dp[(int(c)-k)*9%13] for k in range(13)]
print(d[5])

### FIXED CODE ###

mod=10**9+7
r=[[(j-k)*9%13 for j in range(10)] for k in range(13)]
dp=[1]+[0]*12
for c in input():
  dp = [sum(dp[j] for j in k)%mod for k in r] if c>'9' else [dp[(int(c)-k)*9%13] for k in range(13)]
print(dp[5])
N = int(input())
A = map(int, input().split())
flag=0

for i in range(N): 
        for i1 in range(N): 
            if i != i1: 
                if A[i] == A[i1]: 
                    break
                else:
                  flag+=1

if flag>0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
S = set(A)
if len(S)==len(A):
    print("YES")
else:
    print("NO")
n, m = map(int, input().split())

print((n-1)(m-1))

### FIXED CODE ###

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

print((n-1) * (m-1))
a, b = int(input().split())

if (a + b) % 3 == 0:
  print(Possible)
else:
  print(Impossible)

### FIXED CODE ###

a, b = map(int, input().split())
if (a+b) % 3 == 0 or a % 3 == 0 or b % 3 == 0:
  print("Possible")
else:
  print("Impossible")
# coding:utf-8

# 入力
N, Q = map(int, input().split(' '))
S = input()
ql = []
for _ in range(Q):
    l, r = map(int, input().split(' '))
    ql.append((l,r))

# 累積文字和の作成
cl = ['']
for char in S:
    cl.append(cl[-1] + char)

# クエリに対する出力
for i in range(Q):
    cnt = 0
    string = cl[ql[i][1]][ql[i][0]-1:]
    for j in range(len(string)-1):
        if string[j:j+2] == 'AC':
            cnt += 1
    print(cnt)

### FIXED CODE ###

# coding:utf-8

# 入力
N, Q = map(int, input().split(' '))
S = input()
ql = [map(int, input().split(' ')) for _ in range(Q)]

# 累積和の作成
cl = [0, 0]
for i in range(N-1):
    if S[i] + S[i+1] == 'AC':
        cl.append(cl[-1]+1)
    else:
        cl.append(cl[-1])

# クエリに対する出力
for l, r in ql:
    print(cl[r] - cl[l])
N,K=map(int,input().split())

if N<10:
  print(100*(10−K))
else:
  print(K)


### FIXED CODE ###

N,K=map(int,input().split())
 
if N<10:
  print(K+100*(10-N))
else:
  print(K)
n=input()
a=input()
print(n**2-a)

### FIXED CODE ###

n=int(input())
a=int(input())
print(n**2-a)
import numpy as np
N,K,Q=map(int,input().split())
A=[]
for i in range(Q):
    a=int(input())
    A.append(a)

P=[K]*N
P1=np.array(P)
for i in A:
    P1=P1-1
    P1[i-1]=P1[i-1]+1
for i in range(len(P1)):
    if P1[i]>0:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

import numpy as np
N,K,Q=map(int,input().split())
A=[0]*N
P=[K-Q]*N
for i in range(Q):
    a=int(input())
    A[a-1]=A[a-1]+1
A=np.array(A)
P=np.array(P)
for i in range(N):
    if A[i]+P[i]>0:
        print('Yes')
    else:
        print('No')
N = int(input())
S = str(input())

max = 0
x = 0

for i in range(N):
    if S[i] == 'I':
        x += 1
    else:
        x -= 1
    if x > max:
        max = x

print(max)


### FIXED CODE ###

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

S1 = int(A*B)
S2 = int(C*D)

if S1 >= S2:
    print(S1)
elif S2 > S1:
    print(S2)
a,b=map(int,input().split())
ans=0
for i in range(a,b+1):
  s=str(i)
  if i[0]==i[4] and i[1]==i[3]:
    ans+=1
print(ans)

### FIXED CODE ###

a,b=map(int,input().split())
cnt=0
for i in range(a,b+1):
  if str(i) == str(i)[::-1]:
    cnt+=1
print(cnt)
x = int(input())

#def prime number discriminator
def prime_or_not(a):
  b = 0
  for i in range(a):
    if a % i == 0:
      b += 1
    if b >= 1:
      return 0:
    else:
      return 1:

ans = 0

while ans =< 0:
  ans += primt_or_not(a)
  a += 1
print(a - 1)

### FIXED CODE ###

x = int(input())

#def prime number discriminator

def prime_or_not(a):
  b = 0
  i = 2

  if a == 2:
    ans = True
    
  else:
    while i <= a - 1 and b < 1:
      if a % (i)== 0:
        b += 1
        i += 1
      else:
        i += 1
      
      if b >= 1:
        ans = False
      else:
        ans = True

    return ans

ans = 0

if x == 2:
  print(2)
else:
  while ans <1:
    ans += prime_or_not(x)
    x += 1
  print(x - 1)
from collections import deque
N = int(input())
S = [list(map(int,list(input))) for _ in range(N)]
G = {i:[] for i in range(N)}
for i in range(N):
    for j in range(N):
        if S[i][j]==1:
            G[i].append(j)
que = deque([(0,-1)])
hist = [0 for _ in range(N)]
hist[0]=1
flag = 0
A = [0]
while que:
    x,z = que.popleft()
    A.append(x)
    for y in G[x]:
        if y!=z:
            if hist[y]==1:
                flag = 1
                break
            hist[y]=1
            que.append((y,x))
    if flag==1:break
if flag==1:
    print(-1)
else:
    a = A[-1]
    que = deque((a,0))
    hist = [0 for _ in range(N)]
    hist[a]=1
    cnt = 0
    while que:
        x,d = que.popleft()
        for y in G[x]:
            if hist[y]==0:
                hist[y]=1
                que.append((y,d+1))
                cnt = d+1
    print(cnt)

### FIXED CODE ###

from collections import deque
N = int(input())
G = {i:[] for i in range(N)}
for i in range(N):
    S = input().strip()
    for j in range(N):
        if S[j]=="1":
            G[i].append(j)
cmax = 0
for i in range(N):
    hist = [0 for _ in range(N)]
    hist[i]=1
    num = 0
    heap = deque([(i,1)])
    ind = 0
    while ind==0 and num<N:
        cur = heap.popleft()
        num += 1
        y = cur[0]
        g = cur[1]
        cmax = max(cmax,g)
        for x in G[y]:
            if hist[x]==0:
                heap.append((x,g+1))
                hist[x]=g+1
            elif hist[x]==hist[y]:
                ind = 1
                break
    if ind==1:break
if ind==1:
    print(-1)
else:
    print(cmax)
A,B=map(int, input().split())
if A>B:
  print(2*A-1)
elif A=B:
  print(2*A-2)
else:
  print(2*B-1)
  


### FIXED CODE ###

A,B=map(int, input().split())
if A>B:
  print(2*A-1)
elif A==B:
  print(2*A)
else:
  print(2*B-1)
from collections import OrderedDict
N=int(input())
d=dict()
ma=0
for i in range(N):
  s=input()
  if s not in d:
    d[s]=0
  d[s]+=1
d=OrderedDict(sorted(d.items(), key=lambda x:x[1], reverse=True))
for i in d:
  if ma<=i:
    ma=i
  if ma!=i:
    exit()
  print(d[i])

### FIXED CODE ###

from collections import OrderedDict
N=int(input())
d=dict()
A=[]
ma=0
for i in range(N):
  s=input()
  if s not in d:
    d[s]=0
  d[s]+=1
d=OrderedDict(sorted(d.items(), key=lambda x:x[1], reverse=True))
for i in d:
  if ma<=d[i]:
    ma=d[i]
  if ma!=d[i]:
    break
  A.append(i)
print(*sorted(A),sep="\n")
a,b = map(int, input().split())
 
import math
 
lcm = a * b / math.gcd(a, b)
 
print(int(lcm))


### FIXED CODE ###

import fractions
A, B = map(int, input().split())
print(A*B//fractions.gcd(A, B))
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input()
    n = len(s)
    ss = "".join(s.replace("x", ""))
    if ss != ss[::-1]:
        print(-1)
        exit()

    res = 0
    left = 0
    right = n - 1
    while left != right:
        if s[left] == s[right]:
            left += 1
            right -= 1
        else:
            if s[left] == "x":
                left += 1
            else:
                right -= 1
            res += 1
    print(res)


if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input()
    ss = []
    for i in s:
        if i != "x":
            ss.append(i)

    if ss != ss[::-1]:
        print(-1)
    else:
        n = len(ss) + 1
        cnt = 0
        cnt_x = [0] * (n)
        pos = 0
        for i in range(len(s)):
            if s[i] == "x":
                cnt += 1

            if s[i] != "x" or i == len(s) - 1:
                cnt_x[pos] = cnt
                cnt = 0
                pos += 1

        res = 0
        for i in range(n // 2):
            res += abs(cnt_x[i] - cnt_x[-(i + 1)])

        print(res)


if __name__ == '__main__':
    resolve()
N = int(input())
A = list(map(int,input().split()))
Ma = max(A)
Mi = min(A)
print(Ma-Mi)

### FIXED CODE ###

S = input()
K =[]
for i in range(len(S)):
  if S[i] in K:
    print("no")
    break
  else:
    K.append(S[i])
  if i == len(S)-1:
    print("yes")
import math
N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
count = [0] * 39
for a in A:
    for i in range(40):
        if a >> i & 1:
            count[i] += 1
if K:
    ans = sum(count[_] * 2**_ for _ in range(int(math.log2(K)) + 1, 39))
else:
    ans = sum(A)
while K:
    b = int(math.log2(K))
    if count[b] * 2 > N:
        #0をたてる
        ans += count[b] * 2**b
        K = 2**b - 1
    else:
        #1を立てる
        ans += (N - count[b]) * 2**b
        if K - 2**b:
            ans += sum(count[_] * 2**_
                       for _ in range(1 + int(math.log2(K - 2**b)), b))
        else:
            ans += sum(count[_] * 2**_ for _ in range(b))
        K -= 2**b
print(ans)


### FIXED CODE ###

import math
N, K = [int(_) for _ in input().split()]
A = [int(_) for _ in input().split()]
count = [0] * 40
if K == 0:
    print(sum(A))
    exit()
for a in A:
    for i in range(40):
        if a >> i & 1:
            count[i] += 1
ans = sum(count[_] * 2**_ for _ in range(int(math.log2(K)) + 1, 40))
while K:
    b = int(math.log2(K))
    if count[b] * 2 > N:
        #0をたてる
        ans += count[b] * 2**b
        K = 2**b - 1
    else:
        #1を立てる
        ans += (N - count[b]) * 2**b
        if K - 2**b:
            ans += sum(count[_] * 2**_
                       for _ in range(1 + int(math.log2(K - 2**b)), b))
        else:
            ans += sum(count[_] * 2**_ for _ in range(b))
        K -= 2**b
print(ans)
a = []
while True:
    n = input()
    if n == -1:
        break
    a.append(n)

for i in range(len(a)):
    if(a[i]==0):
        break
    else:
        print('Case '+str(i)+': '+str(a[i]))

### FIXED CODE ###

i=1
while(1):
    n=input()
    if(int(n)==0):
        break
    else:
        print('Case '+str(i)+': '+n)
        i+=1
a,b = int(),input().split()
if a < b:
    print("a < b")
elif a > b:
    print("a > b")
elif a == b:
    print("a == b")


### FIXED CODE ###

a,b = input().split()
a = int(a)
b = int(b)
if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")
from functools import reduce
from math import gcd

X = int(input().split()[1])
x = [abs(int(x) - X) for x in input().split()]

print(reduce(gcd, x))


### FIXED CODE ###

from functools import reduce
from fractions import gcd

X = int(input().split()[1])
x = [abs(int(x) - X) for x in input().split()]

print(reduce(gcd, x))
import sys
for i, x in map(int, sys.stdin):
    if not x: break
    print("Case {0}: {1}".format(i, x))

### FIXED CODE ###

import sys
for i, x in enumerate(map(int, sys.stdin)):
    if not x: break
    print("Case {0}: {1}".format(i + 1, x))
from collections import Counter as c
from scipy.misc import comb
from functools import reduce

def f(n):
  d,i=c(),2
  while i*i<=n:
    while n%i==0:
      n//=i
      d[i]+=1
    i+=1
  if n>1:d[n]+=1
  return d.values()

n,m=map(int,input().split())
mod=10**9+7
print(reduce(lambda x,y:x*y%mod,map(lambda x:comb(x+n-1,x,exact=True),f(m)))%mod)

### FIXED CODE ###

from collections import Counter as c
from scipy.misc import comb
from functools import reduce

def f(n):
  d,i=c(),2
  while i*i<=n:
    while n%i==0:
      n//=i
      d[i]+=1
    i+=1
  if n>1:d[n]+=1
  return d.values()

n,m=map(int,input().split())
mod,v=10**9+7,1
for x in f(m):
  v*=comb(x+n-1,x,exact=True)%mod
print(v%mod)
n,k=map(int,input().split())
heights=[int(i) for i in input().split()]

dp=[0]*n
dp[1]=abs(heights[1]-heights[0])

for i in range(2,n):
  step=[]
  for j in range(1,min(k+1,i+1)):
      step.append(dp[i-j]+abs(heights[i]-heights[i-j]))
    
  dp[i]=min(step)
print(dp[n-1])


### FIXED CODE ###

n=int(input())
heights=[int(i) for i in input().split()]

dp=[0]*n
dp[1]=abs(heights[1]-heights[0])

for i in range(2,n):
  dp[i]=min(dp[i-2]+abs(heights[i]-heights[i-2]), dp[i-1]+abs(heights[i]-heights[i-1]))
print(dp[n-1])