Harryxun/stf_run huggingface dataset:
from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])
max_prime = int(np.sqrt(g))+1
primes = np.ones(g + 1)
#print(g+1, primes.shape)
primes[0:2] = 0
#print(primes)
for i in range(2, max_prime):
  if i * 2 < g + 1:
    try:
   	  primes[i*2::i] = 0
    except:
      pass
    #print(i, primes)

primes = primes.nonzero()[0]
#print(primes.nonzero()[0])

factor = primes[g % primes == 0]

#print(g, original_g, factor)
print(len(factor) + 1)


### FIXED CODE ###

from fractions import gcd
import math
import numpy as np
N = list(map(int, input().split()))
g = gcd(N[0], N[1])

def factorize(g):
  factor = []
  for i in range(2, int(np.sqrt(g))+2):
    if g % i != 0:
      continue
    while g % i == 0:
      g //= i
    factor.append(i)
  if g != 1:
    factor.append(g)
  return factor
print(len(factorize(g))+1)
import numpy as np
a = list(map(int,input().split()))

x = a[0]
n = a[1]
d = list(map(int,input().split()))

if (n == 0):
    print(x)
else:
    min_int = d[np.argmin(d)]
    max_int = d[np.argmax(d)]

    if (x < min_int or max_int < x):
        print(x)
    else:

        p = []
        for var in range(min_int,max_int):
            if var not in d:
                p.append(var)
            else:
                continue




        ans = []

        for pp in p:
            ans.append(np.abs(pp - x))
        ans = np.array(ans)
        print(p[np.argmin(ans)])


### FIXED CODE ###

import numpy as np
a = list(map(int,input().split()))

x = a[0]
n = a[1]

if (n == 0):
    print(x)
else:
    d = list(map(int,input().split()))
    min_int = d[np.argmin(d)]
    max_int = d[np.argmax(d)]
    if (x < min_int or max_int < x):
        print(x)
    else:
        p = []
        for var in range(min_int - 10,max_int + 10):
            if var not in d:
                p.append(var)
            else:
                continue
        ans = []
        for pp in p:
            ans.append(np.abs(pp - x))
        ans = np.array(ans)
        print(p[np.argmin(ans)])
H,W = tuple(int(x) for x in raw_input().split(""))
for height in range(H):
    if H == W == 0:
        break
    elif height == H-1 or height == 0:
        print "#"*W
    else:
        print "#"+ "."*(W-2)+"#"
print ""

### FIXED CODE ###

while True:
    h,w = tuple([int(x) for x in raw_input().split(" ")])
    if h==0 and w==0: break
 
    for ih in range(h):
        if ih==0 or ih==h-1 or w <= 2: print "#" * w
        else: print "#" + "." * (w-2) + "#"
 
    print ""
_, *a = map(int, open(0).read().split())
s = sorted(a)
for i in a:
    print(s[(i < b[-1])-2])

### FIXED CODE ###

_, *a = map(int, open(0).read().split())
s = sorted(a)
for i in a:
    print(s[(i < s[-1])-2])
n = int(input())
s = list(map(str,input().split()))
l = []

for i in range(N):
  l.append(s[i])
 
print(len(set(l)))

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]
S = len(set(s))

print(S)
import bisect,sys 
input=sys.stdin.readline 
a,b,Q=map(int,input().split())
INF=10**18
s=[-INF]+[int(input()) for _ in range(a)]+[INF]
t=[-INF]+[int(input()) for _ in range(b)]+[INF]
for q in range(Q):
    x=int(input())
    b,d=bisect.bisect_right(s,x),bisect.bisect_right(t,x)
    res=INF 
    for S in [s(b-1),s(b)]:
        for T in [t(d-1),t(d)]:
            d1,d2=abs(S-x)+abs(T-S),abs(T-x)+abs(T-S)
            res=min(res,d1,d2)
    print(res)

### FIXED CODE ###

