Harryxun/stf_run huggingface dataset:
a = int(input())
b = list(map(int,list(a)))

if a / sum(b) == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a = input()
b = list(map(int,list(a)))

if int(a) % sum(b) == 0:
  print("Yes")
else:
  print("No")
from collections import Counter as ct
import sys
input = sys.stdin.readline

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

if c[0] == n:
    print("Yes")
elif len(c) == 2 and c[0] * 3 == n:
    print("Yes")
elif len(c) == 3 and len(set(c.values())) == 1 and :
    a, b, c = c.keys()
    if (a ^ b ^ c) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")

### FIXED CODE ###

from collections import Counter as ct
import sys
input = sys.stdin.readline

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

if c[0] == n:
    print("Yes")
elif len(c) == 2 and c[0] * 3 == n:
    print("Yes")
elif len(c) == 3 and len(set(c.values())) == 1:
    a, b, c = c.keys()
    if (a ^ b ^ c) == 0:
        print("Yes")
    else:
        print("No")
else:
    print("No")
"""
Bellman-Ford
始点と終点が決められているとき、
経由する閉路のみを確認する必要がある。
"""
def Bellman_Ford2(g,start,goal):
    n = len(g)    
    dist = [float("inf")]*n
    dist[start] = 0
    a0 = float("inf")
    for i in range(2*n):
        updated = False
        for v in range(n):
            for to, cost in g[v]:
                if dist[to] <= dist[v] + cost: continue
                if i < n:
                    dist[to] = dist[v] + cost
                else:
                    dist[to] = -float("inf")
                updated = True
        if not updated: break
    if dist[goal] == -float("inf"): return None, False
#    if negative[-1]: return None, False
    return dist, True
 

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,m,p = [int(i) for i in readline().split()]
g = [[] for _ in range(n)]
for i in range(m):
    a,b,c = [int(i) for i in readline().split()]
    g[a-1].append((b-1,-c))
#    g[b-1].append((a-1,c))

dist, TF = Bellman_Ford2(g,0,-1)

if TF: print(-dist[-1])
else: print("inf")


### FIXED CODE ###

# coding: utf-8
# Your code here!

def Bellman_Ford(g,start):
    n = len(g)    
    dist = [float("inf")]*n
    dist[start] = 0
    a0 = float("inf")
    negative = [False]*n
    for i in range((2*n)):
        updated = False
        for v in range(n):
            for to, cost in g[v]:
                if negative[v]: negative[to] = True
                if dist[to] <= dist[v] + cost: continue
                dist[to] = dist[v] + cost
                updated = True
                if i >= n:
                    negative[to] = True
        if not updated: break
    if negative[-1]: return None, False
    return dist, True


import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n,m = [int(i) for i in readline().split()]
g = [[] for _ in range(n)]
for i in range(m):
    a,b,c = [int(i) for i in readline().split()]
    g[a-1].append((b-1,-c))
#    g[b-1].append((a-1,c))

dist, TF = Bellman_Ford(g, 0)

if TF: print(-dist[-1])
else: print("inf")
N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())

minW = min(w)
for i in range(N):
    w[i] -= minW

INF = int(1e9)
dp = [[-INF] * (3 * N + 1) for i in range(N+1)]

dp[0][0] = 0
ans = 0
for i in range(N):
    for j in range(N, 0, -1):
        for k in range(3 * N + 1):
            if k + w[i] + minW * j <= W:
                dp[j][k+w[i]] = max((dp[j][k+w[i]], dp[j-1][k] + v[i]))
                ans = max((ans, dp[j][k+w[i]]))
# print('\n'.join(map(str, dp)))
print(ans)


### FIXED CODE ###

N, W = map(int, input().split())
w, v = [0] * N, [0] * N
for i in range(N):
    w[i], v[i] = map(int, input().split())
minW = min(w)
for i in range(N):
    w[i] -= minW
