Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from collections import deque
H,W=map(int,input().split())

board=[list(input()) for _ in range(H)]
checked=[[-1 for _ in range(W)] for _ in range(H)]
dh=[1,0,-1,0]
dw=[0,-1,0,1]
ans=0

q=deque([])

for i in range(H):
    for j in range(W):
        if board[i][j]=='#':
            checked[i][j]=0
            q.append([i,j])


while len(q)!=0:
    tmp=q.popleft()
    h,w=tmp[0],tmp[1]
    for i in range(4):
        th=h+dh[i]
        tw=w+dw[i]
        if 0<=th<H and 0<=tw<W and checked[th][tw]==-1:
            checked[th][tw]=checked[h][w]+1
            q.append([th,tw])
            ans=max(ans,checked[th][tw])
print(ans)


### FIXED CODE ###

H,W=map(int,input().split())
board=[[True]*(W+2)]
for i in range(H):
    board.append([True]+[a=='#' for a in input()]+[True])
board.append([True]*(W+2))

q=[]
for h in range(1,H+1):
    for w in range(1,W+1):
        if board[h][w]:
            q.append((h,w))

cnt=0
while q:
    nq=[]
    for h,w in q:
        if not board[h+1][w]:
            board[h+1][w]=True
            nq.append((h+1,w))
        if not board[h-1][w]:
            board[h-1][w]=True
            nq.append((h-1,w))
        if not board[h][w+1]:
            board[h][w+1]=True
            nq.append((h,w+1))
        if not board[h][w-1]:
            board[h][w-1]=True
            nq.append((h,w-1))

    q=nq
    cnt+=1

print(cnt-1)
### BUGGY CODE ###

N=int(input())
S=list(input())

def rgb(now,sec):
    if now=='R' and sec=='G':
        return 'B'
    if now == 'R' and sec == 'B':
        return 'G'
    if now == 'G' and sec == 'R':
        return 'B'
    if now == 'G' and sec == 'B':
        return 'R'
    if now == 'B' and sec == 'G':
        return 'R'
    if now == 'B' and sec == 'R':
        return 'G'

r=[]
g=[]
b=[]
for i in range(N):
    r.append(S[i:].count('R'))
    g.append(S[i:].count('G'))
    b.append(S[i:].count('B'))
    
ans=0
for i in range(N-2):
    now = S[i]
    for j in range(i+1,N-1):
        if S[j] == now:
            continue
        else:
            sec = S[j]
            thi = rgb(now,sec)
            if thi=='R':
                ans += r[j+1]
            if thi=='G':
                ans += g[j+1]
            if thi=='B':
                ans += b[j+1]
            if j+(j-i) < N and S[j+(j-i)]==thi:
                ans-=1
print(ans)

### FIXED CODE ###

N=int(input())
S=list(input())

def rgb(now,sec):
    if now=='R' and sec=='G':
        return 'B'
    if now == 'R' and sec == 'B':
        return 'G'
    if now == 'G' and sec == 'R':
        return 'B'
    if now == 'G' and sec == 'B':
        return 'R'
    if now == 'B' and sec == 'G':
        return 'R'
    if now == 'B' and sec == 'R':
        return 'G'

r=[0]*N+[0]
g=[0]*N+[0]
b=[0]*N+[0]

for i in reversed(range(N)):
    if S[i]=='R':
        r[i]=r[i+1]+1
        g[i]=g[i+1]
        b[i]=b[i+1]
    if S[i]=='G':
        r[i]=r[i+1]
        g[i]=g[i+1]+1
        b[i]=b[i+1]
    if S[i]=='B':
        r[i]=r[i+1]
        g[i]=g[i+1]
        b[i]=b[i+1]+1 
    
ans=0
for i in range(N-2):
    now = S[i]
    for j in range(i+1,N-1):
        if S[j] == now:
            continue
        else:
            sec = S[j]
            thi = rgb(now,sec)
            if thi=='R':
                ans += r[j+1]
            if thi=='G':
                ans += g[j+1]
            if thi=='B':
                ans += b[j+1]
            if j+(j-i) < N and S[j+(j-i)]==thi:
                ans-=1
print(ans)
### BUGGY CODE ###

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

count = 1
for i in range(1, n):
    if a[0] == 1:
        break
    elif a[i] <= min(a[:i]):
        count += 1
print(count)


### FIXED CODE ###

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

count = 0
m = a[0]
for i in range(n):
    if a[i]  <= m:
        m = a[i]
        count += 1