import bisect,sys 
input=sys.stdin.readline 
a,b,Q=map(int,input().split())
INF=10**18
s=[-INF]+[int(input()) for _ in range(a)]+[INF]
t=[-INF]+[int(input()) for _ in range(b)]+[INF]
for q in range(Q):
    x=int(input())
    b,d=bisect.bisect_right(s,x),bisect.bisect_right(t,x)
    res=INF 
    for S in [s[b-1],s[b]]:
        for T in [t[d-1],t[d]]:
            d1,d2=abs(S-x)+abs(T-S),abs(T-x)+abs(T-S)
            res=min(res,d1,d2)
    print(res)
#!/usr/bin/env python
# coding: utf-8

# In[26]:


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


# In[27]:


ans = 0
for i in range(N):
    ans += min(A[i], B[i])
    B[i] = max(B[i]-A[i])


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[26]:


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


# In[28]:


ans = 0
for i in range(N):
    ans += min(A[i], B[i])
    B[i] = max(B[i]-A[i], 0)
    ans += min(A[i+1], B[i])
    A[i+1] = max(A[i+1]-B[i], 0)
print(ans)


# In[ ]:
n,x=map(int,input().split())
l=list(map(int,input().split()))
sub=[abs(c-x) for c in l]

import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
print(gcd_list(sub))

### FIXED CODE ###

def gcd(a,b):
        while b:
            a,b=b,a%b
        return a
def solve(lis,x):
    if len(lis)==1:
        return abs(lis[0]-x)
    lis=[abs(c-x) for c in lis]
    ans=gcd(lis[0],lis[1])
    for x in lis[2:]:
        if x!=0:
            ans=gcd(ans,x)
    return ans 
n,x=map(int,input().split())
l=list(map(int,input().split()))
print(solve(l,x))
import math
K = int(input())

count = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for q in range(1, K+1):
            count += math.gcd(math.gcd(i,j),q)
print(count)

### FIXED CODE ###

import math

K = int(input())

count = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            count += math.gcd(math.gcd(i,j), k)
print(count)
import re
s = input()

print(re.sub("[a-z]", "x"))

### FIXED CODE ###

import re
s = input()

print(re.sub("[a-z]", "x", s))
s=input()
n=len(s)
if s[0]==s[-1] ^ n%2==0:
  print('Second')
else:
  print('First')

### FIXED CODE ###

n,x=map(int,input().split())
a=list(map(int,input().split()))
eat=0
for i in range(n-1):
  wa=a[i]+a[i+1]
  if wa>x:
    sa=wa-x
    eat+=sa
    if sa<=a[i+1]:
      a[i+1]-=sa
    else:
      a[i+1]=0
print(eat)
n = int(input().strip())
A = [int(s) for s in input().strip().split()]
M = 10 ** 9 + 7

def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)

def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

factors = [0] * 1001
large_factors = {}
for a in A:
    d = 0
    while a % 2 == 0:
        d += 1
        a //= 2
    factors[2] = max(factors[2], d)
    for i in range(3, int(a ** 0.5) + 1, 2):
        d = 0
        while a % i == 0:
            d += 1
            a //= i
        factors[i] = max(factors[i], d)
        if a == 1:
            break
    if a > 1000:
        large_factors.add(a)
    elif a > 1:
        factors[a] = max(factors[a], 1)

m = 1
for k, v in enumerate(factors):
    if v > 0:
        m = (m * pow(k, v, M)) % M
for k in large_factors:
    m = (m * k) % M

result = 0
for a in A:
    result = (result + m * modinv(a, M)) % M
print(result)

### FIXED CODE ###

n = int(input().strip())
A = [int(s) for s in input().strip().split()]
M = 10 ** 9 + 7

def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)

def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m

factors = [0] * 1001
large_factors = set()
for a in A:
    d = 0
    while a % 2 == 0:
        d += 1
        a //= 2
    factors[2] = max(factors[2], d)
    for i in range(3, int(a ** 0.5) + 1, 2):
        d = 0
        while a % i == 0:
            d += 1
            a //= i
        factors[i] = max(factors[i], d)
        if a == 1:
            break
    if a > 1000:
        large_factors.add(a)
    elif a > 1:
        factors[a] = max(factors[a], 1)

m = 1
for k, v in enumerate(factors):
    if v > 0:
        m = (m * pow(k, v, M)) % M