MAX_W = 3 * 100
MAX_V = int(1e9)
INF = MAX_V + 2
dp = [[-INF] * (MAX_W + 10) for i in range(N+1)]
dp[0][0] = 0
for i in range(N):
    for j in range(MAX_W, -1, -1):
        for k in range(N-1, -1, -1):
            dp[k+1][j+w[i]] = max((dp[k+1][j+w[i]], dp[k][j] + v[i]))

ans = 0
for i in range(N+1):
    for j in range(MAX_W + 1):
        if i * minW + j <= W:
            # print('i * minW: %d, j: %d, dp: %d' % (i*minW, j, dp[i][j]))
            ans = max((ans, dp[i][j]))

print(ans)
n, m = map(int, input())
if n == m:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

input_numbers = list(map(int,input().split()))
n = input_numbers[0]
m = input_numbers[1]
if n == m:
  print("Yes")
else:
  print("No")
import sys

sys.setrecursionlimit(10000)

H,W=map(int,input().split())
Ch,Cw=map(int,input().split())
Dh,Dw=map(int,input().split())
maze=[]

for i in range(H):
  l=list(input())
  for j in range(len(l)):
    if l[j]=='.':l[j]=-1
    if l[j]=='#':l[j]=-2
  maze.append(l)
def isIn(h,w):
  if h<0 or h>=H or w<0 or w >=W:return False
  return True