print(count)
### BUGGY CODE ###

import sys
import math
x,y=map(int,input().split())
MOD=10**9 + 7
t=(x+y)//3
if((x+y)%3!=0 or x<t or y<t or 2*t<x or 2*t<y):
    print(0)
    sys.exit()

n=t+1
k=x-t+1
#print(n)
#print(k)
print( (math.factorial(n-1) // (math.factorial(k-1) * math.factorial(n-k))) % MOD)


### FIXED CODE ###

import sys
MOD=(10**9) + 7
x,y=map(int,input().split())

if((x+y)%3!=0):
    print(0)
    sys.exit()

n=((x+y)//3) + 1
k=y-(n-2)

fac=[0 for _ in range(n)]   #n!
finv=[0 for _ in range(n)]  #1/n!
inv=[0 for _ in range(n)]   #

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

for i in range(2,n):
    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 ncr(n,k):
    if(n < k):
        return 0
    elif(n < 0 or k < 0):
        return 0
    else:
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD


print(ncr(n-1,k-1))
### BUGGY CODE ###

from heapq import heapify, heappop, heappush, heappushpop

N = int(input())
*A, = map(int, input().split())
INF = 10**16
first = A[:N]
heapify(first)
second = [-a for a in A[2*N:]]
heapify(second)
f = [0]*(N+1)
s = [0]*(N+1)
f[0] = sum(first)
s[N] = - sum(second)
for k in range(1, N+1):
    heappushpop(first, A[N-1+k])
    f[k] = sum(first)
for k in range(N-1, -1, -1):
    heappushpop(second, -A[N+k])
    s[k] = - sum(second)
ans = -INF
for k in range(N+1):
    ans = max(ans, f[k] - s[k])
print(ans)

### FIXED CODE ###

from heapq import heapify, heappushpop

N = int(input())
*A, = map(int, input().split())
INF = 10**16
first = A[:N]
heapify(first)
second = [-a for a in A[2*N:]]
heapify(second)
f = [0]*(N+1)
s = [0]*(N+1)
f[0] = sum(first)
s[N] = - sum(second)
for k in range(1, N+1):
    a = heappushpop(first, A[N-1+k])
    f[k] = f[k-1] + A[N-1+k] - a
for k in range(N-1, -1, -1):
    a = heappushpop(second, -A[N+k])
    s[k] = s[k+1] + A[N+k] + a
ans = -INF
for k in range(N+1):
    ans = max(ans, f[k] - s[k])
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

MAXN = 10**6+10
facts = [-1,-1] + [0]*MAXN
p = 2
while p*p <= MAXN:
    if facts[p] == 0:
        for q in range(p*p,MAXN+1,p):
            if facts[q]==0:
                facts[q] = p
    p += 1

from collections import Counter
ctr = Counter()
for a in A:
    c = Counter()
    while facts[a] > 0:
        c[facts[a]] += 1
        a //= facts[a]
    c[a] += 1
    ctr |= c
l = 1
for k,v in ctr.items():
    l *= k**v
ans = 0
for a in A:
    ans += l//a
ans %= MOD
print(ans)

### FIXED CODE ###

from fractions import gcd
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

lcm = 1
for a in A:
    lcm = lcm // gcd(lcm,a) * a

ans = 0
for a in A:
    ans += lcm // a
ans %= MOD
print(ans)
### BUGGY CODE ###

def knapsack(N,W,weight,value):
  inf=float("inf")
  dp=[[-inf for i in range(W+1)] for j in range(N+1)]
  dp2=[[[] for i in range(W+1)] for j in range(N+1)]
  for i in range(W+1): dp[0][i]=0

  for i in range(N):
    for w in range(W+1):
      if weight[i]<=w:
        if dp[i][w-weight[i]]+value[i]>dp[i][w]:
          dp[i+1][w]=dp[i][w-weight[i]]+value[i]
          dp2[i+1][w]=dp2[i][w-weight[i]]+[i]
        else:
          dp[i+1][w]=dp[i][w]
          dp2[i+1][w]=dp2[i][w]
        
      else:
        dp[i+1][w]=dp[i][w]
        dp2[i+1][w]=dp2[i][w]
  return [dp[N][W],dp2[N][W]]

n,t=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
a=[];b=[]
for i in range(n):
  a.append(l[i][0])
  b.append(l[i][1])
x=knapsack(n,t-1,a,b)[0]
y=knapsack(n,t-1,a,b)[1]
L=[0 for i in range(n)]
for i in range(len(y)):
  L[y[i]]=1
M=[]
for i in range(n):
  if L[i]==0:
    M.append(b[i])
if len(M)==0:
  print(x)
else:
  print(x+max(M))

### FIXED CODE ###

import sys
input=sys.stdin.readline
import copy
def knapsack(N,W,weight,value):
  dp=[[999999999999 for i in range(W+1)] for j in range(N+1)]
  for i in range(W+1): dp[0][i]=0
 
  for i in range(N):
    for w in range(W+1):
      if weight[i]<=w:
        if dp[i][w-weight[i]]+value[i]>dp[i][w]:
          dp[i+1][w]=dp[i][w-weight[i]]+value[i]
        else:
          dp[i+1][w]=dp[i][w]
      else:
        dp[i+1][w]=dp[i][w]
  return dp
 
n,t=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
l.sort()
a=[];b=[]
for i in range(n):
  a.append(l[i][0])
  b.append(l[i][1])
dp=knapsack(n,t-1,a,b)
ans=[]
for i in range(n):
  if i!=n:
    ans.append(dp[i][t-1]+b[i])
  else:
    ans.append(dp[n][t-i])
print(max(ans))
### BUGGY CODE ###

import math
from fractions import gcd

def is_prime(n):
  if n == 1: 
    return 1

  for k in range(2, int(math.sqrt(n)) + 1):
    if n % k == 0:
      return 0

  return 1
  
a, b = map(int, input().split())
max_d = gcd(a, b)
ans = 0
for i in range(1, max_d + 1):
  if a % i == 0 and b % i == 0:
    ans += is_prime(i)
    
print(ans)
    


### FIXED CODE ###

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
  
a, b = map(int, input().split())
la = prime_decomposition(a)
lb = prime_decomposition(b)
la_lb_and = list(set(la) & set(lb))
    
print(len(la_lb_and) + 1)
### BUGGY CODE ###

from itertools import permutations
n,m,r=map(int,input().split());R=min(r,8)
d = [[10**12for i in range(n)]for j in range(n)]
l=[int(i)-1 for i in input().split()]
for i in range(m):
  a,b,c=map(int,input().split())
  d[a-1][b-1]=d[b-1][a-1] = c
for k in range(n):
  for i in range(n):
    for j in range(n):
      if d[i][j]>d[i][k]+d[k][j]:
        d[i][j]=d[i][k]+d[k][j]
#print(d)
ans=10**12
for v in permutations(l):
  cnt=sum(d[v][u] for v, u in zip(v, v[1:]))
  ans=min(ans,cnt)
print(ans)

### FIXED CODE ###

import itertools
n,m,r=map(int,input().split());R=min(r,8)
d = [[10**12for i in range(n)]for j in range(n)]
l=list(map(int,input().split()))
for i in range(r):
  l[i]-=1
for i in range(m):
  a,b,c=map(int,input().split())
  d[a-1][b-1]=d[b-1][a-1] = c
for k in range(n):
  for i in range(n):
    for j in range(n):
      d[i][j]=min(d[i][j], d[i][k]+d[k][j])
#print(d)
ans=10**12
for v in itertools.permutations(l, R):
  cnt=0
  for i in range(1,R):
    cnt+=d[v[i-1]][v[i]]
  ans=min(ans,cnt)
print(ans)
### BUGGY CODE ###

number,money=input().rstrip().split()
number=int(number)
money=int(money)
bill=[0,0,0]

for i in range(number+1):
    bill=[0,0,0]
    mass=money-10000*i
    bill[0]=i
    if mass==0 and sum(bill)==number:
        break
    elif mass<0:
        break
    else:
        for j in range(number+1):
            if j!=0:
                mass=mass-5000
            bill[1]=j
            if mass==0 and sum(bill)==number:
                break
            elif mass<0:
                break
            else:
                k=int(mass/1000)
                bill[2]=k
                if sum(bill)==number:
                    mass=0
                    break
    if sum(bill)==number:
        break
                
if mass==0:
    print(str(bill[0])+' '+str(bill[1])+' '+str(bill[2]))
else:
    print(str(-1)+' '+str(-1)+' '+str(-1))

### FIXED CODE ###

number,money=input().rstrip().split()
number=int(number)
money=int(money)
bill=[0,0,0]

for i in range(number+1):
    bill=[0,0,0]
    mass=money-10000*i
    bill[0]=i
    if mass==0 and sum(bill)==number:
        break
    elif mass<0:
        break
    else:
        for j in range(number+1-i):
            if j!=0:
                mass=mass-5000
            bill[1]=j
            if mass==0 and sum(bill)==number:
                break
            elif mass<0:
                break
            else:
                k=int(mass/1000)
                bill[2]=k
                if sum(bill)==number:
                    break
    if sum(bill)==number:
        mass=0
        break
                
if mass==0:
    print(str(bill[0])+' '+str(bill[1])+' '+str(bill[2]))
else:
    print(str(-1)+' '+str(-1)+' '+str(-1))
### BUGGY CODE ###

import sys
import bisect


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    b = list(map(int, readline().split()))
    dp = [0] * 31
    for i in range(28, -1, -1):
        mdr = pow(2, i + 1)
        mdl = pow(2, i)
        for j in range(n-1, -1, -1):
            b[j] %= mdr
            a[j] %= mdr
        b.sort()
        for av in a:
            if mdl - av >= 0:
                dp[i] += bisect.bisect_left(b, mdr - av) - bisect.bisect_left(b, mdl - av)
            else:
                dp[i] += bisect.bisect_left(b, mdr - av)
                dp[i] += bisect.bisect_left(b, mdr) - bisect.bisect_left(b, mdl + mdr - av)
    t = 0
    for i in range(31):
        t += pow(2, i) * (dp[i] % 2)
    print(t)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
import bisect

readline = sys.stdin.buffer.readline
mod = 10 ** 9 + 7
n = int(readline())
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))


def f(md):
    pos = n - 1
    res = 0
    for av in a:
        while True:
            if pos != -1 and av + b[pos] >= md:
                pos -= 1
            else:
                res += pos + 1
                break
    return res


def solve():
    dp = [0] * 31
    for i in range(28, -1, -1):
        md = pow(2, i + 1)
        for j in range(n-1, -1, -1):
            b[j] %= md
            a[j] %= md
        a.sort()
        b.sort()
        res1, res2, res3 = f(md // 2), f(md // 2 * 2), f(md // 2 * 3)
        dp[i] += (n - (res1 + res3 - res2)) % 2
    t = 0
    for i in range(31):
        t += pow(2, i) * (dp[i] % 2)
    print(t)


if __name__ == '__main__':
    solve()
### BUGGY CODE ###

n = int(input())
arr = []
p = 1
c = 0

a = list(map(int,input().strip().split()))[:n] 

for i in range(n):
    if a[i]==0:
        c = 1
    p *= a[i]
if c == 1:
    print(0)
elif p > 1000000000000000000:
    print(-1)
else:
    print(p)


### FIXED CODE ###

n = int(input())
arr = []
p = 1
c = 0
l = 0
a = list(map(int,input().strip().split()))[:n] 

for i in range(n):
    if a[i]==0:
        c = 1
    if p > 1000000000000000000:  
        l = 1
    else:    
        p *= a[i]
if c == 1:
    print(0)
elif l == 1 or p > 1000000000000000000 :
    print(-1)
else:
    print(p)
### BUGGY CODE ###

import sys


def resolve(in_):
    k = int(next(in_))
    if not k % 2:
        return -1

    seven = 7 % k

    for i in range(1, 100000000):
        if not seven:
            return i
        i += 1
        seven = seven * 10 + 7
        if seven >= k:
            seven %= k

    return -1

def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys


def resolve(in_):
    k = int(next(in_))
    if not k % 2:
        return -1

    seven = 7 % k

    for i in range(1, 1000000):
        if not seven:
            return i
        i += 1
        seven = seven * 10 + 7
        if seven >= k:
            seven %= k

    return -1

def main():
    answer = resolve(sys.stdin.buffer)
    print(answer)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

[print(A.index(i) + 1, end=' ') for i in range(1, N+1)]

### FIXED CODE ###

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

B = [0] * N
for i in range(0, N):
    B[A[i]-1] = i+1
[print(x, end=' ') for x in B]
### BUGGY CODE ###

n,k,*a=map(int,open(0).read().split())
r=range(n)
while(min(a)<n)*k:
 k-=1;b=[0]*n*3
 for i in r:t=a[i];b[max(0,i-t)]+=1;b[i-~t]-=1
 for i in r:b[i+1]+=b[i]
 a=b[:n]
print(*a)

### FIXED CODE ###

def main():
    n,k,*a=map(int,open(0).read().split())
    for _ in range(k):
        b=[0]*n
        m=10**18
        for i,t in enumerate(a):
            if t<m:m=t
            b[max(0,i-t)]+=1
            if i-~t<n:b[i-~t]-=1
        if m>=n:break
        for i in range(n-1):b[i+1]+=b[i]
        a=b
    print(' '.join(map(str,a)))
main()
### BUGGY CODE ###

n=int(input())
lst=list(map(int,input().split()))
aa=sum(lst) % (10**9+7)
# print(sum(lst) % (10**9+7) )
new_lst=[]
for i in range(n-1):
    new_lst.append((aa- sum(lst[0:i+1]) % (10**9+7)))

tem=0
for i in range(n-1):
    tem+=(lst[i] % (10**9+7) )*new_lst[i]
        # print(tem)
print(tem % (10**9 +7))

### FIXED CODE ###

n=int(input())
lst=list(map(int,input().split()))
aa=sum(lst) % (10**9+7)
# print(sum(lst) % (10**9+7) )
new_lst=[]
temp_1=aa
for i in range(n-1):
    temp_1-=lst[i]
    new_lst.append(temp_1)
# print(new_lst)

tem=0
for i in range(n-1):
    tem+=(lst[i] )*new_lst[i]
        # print(tem)
print(tem % (10**9 +7))
### BUGGY CODE ###

from collections import Counter
N = int(input())
S = input()
Left = Counter()
Right = Counter()
S_left = S[:N]
S_right = S[2*N-1:N-1:-1]
for x in range(2**N):
    red_left = ''
    blue_left = ''
    red_right = ''
    blue_right = ''
    B = bin(x)[2:]
    B = B.zfill(N)
    for i in range(N):
        if int(B[i]) == 1:
            red_left += S_left[i]
            red_right += S_right[i]
        else:
            blue_left += S_left[i]
            blue_right += S_right[i]
    Left[red_left + '|' + blue_left] += 1
    Right[blue_right + '|' + red_right] += 1
ans = 0
for i in Left.keys():
    ans += Left[i]*Right[i]
print(ans)

### FIXED CODE ###

from collections import Counter
from itertools import product
N = int(input())
S = input()
Left = Counter()
Right = Counter()
S_left = S[:N]
S_right = S[2*N-1:N-1:-1]
for B in product(range(2),repeat = N):
    red_left = ''
    blue_left = ''
    red_right = ''
    blue_right = ''
    for i in range(N):
        if B[i]:
            red_left += S_left[i]
            red_right += S_right[i]
        else:
            blue_left += S_left[i]
            blue_right += S_right[i]
    Left[red_left + '|' + blue_left] += 1
    Right[blue_right + '|' + red_right] += 1
ans = 0
for i in Left.keys():
    ans += Left[i]*Right[i]
print(ans)
### BUGGY CODE ###

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

k, s = map(int, input().split())

ans = 0

for i in range(k+1):
    for j in range(k+1):
        for k in range(k+1):
            if i + j + k == s:
                ans += 1
                
print(ans)


            

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Mon Aug  3 13:34:09 2020

@author: ito
"""


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

k, s = map(int, input().split())

ans = 0

for x in range(k+1):
    for y in range(k+1):
        
        sat_z = s - x - y
        
        if sat_z >= 0 and sat_z <= k:
            ans += 1
            
print(ans)
### BUGGY CODE ###

def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = INT()
ans = [0] * N

def fn(x, y, z):
    f = x**2 + y**2 + z**2 + x * y + y * z + z * x
    return f

for n in range(1, N + 1):
    for x in range(1, int(N ** 0.5) + 2):
        if fn(x, 1, 1) > n:
            break
        for y in range(1, int(N ** 0.5) + 2):
            if fn(x, y, 1) > n:
                break
            for z in range(1, int(N ** 0.5) + 2):
                f = fn(x, y, z)
                if f > n:
                    break
                if f == n:
                    ans[f - 1] += 1

for a in ans:
    print(a)

### FIXED CODE ###

def INT():
    return int(input())

def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

N = INT()
ans = [0] * N

def fn(x, y, z):
    f = x**2 + y**2 + z**2 + x * y + y * z + z * x
    return f

for x in range(1, int(N ** 0.5) + 2):
    if fn(x, 1, 1) > N:
        break
    for y in range(1, int(N ** 0.5) + 2):
        if fn(x, y, 1) > N:
            break
        for z in range(1, int(N ** 0.5) + 2):
            f = fn(x, y, z)
            if f > N:
                break
            if f <= N:
                ans[f - 1] += 1

for a in ans:
    print(a)
### BUGGY CODE ###

import copy
def ehand(n,a):
    for i in range(n):
        b = copy.deepcopy(a)
        del b[i]
        print max(b)

if __name__ == '__main__':
    n = int(raw_input())
    a = []

    for i in range(n):
        a.append(int(raw_input()))

    ehand(n,a)

### FIXED CODE ###

import copy
def calcmax(a,b,fst,scd,n):
    for i in xrange(n):
        if fst == a[i]:
            count = i

    for i in xrange(n):
        if count == i:
            print scd
        else:
            print fst

if __name__ == '__main__':
    n = int(raw_input())
    a = [int(raw_input()) for i in xrange(n)]
    print("")

    fst = max(a)

    b = copy.deepcopy(a)
    b.remove(fst)

    scd = max(b)

    calcmax(a,b,fst,scd,n)
### BUGGY CODE ###

def putty(n):
    f_last = [1]
    tmp = [1]
    for i in range(1, n+1):
        tmp = [0]+f_last+[1]+f_last+[0]
        f_last = tmp
    return tmp

n, x = map(int, input().split())
#f = [[]] * (n+1)
a = putty(n)
a = a[:x]
print(sum(a))

### FIXED CODE ###

def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= (a[n-1] + 1):
        return f(n - 1, x - 1)
    else:
        return p[n - 1] + 1 + f(n - 1, x - 2 - a[n - 1])


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

a, p=[1],[1]
for i in range(n):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)
    
print(f(n, x))
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = 0
import heapq
heapq.heapify(A)
while A != []:
    a = heapq.heappop(A)
    ans += 1
    AA = []
    if a in A:
        ans -= 1
    for i in range(len(A)):
        if not (A[i] % a == 0):
            AA.append(A[i])
    A = AA
print(ans)

### FIXED CODE ###

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

s = A[-1]
p = [0 for _ in range(s+1)]
for i in A:
    p[i] += 1
    if p[i] > 1:
        continue
    for j in range(i*2,s+1,i):
        p[j] += 1
ans = 0
for i in A:
    if p[i] == 1:
        ans += 1
print(ans)
### BUGGY CODE ###

n =int(input())
a =list(map(int,input().split()))
ans =1
for i in range(n):
    ans =a[i]*ans
if ans <= 10**18:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

n =int(input())
a =list(map(int,input().split()))
ans =1
if 0 in a:
    print(0)
    exit()
else:
    for i in a:
        ans *=i
        if ans >10**18:
            print(-1)
            exit()
print(ans)
### BUGGY CODE ###

from collections import Counter

N = int(input())
input_list = sorted([int(i) for i in input().split()])
inupt_dict = (Counter(input_list))
result = 0
input_dict_keys = inupt_dict.keys()

if N == 1:
    result = 1
elif N == 2 and input_list[0] == input_list[1]:
    result = 2
elif N == 2 and input_list[0] != input_list[1]:
    if input_list[1] == input_list[0] + 1:
        result = 2
    else:
        result = 1
else:
    for i in range(N-2):
        if i in input_dict_keys:
            if i+1 in input_dict_keys:
                if i+2 in input_dict_keys:
                    result = max(result, (inupt_dict[i] + inupt_dict[i+1] + inupt_dict[i+2]))

        for i in range(N-1):
            if i in input_dict_keys:
                if i+1 in input_dict_keys:
                    result = max(result, (inupt_dict[i] + inupt_dict[i+1]))

        for i in range(N):
            if i in input_dict_keys:
                result = max(result, inupt_dict[i])


print(result)

### FIXED CODE ###

from collections import Counter

N = int(input())
input_list = sorted([int(i) for i in input().split()])
inupt_dict = (Counter(input_list))
result = 0
input_dict_keys = inupt_dict.keys()

if N == 1:
    result = 1
elif N == 2 and input_list[0] == input_list[1]:
    result = 2
elif N == 2 and input_list[0] != input_list[1]:
    if input_list[1] == input_list[0] + 1:
        result = 2
    else:
        result = 1
else:
    for i in range(N-2):
        if i in input_dict_keys:
            if i+1 in input_dict_keys:
                if i+2 in input_dict_keys:
                    result = max(result, (inupt_dict[i] + inupt_dict[i+1] + inupt_dict[i+2]))
    for i in range(N-1):
        if i in input_dict_keys:
            if i+1 in input_dict_keys:
                result = max(result, (inupt_dict[i] + inupt_dict[i+1]))
    for i in range(N):
        if i in input_dict_keys:
            result = max(result, inupt_dict[i])

print(result)