for k in large_factors:
    m = (m * k) % M

result = 0
for a in A:
    result = (result + m * modinv(a, M)) % M
print(result)
a,b=map(int,input().split();print(max(a+b,a-b,a*b)))

### FIXED CODE ###

a,b=map(int,input().split())
i=a+b
j=a-b
k=a*b
biggest=[i,j,k]
biggest_1=sorted(biggest)
print(biggest_1[-1])
s=input()
ans=0
for_ in range(6):
  if s[_]=='1':
    ans+=1
print(ans)


### FIXED CODE ###

s=input()
ans=0
for _ in range(6):
  if s[_]=='1':
    ans+=1
print(ans)
a,b,x=[int(i) for i in input().split()]
count=0
count=[_ for i in range(a,b+1) if i%x==0]
print(len(count))
'''for i in range(a,b+1):
    if(i%x==0):
        count+=1
print(count)'''


### FIXED CODE ###

a,b,x=[int(i) for i in input().split()]
print(b//x-(a-1)//x)
import sys
memo, ans = [], ""

for line in sys.stdin: memo.append(line.strip())

for me in memo:
    for m in me:
        ans = ans+m if m.isdigit() else ans+"@"
print(sum(ans.replace("@", " ").split()))

### FIXED CODE ###

import re
ans = 0
while True:
    try:
        line = input()
    except:
        print(ans)
        break
    ans += sum(map(int, re.findall("[0-9]+", line)))
from math import gcd

N = int(input())
A = sorted(list(map(int, input().split())))
memo = {A[0]:None}
ans = 0

gcd_check = A[0]

for a in A[1:]:
    gcd_result = gcd(gcd_check, a)
    if gcd_result == 1:
        ans += 1
        memo[a] = None
        gcd_check *= a
    elif not gcd_result in memo:
        if gcd_result != a:
            ans += 1
            memo[a] = None
            gcd_check *= a
        else:
            memo[a] = None
    else:
        continue

if A[0] != A[1]:
    ans += 1

print(ans)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
memo = [0]*(10**6+1)

for a in A:
    memo[a] += 1
    if memo[a] < 2:
        for i in range(2*a, 10**6+1, a):
            memo[i] += 1

ans = 0
for a in A:
    if memo[a] == 1:
        ans += 1

print(ans)
N,K=map(int,(input().split()))
TO=list(map(int,input().split()))

visit_flag=[[0]*2 for i in [1]*N]
visit_count=1
first_visit=0
last_visit=0
next_town=1
visit_flag[0][0]=1
visit_flag[0][1]=1

for i in range(K):
    visit_count+=1
    next_town = TO[next_town-1]
    if visit_flag[next_town-1][0]==0:
        visit_flag[next_town-1][0]=1
        visit_flag[next_town-1][1]=visit_count
    else:
        first_visit=visit_flag[next_town-1][1]
        last_visit=visit_count
        break

roop=last_visit-first_visit

if K<=roop:
    next_town = 1
    for i in range(K):     
        next_town = TO[next_town-1]
    ans=next_town
else:
    for i in range((K-roop)%roop):
        next_town = TO[next_town-1]
    ans=next_town

print(ans)


### FIXED CODE ###

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

visit_flag=[[0]*2 for i in [1]*N]
visit_count=0
first_visit=0
last_visit=0
next_town=1
visit_flag[0][0]=1
visit_flag[0][1]=0

for i in range(K):
    visit_count+=1
    next_town = TO[next_town-1]
    if visit_flag[next_town-1][0]==0:
        visit_flag[next_town-1][0]=1
        visit_flag[next_town-1][1]=visit_count
    else:
        first_visit=visit_flag[next_town-1][1]
        last_visit=visit_count
        break

roop=last_visit-first_visit
span=visit_flag[next_town-1][1]

if K<=roop:
    next_town = 1
    for i in range(K):     
        next_town = TO[next_town-1]
    ans=next_town
else:
    if roop==0:
        ans=next_town
    else:
        for i in range((K-span)%roop):
            next_town = TO[next_town-1]
        ans=next_town

print(ans)
N=2*10**5+1
mod=10**9+7
f=[None]*N
f[0]=1
for i in range(1,N):
  f[i]=i*f[i-1]%mod
for i in range(1,N):
  fi[i]=pow(f[i],mod-2,mod)
def com(n,k):
  return f[n]*fi[n-k]%mod*fi[k]%mod
def hcom(n,k):
  return com(n+k-1,n-1)
n,k=map(int,input().split())
ans=1
for i in range(1,min(k,n)):
  ans=(ans+com(n,i)*hcom(n-i,i)%mod)%mod
print(ans)

### FIXED CODE ###

N=2*10**5+1
mod=10**9+7
f=[None]*N
fi=[None]*N
f[0]=1
for i in range(1,N):
  f[i]=i*f[i-1]%mod
for i in range(N):
  fi[i]=pow(f[i],mod-2,mod)
def com(n,k):
  return f[n]*fi[n-k]%mod*fi[k]%mod
def hcom(n,k):
  return com(n+k-1,n-1)
n,k=map(int,input().split())
ans=1
for i in range(1,min(k+1,n)):
  ans=(ans+com(n,i)*hcom(n-i,i)%mod)%mod
print(ans)
s = input()
ans = 1

for i in range(len(s)):
  if i % 2 == 0:
    if s[i] != 'R' OR 'U' OR 'D':
      ans -= 1
  else:
    if s[i] != 'L' OR 'U' OR 'D':
      ans -= 1
      
if ans < 1:
  print("No")
else: print("Yes")

### FIXED CODE ###

s = input()
ans = 1

for i in range(len(s)):
  if i % 2 == 0:
    if s[i] == 'L':
      ans -= 1
  else:
    if s[i] == 'R':
      ans -= 1
     
if ans < 1:
  print("No")
else: print("Yes")
n = int(input())
k = int(input())
 
x = tuple([int(t)for t in input().split()]) 
 
ans = 0
for x_i in x:
  if k-x>x:
    ans+=x*2
  else:
    ans+=(k-x)*2

### FIXED CODE ###

n = int(input())
k = int(input())
 
x = tuple([int(t)for t in input().split()]) 
 
ans = 0
for x_i in x:
  if k-x_i>x_i:
    ans+=x_i*2
  else:
    ans+=(k-x_i)*2
    
print(ans)
s=input()
s=[*s]
sum1=0
for i in range(4):
    if s[i]=='+':
        sum1+=1
    else:
        sum1+=-1
print(sum1)

### FIXED CODE ###

s=input()
s=list(s)
sum1=0
for i in range(4):
    if s[i]=='+':
        sum1+=1
    else:
        sum1+=-1
print(sum1)
S=str(input())
if S=='AAA' or S='BBB':
  print('No')
else:
  print('Yes')

### FIXED CODE ###

S=str(input())
if S!='AAA' and S!='BBB':
  print('Yes')
else:
  print('No')
n=int(raw_input())
ans=''
for i in range(3,n+1):
    if i%3==0 or '3' in str(i):
        ans+=(' '+str(i))
print ans

### FIXED CODE ###

n=int(input())
for i in range(1,n+1):
  if i % 3 == 0 or '3' in str(i):
    print(' {0}'.format(i), end='') 
print('')
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
 
def solve(n):
	#n = readInt()
	i = 1
	maxk = 26
	while 1:
		if n<=maxk:
			ke = i
			break
		else:
			i+=1
			maxk =maxk + 26**i
	#print(ke)
	#ke 桁数
	tar = n
	l= []
	while 1:
		if tar<=26:
			l.append(tar)
			break
		else:
			t = tar%(26**(i-1))
			#t = tar//(26**(i-1))
			t = (tar-t)//(26**(i-1))
			t = min(t,26)
			if t==0:
				l[-1]-=1
				t=26
			l.append(t)
			tar = tar - t*(26**(i-1))
			i-=1
 
	print("".join([chr(96+i) for i in l]))
 
solve(readInt())
#for i in range(1,1000000,26**2):
#	print(i)
#	solve(i)

### FIXED CODE ###

def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
 
def solve(n):
	#n = readInt()
	i = 1
	maxk = 26
	while 1:
		if n<=maxk:
			ke = i
			break
		else:
			i+=1
			maxk =maxk + 26**i
	#print(ke)
	#ke 桁数
	tar = n
	l= []
	while 1:
		a = tar//26
		b = tar%26
		if b==0:
			a-=1
			b = 26
		l.append(chr(ord("a")-1+b))
		tar = a
		if tar==0:
			break
 
	print("".join(l[::-1]))
 
solve(readInt())
#for i in range(1,1000000,26**2):
#	print(i)
#	solve(i)
def main():
  import bisect
  import sys
  from itertools import accumulate
  input = sys.stdin.readline
  def hsnum(x):
    num = 0
    for i in a:
      y = x-i
      num += n-bisect.bisect_left(ls,y)
    return num
  n,m = map(int, input().split())
  a = list(map(int, input().split()))
  a.sort()
  suma = [0]+list(accumulate(a))
  lx = 0
  rx = 2*10**5+2
  error = 0
  while lx < rx:
    mx = (lx+rx)//2
    if hsnum(mx) < m:
      rx = mx
    elif hsnum(mx) > m:
      if hsnum(mx+1) < m:
        error = hsnum(mx)-m
        lx = mx
        break
      lx = mx + 1
    else:
      lx = mx
      break
  ans = 0
  for i in a:
    rema = lx - i
    j = bisect.bisect_left(a,rema)
    ans += (n-j)*i+suma[n]-suma[j]
  print(ans-error*lx)
if __name__ == "__main__":
    main()

### FIXED CODE ###

s,t=input().split()
print(t+s)
a, b, c = [int(input()) for_in range(3)]
if a == b != c or b == c != a or c == a != b:
  print(2)
elif (a == b == c):
  print(1)
else:
  print(3)

### FIXED CODE ###

color = list(map(int,input().split()))
print(len(set(color)))
# code like professional " write main function"
import os
import sys
from collections import defaultdict
adj = defaultdict(list)
col = defaultdict(int)
sys.setrecursionlimit(1000000)
mx=0
edges = {}
# finding maximum color we need it would be maximum neighbouring nodes of out of all the nodes
def find_color(u , p):
	global mx , now
	cnt =0
	for i in adj[u]:
		cnt = cnt+1
		if i==p:
			continue
		find_color(i , u)
	mx = max(mx, cnt)
now =0
# now color the edges 
def dfs(u , p, prev):
	global mx, now
	for i in adj[u]:
		if i==p:
			continue
		# if current color is equivalent to previous edge color use next color
		if now == prev:
			now = (now+1)%mx
		col[edges[i,u]]=now
		now =(now+1)%mx
	for i in adj[u]:
		if i==p:
			continue
		dfs(i , u, col[edges[i, u]])

def main():
	n = int(input())
	for i in range(n-1):
		x, y = map(int , input().split())
		adj[x].append((y))
		adj[y].append((x))
		edges[x,y]=i
		edges[y,x]=i
	find_color(1, 0)
	dfs(1, 0,-1)
	print(mx)
	for i in range(n-1):
		print(col[i]+1)


if __name__ == "__main__":
	main()

### FIXED CODE ###

import sys
import os
sys.setrecursionlimit(1000000)
from collections import defaultdict
adj = defaultdict(list)
dis =[0 for i in range(1000000)]
def dfs(u , p):
	for i , w in adj[u]:
		if i==p:
			continue
		dis[i]=dis[u]+w
		dis[i]=dis[i]%2
		dfs(i , u)
def main():
	n = int(input())
	for i in range(n-1):
		x, y , w = map(int , input().split())
		w = w%2
		adj[x].append([y , w])
		adj[y].append([x, w])
	dfs(1, 0)
	for i in range(1,n+1):
		print(dis[i])
if __name__ =="__main__":
	main()
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
N, M = [int(x) for x in input().split()]

S =[]
for j in range (M):
    a = [x for x in input().split()]
    k = a[0]
    s = [int(x) for x in a[1:]]
    S.append(s)
P = [int(x) for x in input().split()]
ans = 0
for i in range (2**N):
    n = format(i,'b').zfill(N)
    
    count = 0
    for j in range (M):
        count2 = 0
        for k in range (len(S[j])):
            count2 += int(n[S[j][k]-1])
        if count2 %2 == P[j]:
            count += 1
    if count == M:
        ans += 1

print(ans)
        



 
    






### FIXED CODE ###

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
A,P = [int(x) for x in input().split()]
print(int((3*A+P)//2))
T=list(input())
if T[0]=='?' and T[1]=='D':
  T[0]='P'
elif T[0]=='?' and T[1]=='?':
  T[0]='P'
elif T[0]=='?' and T[1]=='P':
  T[0]='D'
for i in range(1,len(T)-1):
  if T[i]=='?' and T[i+1]=='D'and T[i-1]=='P':
    T[i]='D'
  elif T[i]=='?' and T[i+1]=='D':
    T[i]='P'
  elif T[i]=='?' and T[i+1]=='P':
    T[i]='D'
  elif T[i]=='?' and T[i+1]=='?':
    T[i]='P'
if T[-1]=='?':
  T[-1]='D'
  
print(''.join(T))

### FIXED CODE ###

T=list(input())
if len(T)==1:
  print('D')
  exit()
if T[0]=='?' and T[1]=='D':
  T[0]='P'
elif T[0]=='?' and T[1]=='?':
  T[0]='P'
elif T[0]=='?' and T[1]=='P':
  T[0]='D'
for i in range(1,len(T)-1):
  if T[i]=='?' and T[i-1]=='P':
    T[i]='D'
  elif T[i]=='?' and T[i+1]=='D':
    T[i]='P'
  elif T[i]=='?' and T[i+1]=='P':
    T[i]='D'
  elif T[i]=='?' and T[i+1]=='?':
    T[i]='P'
if T[-1]=='?':
  T[-1]='D'
  
print(''.join(T))
N, T = map(int, input().split())
dic = {}
for i in range(N):
    c, t = map(int, input().split())
    dic[t].append(c)
if max(dic) <= T:
    print(dic[max(dic)])
else:
    print('TLE')

### FIXED CODE ###

N, T = map(int, input().split())
costs = []
for i in range(N):
    c, t = map(int, input().split())
    if t <= T:
        costs.append(c)
if len(costs) == 0:
    print('TLE')
else:
    print(min(costs))
data =[int(i) for i in input().split()]

data.sort()
print("{0}{1}{2}",format(data[0],data[1],data[2]))

### FIXED CODE ###

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

data.sort()
print("{0} {1} {2}".format(data[0],data[1],data[2]))
N = input()
a = [input() for i in range(N)]

if max(a)　>　sum(a) - max(a):
  print(Yes)
  else
      print(No)

### FIXED CODE ###

n=input()
a=list(map(int, input().split()))
if max(a)*2 < sum(a):
    print("Yes")
else:
    print("No")
a=[int(input()) for i in range(6)]
if (a[4]-a[0]>=a[5]):
  print'Yay!'
  else print ':('

### FIXED CODE ###

a=[int(input()) for i in range(6)]
b=a[4]-a[0]
if a[5]>=b:
    print('Yay!')
else:
    print(':(')
N = int(input())
S = input()
list = [str(x) for x in S]
index = 0
abc = 0
for alphabet in list:
  if alphabet == "A" and list[index + 1] == "B" and list[index + 2] == "C":
    abc += 1
  index += 1
print(abc)

### FIXED CODE ###

n = int(input())
s = input()
print(s.count("ABC"))
N = int(input())
AB = [list(map(int,input().split())) for _ in range(N)]

MOD = 1000000007
from collections import defaultdict
dd = defaultdict(int,{})
for a,b in AB:
  dd[-b/a] += 1
  
ans = 0
N -= 1
for a,b in AB:
  if N - dd[a/b]>=0:
    print(N-dd[a/b])
    ans += pow(2,(N - dd[a/b]),MOD)
    ans %= MOD
  dd[-b/a] -= 1
  N -= 1
  
print(ans%MOD) 

### FIXED CODE ###

def main():
  from math import gcd
  from collections import defaultdict
  import sys
  input = sys.stdin.readline
  N = int(input())
  AB = [list(map(int,input().split())) for _ in range(N)]

  MOD = 10**9 + 7

  zero_zero_count = 0
  zero_one_count = 0
  one_zero_count = 0
  dd_ba = defaultdict(int, {})
  for a,b in AB:
    if (a==0)and(b==0):
      zero_zero_count += 1
    elif (a==0):
      zero_one_count += 1
    elif (b==0):
      one_zero_count += 1
    else:
      if a * b < 0:
        a = abs(a)
        b = abs(b)
        g = gcd(a, b)
        dd_ba[(b//g, a//g)] += 1
      else:
        a = abs(a)
        b = abs(b)
        g = gcd(a, b)
        dd_ba[(-b//g, a//g)] += 1

  ans = (2**zero_one_count + 2**one_zero_count -1)
  dd_flag = defaultdict(bool, {})

  for key,value in tuple(dd_ba.items()):
    if dd_flag[key]:
      continue
    
    key_0 = key[0]
    key_1 = key[1]
    if key_0<0:
      x = (key_1, -key_0)
    else:
      x = (-key_1, key_0)
    y = dd_ba[x]
    ans *= (2**y + 2**value - 1) % MOD
    ans %= MOD
    dd_flag[x] = True

  ans += zero_zero_count - 1
  print(ans%MOD) 

if __name__=='__main__':
  main()
s = input()
t = input()
flag = False
tq = '?'*len(t)
start = []
for i in range(len(s)-len(t)+1):
    if s[i] == t[0]:
        start.append(i)
        for j in range(len(t)):
            if s[i+j] == t[j] or s[i+j] == '?':
                continue
            else:
                start.pop(-1)
    if s[i:i+len(t)] == tq:
        start.append(i)
stal = []
if start:
    for i in start:
        stal.append(s[:i].replace('?','a') + t + s[i+len(t):].replace('?','a'))
    stal.sort()
    print(stal[0])
else:
    print('UNRESTORABLE')

### FIXED CODE ###

s = input()
t = input()
flag = False
tq = '?'*len(t)
start = []
for i in range(len(s)-len(t)+1):
    flag = True
    for j in range(len(t)):
        if s[i+j] == t[j] or s[i+j] == '?':
            continue
        else:
            flag = False
            break
    if flag:
        start.append(i)
    
stal = []
if start:
    for i in start:
        stal.append(s[:i].replace('?','a') + t + s[i+len(t):].replace('?','a'))
    stal.sort()
    print(stal[0])
else:
    print('UNRESTORABLE')
# -*- coding: utf-8 -*-
import math
def main():
    A,B,C,D = map(int,input().split())
    E = (C*D)//math.gcd(C,D)
    Cc = B / C
    Dd = B / D
    Ee = B / E
    flo = A-1
    Cf = flo / C
    Df = flo / D
    Ef = flo / E
    All = B-(math.floor(Cc)+math.floor(Dd)-math.floor(Ee))
    Sub = flo-(math.floor(Cf)+math.floor(Df)-math.floor(Ef))
    print(All - Sub)
if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*-
def main():
    S = list(str(input()))
    #print(S)
    for i in range(len(S)):
        if i == 0:
            t = int(S[0])
            continue
        else:
            t = int(S[i-1])
            #print(t)
            if t == int(S[i]):
                print('Bad')
                return
    print('Good')


if __name__ == '__main__':
    main()
def ans(n, x):
	if x < 1:
		return 0
	if x < 2 ** (n + 1) - 1:
		return ans(n - 1, x - 1)
	if x == 2 ** (n + 1) - 1:
		return 2 ** n
	return 2 ** n + ans(n - 1, x - 2 ** (n + 1) + 1)
N, X = map(int, input().split())
print(ans(N, X))

### FIXED CODE ###

def ans(n, x):
	if n < 0:
		return 0
	if x < 1:
		return 0
	if x < 2 ** (n + 1) - 1:
		return ans(n - 1, x - 1)
	if x == 2 ** (n + 1) - 1:
		return 2 ** n
	return 2 ** n + ans(n - 1, x - 2 ** (n + 1) + 1)
N, X = map(int, input().split())
print(ans(N, X))