def update(maze,h,w,value,l):
  global update_list
  vectors=[[-1,0],[1,0],[0,1],[0,-1]]
  maze[h][w]=value
  update_list=l
  u=[]
  for i in range(25):
    if not isIn(h+i//5-2,w+i%5-2):continue
    if maze[h+i//5-2][w+i%5-2]>maze[h][w] or maze[h+i//5-2][w+i%5-2]==-1:
      if [h+i//5-2,w+i%5-2] not in u:
        u.append([h+i//5-2,w+i%5-2])
        maze[h+i//5-2][w+i%5-2]=value+1
  for vector in vectors:
    if not isIn(h+vector[0],w+vector[1]):continue
    if maze[h+vector[0]][w+vector[1]]>maze[h][w] or maze[h+vector[0]][w+vector[1]]==-1:
      maze[h+vector[0]][w+vector[1]]=maze[h][w]
      update(maze,h+vector[0],w+vector[1],value,l)
      
  for h,w in u:
    if maze[h][w]==value+1 and not [h,w] in update_list:
      update_list.append([h,w])
  return update_list

already=0
def calc(update_list,value):
  for h,w in update_list:
    if maze[h][w]!=-1 and maze[h][w]<value:continue
    u=update(maze,h,w,value,[])
    calc(u,value+1)

update_list=update(maze,Ch-1,Cw-1,0,[])
calc(update_list,1)
print(maze[Dh-1][Dw-1])

### FIXED CODE ###

from collections import deque
H,W=map(int,input().split())
Ch,Cw=map(int,input().split())
Dh,Dw=map(int,input().split())
maze=[]

for i in range(H):
  l=list(input())
  for j in range(len(l)):
    if l[j]=='.':l[j]=-1
    if l[j]=='#':l[j]=-2
  maze.append(l)

def isIn(h,w):
  if h<0 or h>=H or w<0 or w >=W:return False
  return True
l=[[Ch-1,Cw-1]]
l=deque(l)
maze[Ch-1][Cw-1]=0
l2=[[0]*W for i in range(H)]

cnt=0
while l:
  cnt+=1
  vectors=[[-1,0],[1,0],[0,1],[0,-1]]

  target=l[0]
  h,w=target
  l.popleft()
  if l2[h][w]:
    continue
  l2[h][w]=1
  for vector in vectors:
    if not isIn(h+vector[0],w+vector[1]):continue
    if maze[h+vector[0]][w+vector[1]]>maze[h][w] or maze[h+vector[0]][w+vector[1]]==-1:
      maze[h+vector[0]][w+vector[1]]=maze[h][w]
      l.appendleft([h+vector[0],w+vector[1]])
  for i in range(25):
    if not isIn(h+i//5-2,w+i%5-2):continue
    if maze[h+i//5-2][w+i%5-2]>maze[h][w] or maze[h+i//5-2][w+i%5-2]==-1:
      maze[h+i//5-2][w+i%5-2]=maze[h][w]+1
      l.append([h+i//5-2,w+i%5-2])
print(maze[Dh-1][Dw-1])
from collections import defaultdict
def dfs(node_i):
    is_visited[node_i] = 1
    for bi in tree[node_i]:
        if is_visited[bi]:
            continue
        tree_x[bi] += tree_x[node_i]
        dfs(bi)

N, Q = map(int, input().split())
# tree = [[] for i in range(N)]
tree = defaultdict(list)
tree_x = [0 for i in range(N)]
is_visited = [0]*N
for i in range(N-1):
    a, b = map(int, input().split())
    am1 = a-1
    bm1 = b-1
    tree[bm1].append(am1)
    tree[am1].append(bm1)

# print(tree)
for q in range(Q):
    p, x = map(int, input().split())
    tree_x[p-1] += x

dfs(0)

print(' '.join(map(str, tree_x)))


### FIXED CODE ###

N, Q = map(int, input().split())
tree = [[] for i in range(N+1)]
counter = [0] * (N+1)

for i in range(N-1):
    a, b = map(int, input().split())
    tree[b].append(a)

for i in range(Q):
    p, x = map(int, input().split())
    counter[p] += x
for i in range(1, N+1):
    for pn in tree[i]:
        counter[i] += counter[pn]

print(' '.join(map(str, counter[1:])))
s = str(input())

if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

s = str(input())
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")
import math
n=int(input())
ar=list(map(int,input().split()))

an=ar[0]
for x in range(1,len(ar)):
	an=(an*ar[x])/math.gcd(an,ar[x]);
print(an)

### FIXED CODE ###


def computeGCD(x, y): 
   while(y):
   		x, y = y, x % y
   return x 
n=int(raw_input())
ar=[]
for i in range(0,n):
	k=int(raw_input())
	ar.append(k)

an=ar[0]
for x in range(1,n):
	an=(an*ar[x])/computeGCD(an,ar[x]);
print(an)
import os
import sys
import datetime

def main():
    sDate = datetime.datetime.strptime("2019/04/30", '%Y/%m/%d')
    args = sys.argv
    argdate = ""

    if len(args) == 1:
        print("Error: invalid arguments.")
        return 2

    datestr = args[1]

    try:
        argdate = datetime.datetime.strptime(datestr, '%Y/%m/%d')
    except:
        print("Error: illegal date format.")
        return 1

    if argdate <= sDate:
        print("Heisei")
    else:
        print("TBD")

    return 0

if __name__ == '__main__':
    sys.exit(main())

### FIXED CODE ###

import os
import sys
import datetime

def main():
    sDate = datetime.datetime.strptime("2019/04/30", '%Y/%m/%d')

    inputdate = input()

    try:
        inputdate = datetime.datetime.strptime(inputdate, '%Y/%m/%d')
    except:
        print("Error: illegal date format.")
        return 1

    if inputdate <= sDate:
        print("Heisei")
    else:
        print("TBD")

    return 0

if __name__ == '__main__':
    sys.exit(main())
r=range;_,*s=open(0)
h,w,k=map(int,_.split())
m=9e9
for i in r(1<<h-1):
  t,v,l=[],-1,1
  for j in r(h):
    if i>>j&1:t+=j+1,;l+=1
  t+=h,
  c=[0]*l
  for i in r(w):
    b=f=g=0;u=[]
    for j in r(l):d,b=sum(s[j][i]>"0"for j in r(b,t[j])),t[j];u+=d,;g|=d>k;c[j]+=d;f|=c[j]>k
    v+=f
    if f:c=u
  if not g:m=min(m,v+l)
print(m)

### FIXED CODE ###

from collections import Counter
_, *a = map(int, open(0).read().split())
c = Counter(a)
s = sum(c*~-c // 2 for c in c.values())
for k in a:
    print(s - c[k] + 1)
A=map(int,input().split())
list = []
for n in range(A):
	con = str(input())
	if con not in list:
		list.append(con)
	else: pass
print(str(len(list)))


### FIXED CODE ###

n = int(input())
s = set(input() for _ in range(n))
print(len(s))
def B():
    a = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    b = [list(map(int,input().split())) for i in range(n)]
    for bingo in b:
        for i in range(3):
            for j in range(3):
                if a[i][j] == bingo:
                    a[i][j] = 0
    for i in range(3):
        if all(a[i][j] == 0 for in range(3)):
            print("Yes")
            return
        if all(a[j][i] == 0 for in range(3)):
            print("Yes")
            return
    if (a[0][0] == a[1][1] == a[2][2] == 0) or (a[0][2] == a[1][1] == a[2][0] == 0):
        print("Yes")
        return

    print("No")
B()

### FIXED CODE ###

def B():
    mat = [list(map(int,input().split())) for i in range(3)]
    n = int(input())
    #b = [list(map(int,input().split())) for i in range(n)]
    for bingo in  (int(input()) for _ in range(n)):
        for i in range(3):
            for j in range(3):
                if mat[i][j] == bingo:
                    mat[i][j] = 0
    for i in range(3):
        if all(mat[i][j] == 0 for j in range(3)):
            print('Yes')
            break
        if all(mat[j][i] == 0 for j in range(3)):
            print('Yes')
            break
    else:
        if mat[0][0] == mat[1][1] == mat[2][2] == 0 or\
                mat[0][2] == mat[1][1] == mat[2][0] == 0:
            print('Yes')
        else:
            print('No')
B()
import sys


def solve(n, m, links, parents):
    if m % 2 == 1:
        print(-1)
        return

    fixed = [len(l) % 2 == 0 for l in links]

    def reverse_links(s, t):
        v = s
        while v != t:
            p = parents[v]
            links[p][v] ^= 1
            v = p

    tmp_trace = set()
    tmp_pair = -1
    for v in range(n):
        if fixed[v]:
            continue
        if tmp_pair == -1:
            u = v
            while u != -1:
                tmp_trace.add(u)
                u = parents[u]
            tmp_pair = v
        else:
            u = v
            while u != -1:
                if u in tmp_trace:
                    reverse_links(v, u)
                    reverse_links(tmp_pair, u)
                    break
                u = parents[u]
            else:
                raise AssertionError
            tmp_trace.clear()
            tmp_pair = -1

        # print(v, tmp_vertices, tmp_pair)

    assert tmp_pair == -1

    ans = []
    for v in range(n):
        for u, d in links[v].items():
            if d == 0:
                ans.append('{} {}'.format(v + 1, u + 1))
            else:
                ans.append('{} {}'.format(u + 1, v + 1))
    print('\n'.join(ans))


n, m = list(map(int, input().split()))
links = [{} for _ in range(n)]
parents = [-1] * n
for line in sys.stdin:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    if a > b:
        a, b = b, a
    links[a][b] = 0
    parents[b] = a
solve(n, m, links, parents)


### FIXED CODE ###

import sys
from collections import deque

sys.setrecursionlimit(10 ** 5)


def solve(n, m, links):
    if m % 2 == 1:
        print(-1)
        return

    tree = [set() for _ in range(n)]
    parents = [-1] * n
    q = deque([0])
    while q:
        v = q.popleft()
        for u in links[v]:
            if parents[u] == -1:
                tree[v].add(u)
                parents[u] = v
                q.append(u)
            links[u].remove(v)

    parities = [len(l) % 2 for l in links]

    # print(links)
    # print(tree)
    # print(parents)
    # print(parities)

    def dfs(v):
        b = parities[v]
        for u in tree[v]:
            c = dfs(u)
            b ^= c
        if b:
            p = parents[v]
            links[p].remove(v)
            links[v].add(p)
        return b

    dfs(0)

    ans = ['{} {}'.format(v + 1, u + 1) for v in range(n) for u in links[v]]
    print('\n'.join(ans))


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

links = [set() for _ in range(n)]
for line in sys.stdin:
    a, b = map(int, line.split())
    a -= 1
    b -= 1
    links[a].add(b)
    links[b].add(a)

solve(n, m, links)
import math
N = int(input())
print(math.factorial(N)/(10*9+7))

### FIXED CODE ###

import math
N = int(input())
print(math.factorial(N)%(10**9+7))
n,q=map(int,input().split())

l=[list() for i in range(n)]
s=[0]*n
c=[0]*n

def ladd(p,q):
  s[p]=c[p]+q
  for i in l[p]:
    ladd(i,s[p])

for i in range(n-1):
  a,b=map(int,input().split())
  l[a-1].append(b-1)

for i in range(q):
  p,q=map(int,input().split())
  c[p-1]+=q

ladd(0,0)

for i in range(n):
  print(s[i],' ',end="")
print()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input=sys.stdin.readline

n,q=map(int,input().split())
t=[[] for _ in range(n)]
c=[0 for _ in range(n)]

for i in range(n-1):
  a,b=map(int,input().split())
  t[a-1].append(b-1)
  t[b-1].append(a-1)

for i in range(q):
  p,x=map(int,input().split())
  c[p-1]+=x

def dsf(ci,pi):
  for i in t[ci]:
    if i != pi:
      c[i] += c[ci]
      dsf(i, ci)

dsf(0,-1)

print(*c)
N,Q=map(int,input().split())
S=input()
C=[0]*N

for i in range(1,N):
    if S[i-1:i+1]=="AC":
        C[i]+=1

for i in range(Q):
    l,r=map(int,input().split())
    print(C[r]-C[i])



### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
SC = [0] * N

for i in range(N - 1):
    if S[i:i + 2] == "AC":
        SC[i + 1] = SC[i] + 1
    else:
        SC[i + 1] = SC[i]

for i in range(Q):
    l, r = map(int, input().split())
    print(SC[r - 1] - SC[l - 1])
i = list(map(int,input().split()))
f = 0
for x in range(i[1],i[2]+1):
    if x % i[0] == 0:
        f = 1

if f == 1:
    print("OK")
else:
    print("No")

### FIXED CODE ###

i = int(input())
i2 = list(map(int,input().split()))

f = 0
for x in range(i2[0],i2[1]+1):
    if x % i == 0:
        f = 1

if f == 1:
    print("OK")
else:
    print("NG")
import collections
import math

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

count = collections.Counter(S)
c_value = list(count.values())
con = c_value[0]*c_value[1]*c_value[2]

for i in range(N):
    for j in range(i+1, int(math.ceil((N+i)/2))):
        if S[i] != S[j]:
            if S[i] != S[j + (j - i)] and S[j] != S[j + (j - i)]:
                con -= 1

print(con)


### FIXED CODE ###

import collections
import math

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

if 'R' in S and 'G'in S and 'B' in S:
    count = collections.Counter(S)
    c_value = list(count.values())
    con = c_value[0]*c_value[1]*c_value[2]
else:
    con = 0

for i in range(N):
    for j in range(i+1, int(math.ceil((N+i)/2))):
        if S[i] != S[j]:
            if S[i] != S[j + (j - i)] and S[j] != S[j + (j - i)]:
                con -= 1

print(con)
n, k = map(int, input().split())
v = list(map(int, input().split()))
r = min(n, k)
ans = -float('inf')
for i in range(r+1):
    a = v[:i]
    for j in range(r+1-i):
        candi=a[:]
        if j !=0 :candi += v[-j:]
        candi.sort()
        for t in range(k-i-j):
            if not 0<=t<len(candi):break
            if candi[t] < 0:
                candi[t] = 03023
            else:
                break
        candi = sum(candi)
        ans = max(candi, ans)
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
n, k = map(int, input().split())
v = list(map(int, input().split()))
r = min(n, k)
ans = -float('inf')
for i in range(r+1):
    a = v[:i]
    for j in range(r+1-i):
        candi = a[:]
        if j != 0:
            candi += v[-j:]
        candi.sort()
        for t in range(k-i-j):
            if not 0 <= t < len(candi):
                break
            if candi[t] < 0:
                candi[t] = 0
            else:
                break
        candi = sum(candi)
        ans = max(candi, ans)
print(ans)
l,r=list(map(int,input().split()))
ans=[]
if r-l==1:print(r*l%2019)
else:
  for i in range(l,r-1):
    for j in range(l+1,r):
      ans.append(i*j%2019)
print(min(ans))
  

### FIXED CODE ###

l,r=list(map(int,input().split()))
m=2018
for i in range(l,min(r+1,l+2019)):
  for j in range(i+1,min(r+1,l+2019)):
    m=min(m,i*j%2019)
print(m)
# 2019/03/16
# AtCoder Grand Contest 031 - A

# Input
n = int(input())
s = input()

aprcnt = [1] * 26

# Count up Alphabets
for idx in range(n):
    w_idx = ord(s[idx]) - 97
    aprcnt[w_idx] += 1

# Calc Combination count
ans = 1
for idx in range(n):
    ans = ans * aprcnt[idx]

# Reduces 1 in choose nothing case
ans -= 1

# Output
print(ans)


### FIXED CODE ###

# 2019/03/17
# AtCoder Grand Contest 031 - A

# Input
n = int(input())
s = input()

aprcnt = [1] * 26

# Count up Alphabets
for idx in range(n):
    w_idx = ord(s[idx]) - 97
    aprcnt[w_idx] += 1

# Calc Combination count
ans = 1
for idx in range(26):
    ans = ans * aprcnt[idx]

# Reduces 1 in choose nothing case
ans -= 1
ans = ans % (10**9 + 7)

# Output
print(ans)
import math
ans = []
while True:
    ufo = []
    n = raw_input().split()
    if n == ["0", "0"]:
        for an in ans:
            print an
        break
    else:
        R = int(n[0])
        for i in range(int(n[1])):
            m = [int(f) for f in raw_input().split()]
            l = math.sqrt(m[0] ** 2 + m[1] ** 2)
            ufo.append([l, l, (m[0], m[1]), m[2], m[3]])
        a = 0
        while len(ufo) > 0:
            flag = True
            for xs in ufo: xs[0] -= xs[4]
            ufo.sort()
            for xs in ufo[:]:
                if xs[0] <= R:
                    a += 1
                    ufo.remove(xs)
                    continue
                elif flag:
                    r = xs[1]
                    pos = xs[2]
                    ufo.remove(xs)
                    flag = False
                    continue
                else:
                    d = xs[0] / xs[1] * abs(pos[0] * xs[2][1] - pos[1] * xs[2][0]) / r
                    if d <= xs[3]:
                        if xs[0] * math.cos(math.atan2(xs[2][1], xs[2][0]) - math.atan2(pos[1], pos[0])) + math.sqrt(xs[3] ** 2 - d ** 2) > R:
                            ufo.remove(xs)
        else:
            ans.append(a)

### FIXED CODE ###

import math
ans = []
while True:
    ufo = []
    n = raw_input().split()
    if n == ["0", "0"]:
        for an in ans:
            print an
        break
    else:
        R = int(n[0])
        for i in range(int(n[1])):
            m = [int(f) for f in raw_input().split()]
            l = math.sqrt(m[0] ** 2 + m[1] ** 2)
            ufo.append([l, l, (m[0], m[1]), m[2], m[3]])
        a = 0
        while len(ufo) > 0:
            flag = True
            for xs in ufo: xs[0] -= xs[4]
            ufo.sort()
            for xs in ufo[:]:
                if xs[0] <= R:
                    a += 1
                    ufo.remove(xs)
                    continue
                elif flag:
                    r = xs[1]
                    pos = xs[2]
                    ufo.remove(xs)
                    flag = False
                    continue
                else:
                    d = xs[0] / xs[1] * abs(pos[0] * xs[2][1] - pos[1] * xs[2][0]) / r
                    if d <= xs[3]:
                        if xs[0] * math.cos(math.atan2(xs[2][1], xs[2][0]) - math.atan2(pos[1], pos[0])) + math.sqrt(xs[3] ** 2 - d ** 2) > R:
                            ufo.remove(xs)
        else:
            ans.append(a)
N, X = map(int, input().split())

layers = [1]
patties = [1]

for i in range(1, N+1):
	layer_i = 2 * layers[i-1] + 3
	patty_i = 2 * patties[i-1] + 1
	layers.append(layer_i)
	patties.append(patty_i)
	
def f(n, x):
	if x == 1:
		return 0
		
	elif 1 < x <= 1 + layers[n-1]:
		return f(n-1, x-1)
		
	elif x == 2 + layers[n-1]:
		return patties[n-1] + 1
		
	elif 2 + layers[n-1] < x <= 2 + 2 * layers[n-1]:
		return patties[n-1] + 1 + f(n-1, x-2-layers[n-1])
	elif x == 3 + 2 * layers[n-1]:
		return 2 * patties[n-1] + 1
		
print(f(N, X))N, X = map(int, input().split())

layers = [1]
patties = [1]

for i in range(1, N+1):
	layer_i = 2 * layers[i-1] + 3
	patty_i = 2 * patties[i-1] + 1
	layers.append(layer_i)
	patties.append(patty_i)
	
def f(n, x):
	if x == 1:
		return 0
		
	elif 1 < x <= 1 + layers[n-1]:
		return f(n-1, x-1)
		
	elif x == 2 + layers[n-1]:
		return patties[n-1] + 1
		
	elif 2 + layers[n-1] < x <= 2 + 2 * layers[n-1]:
		return patties[n-1] + 1 + f(n-1, x-2-layers[n-1])
	elif x == 3 + 2 * layers[n-1]:
		return 2 * patties[n-1] + 1
		
print(f(N, X))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)
N, X = map(int, input().split())

layers = [1]
patties = [1]

for i in range(1, N+1):
	layer_i = 2 * layers[i-1] + 3
	patty_i = 2 * patties[i-1] + 1
	layers.append(layer_i)
	patties.append(patty_i)
	
def f(n, x):
	if x == 1:
		return 1 if n == 0 else 0
		
	elif 1 < x <= 1 + layers[n-1]:
		return f(n-1, x-1)
		
	elif x == 2 + layers[n-1]:
		return patties[n-1] + 1
		
	elif 2 + layers[n-1] < x <= 2 + 2 * layers[n-1]:
		return patties[n-1] + 1 + f(n-1, x-2-layers[n-1])
		
	else:
		return 2 * patties[n-1] + 1
		
print(f(N, X))
def ans():
  s = input()
  k = int(input())
  for i in range(k+1):
    if s[i] != '1':
      print(s[i])
      return
  print("1")
  return

ans()

### FIXED CODE ###

def ans():
  s = input()
  k = int(input())
  for i in range(k):
    if s[i] != '1':
      print(s[i])
      return
  print("1")
  return

ans()
s=[i for i in input()]
t=[i for i in input()]
a=0
for i in range(len(s)):
    if s==t:
        a+=1
    s=[s[i] for i in range(-1,len(s)-1)]
print("Yes" if a>=1 else "No")s=[i for i in input()]
t=[i for i in input()]
a=0
for i in range(len(s)):
    if s==t:
        a+=1
    s=[s[i] for i in range(-1,len(s)-1)]
print("Yes" if a>=1 else "No")

### FIXED CODE ###

s=[i for i in input()]
t=[i for i in input()]
a=0
for i in range(len(s)):
    if s==t:
        a+=1
    s=[s[i] for i in range(-1,len(s)-1)]
print("Yes" if a>=1 else "No")
import math
r = float(import())
s = r * r * math.pi
l = r * 2 * math.pi
print('%.5f %.5f' % (s, l))

### FIXED CODE ###

import math
r = float(input())
s = r * r * math.pi
l = r * 2 * math.pi
print('%.5f %.5f' % (s, l))