Harryxun/stf_run huggingface dataset:
def dev(y,x):
    if y<x:
        return 2*(x-y)-1
    else:
        return 2*(y-x)


x,n=map(int,input().split())
if n==0:
    print(x)
else:
    p=[int(y) for y in input().split()]
    q=[dev(y,x) for y in p]
    q.sort()
    r=0
    while True:
        if q[r]!=r:
            break
        r+=1
    if r%2==0:
        print(x+r//2)
    else:
        print(x-(r+1)//2)

### FIXED CODE ###

def dev(y,x):
    if y<x:
        return 2*(x-y)-1
    else:
        return 2*(y-x)


x,n=map(int,input().split())
p=[int(y) for y in input().split()]
q=[dev(y,x) for y in p]
q.sort()
r=0
while r<len(q):
    if q[r]!=r:
        break
    r+=1
if r%2==0:
    print(x+r//2)
else:
    print(x-(r+1)//2)
args = [input() for _ in range(2)]

N = int(args[0])
H = [int(l) for l in args[1].split()]

max_len = 0
val = H[0]
st = 0
for i in range(1, N):
  next_val = H[i]
  if val < next_val:
    max_len = max(max_len, i - st - 1)
    st = i
    if st + max_len >= N:
      break
  val = next_val

if i == N - 1:
  max_len = max(max_len, N - 1 - st)
  
print(max_len)

### FIXED CODE ###

args = [input() for _ in range(2)]

N = int(args[0])
H = [int(l) for l in args[1].split()]

max_len = 0
val = H[0]
st = 0
for i in range(1, N):
  next_val = H[i]
  if val < next_val:
    max_len = max(max_len, i - st - 1)
    st = i
    if st + max_len >= N:
      break
  val = next_val

if (N != 1) and (i == N - 1):
  max_len = max(max_len, N - 1 - st)
  
print(max_len)
M,D = input().split()
ans = 0
for i in range(1, M+1):
  for j in range(1, D+1):
    if j < 22:
      continue
    else:
      j = str(j)
      if M == int(j[0]) * int(j[1]):
        ans += 1
print(ans)


### FIXED CODE ###

M,D = map(int,input().split())
ans = 0
for i in range(1, M+1):
  for j in range(1, D+1):
    if j < 22:
      continue
    else:
      j = str(j)
      d1 = int(j[0])
      d2 = int(j[1])
      if d1>=2 and d2>=2 and i == d1*d2:
        ans += 1
print(ans)
N, M = map(int, input().split())
list_a = [int(x) for x in input().split()]

import fractions

def insu2(a) :
    insu = 0
    while a%2 == 0 :
        insu += 1
        a /= 2
    return insu

check = True

for i in list_a :
    if insu2(i) != insu2(list_a[0]) :
        check = False

ans_0 = list_a[0]
for i in range(1,N) :
    ans_0 = ans_0 * list_a[i] // fractions.gcd(ans_0, list_a[i])

ans = int((int(M/(ans_0/2))+1)/2)

if check == False :
    print(0)
else :
    print(ans)


### FIXED CODE ###

N, M = map(int, input().split())
list_a = [int(x) for x in input().split()]

import fractions

def insu2(a) :
    insu = 0
    while a%2 == 0 :
        insu += 1
        a /= 2
    return insu

check = True

for i in list_a :
    if insu2(i) != insu2(list_a[0]) :
        print(0)
        exit()

ans_0 = list_a[0]
for i in range(1,N) :
    ans_0 = ans_0 * list_a[i] // fractions.gcd(ans_0, list_a[i])

ans_0 //= 2
ans = M//ans_0 - M//(ans_0*2)

print(ans)
s=input()

temp=0
templi=[]
for i in range(len(s)):
  if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
    temp+=1
  else:
    templi.append(temp)
    temp=0
print(max(templi))

### FIXED CODE ###

s=input()

temp=0
templi=[0]
for i in range(len(s)):
  if s[i]=="A" or s[i]=="C" or s[i]=="G" or s[i]=="T":
    temp+=1
  else:
    templi.append(temp)
    temp=0
templi.append(temp)

print(max(templi))
import numpy as np

n = int(input())

l = np.empty(n)
l[:] = np.nan

k = 0
i = 1

while i <= n ** 0.5:
  if n % i == 0:
    l[k] = i + (n / i) - 2
   　k += 1
  i += 1
print(int(np.nanmin(l)))

### FIXED CODE ###

n = int(input())

for i in range(int(n ** 0.5)):
  if n % (int(n ** 0.5) - i) == 0:
    j = n // (int(n ** 0.5) - i)
    break
    
print(int(n ** 0.5) - i + j - 2)
def func():
    N, K = map(int, input().split() )
    h = list( map(int,input().split()) )

    dp = [0] * N
    for n in range(1, N):
        can_min = 10**4
        # for k in range(1,K+1l):
        #     if n-k >= 0 :
        #         can = dp[n-k] + abs(h[n]-h[n-k])
        #         can_min = min(can, can_min)
        # dp[n] = can_min 
        dp[n] = min([ dp[max(n-k, 0)] + abs(h[n]-h[max(n-k,0)]) for k in range(max(n-k,0)) ])
    print(dp[N-1])

if __name__=='__main__':
    func()





### FIXED CODE ###



def func():
    N, k = map(int, input().split() )
    h = list( map(int,input().split()) )

    dp = [float('inf')] * N
    dp[0] = 0
    for n in range(1, N):
        # can_min = 10**4
        # for k in range(1,K+1l):
        #     if n-k >= 0 :
        #         can = dp[n-k] + abs(h[n]-h[n-k])
        #         can_min = min(can, can_min)
        # dp[n] = can_min 
        dp[n] = min([ dp[j] + abs(h[n]-h[j]) for j in range(max(n-k,0), n) ])
    print(dp[N-1])

if __name__=='__main__':
    func()
for i, a in enumerate(list(map(lambda a : int(a), input().split(" ")))[::-1]):
　　　　if i == 0:
　　　　　　　　print("%d" % a, end ="")
　　　　else:
　　　　　　　　print(" %d"% a, end ="")

### FIXED CODE ###

for i, a in enumerate(sorted(list(map(lambda a : int(a), input().split(" "))))):
	if i == 0:
		print("%d" % a, end ="")
	else:
		print(" %d"% a, end ="")
print()
A, B = int(input())
print(A*B)

### FIXED CODE ###

x, y = map(int, input().split())
print(x*y)
n, m = map(int, input().split())
if n % 2 == 1:
    for i in range(1, m + 1):
        print(i, n + 1 - i)
else:
    used = [False] * (n + 1)
    i = 1
    count = 0
    while count < m:
        while used[i]:
            i += 1
        print(i, i + count + 1)
        used[i] = True
        used[i + count + 1] = True
        count += 1


### FIXED CODE ###

n, m = map(int, input().split())
if n % 2 == 1:
    for i in range(1, m + 1):
        print(i, n + 1 - i)
else:
    turning_point = (m + 1) // 2
    for i in range(1, turning_point + 1):
        print(i, n + 1 - i)
    for i in range(turning_point + 1, m + 1):
        print(i, n - i)
n=int(input())
a=list(map(input().split()))
for i in range(1,n+1):
    print(a.count(str(i)))

### FIXED CODE ###

r=int(input())
print(2*r*3.141592)
[a,b] = list(map(int,input().split()))

tou = []
dam=0
for i in range(1,1000):
    dam +=i
    tou.append(dam)

for ans in range(1,1001):
    west, east = a+ans, b+ans
    for j in range(998):
        if west==tou[j] and east==tou[j+1]:
            # print("west,wast,j,ans", west,east,j,ans)
            out=ans
            break
print(out)


### FIXED CODE ###


[a,b] = list(map(int,input().split()))

tou = []
dam=0
for i in range(1,1000):
    dam +=i
    tou.append(dam)
# print(tou)

X = b-a
print(tou[X-1] - b)
A, B = map( int, input()split())

D = A * B

if( D % 2 == 1):
  print('Yes')
  
else:
  print('No')

### FIXED CODE ###

A, B = map( int, input().split())
 
D = A * B
 
if( D % 2 == 1):
  print('Yes')
  
else:
  print('No')
n,m= map(int,input().split())
check=[-1]*n
for i in range(m):
    s,c=map(int,input().split())
    s-=1
    if(check[s]!=-1 and check[s]!=c):
        print(-1)
        exit()
    check[s]=c
#print(check)
if(check[0]==0):
    if(n==1):
      print(0)
    else:
      print(-1)
    exit()
elif(check[0]==-1):
    check[0]=1

for i in range(n):
    if(check[i]==-1):
        check[i]=0
    print(check[i],end="")

    


### FIXED CODE ###

import math
print(math.ceil(int(input())/2))
N = int(input())
As = [int(i) for i in input().split()]

iter = 0
ans = 0
while(True):
  while(As[iter] != (iter+1)):
    del As[iter]
    ans += 1
  iter += 1

  if(iter >= len(As)):
    break
print(ans)

### FIXED CODE ###

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

ColNum = 1
ans = 0
for i in range(N):
  if(As[i] != ColNum):
    ans += 1
  else:
    ColNum += 1

if(ColNum == 1):
  ans = -1

print(ans)
N = int(input())
list = [[int(i) for i in input().split()] for i in range(N)]

if N == 1:
    if list[0][0] - list[0][1] - list[0][2] < 0:
        print("No")
    elif (list[0] - list[1] - list[2]) % 2 == 0:
        print("Yes")
    else:
        print("No")
else:
    for i in range(N-1):
        if (list[i+1][0] - list[i][0]) < abs(list[i+1][1]+list[i+1][2]-list[i][1]-list[i][2]):
            print("No")
        elif ((list[i+1][0] - list[i][0]) - abs(list[i+1][1]+list[i+1][2]-list[i][1]-list[i][2]))%2 == 0:
            print("Yes")
        else:
            print("No")

### FIXED CODE ###

N = int(input())
list = [[int(i) for i in input().split()] for i in range(N)]
list.insert(0, [0, 0, 0])

if N == 1:
    timeInterval = list[1][0] - list[0][0]
    distance = abs(list[1][1]+list[1][2]-list[0][1]-list[0][2])
    if timeInterval < distance:
        print("No")
    elif (timeInterval - distance)%2 == 0:
        print("Yes")
    else:
        print("No")
else:
    for i in range(N):
        timeInterval = list[i+1][0] - list[i][0]
        distance = abs(list[i+1][1]+list[i+1][2]-list[i][1]-list[i][2])
        if timeInterval < distance:
            print("No")
            break
        elif (timeInterval - distance)%2 == 0:
            if i == N-1:
                print("Yes")
        else:
            print("No")
            break
N, M, Q = map(int,input().split())
Mlist = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    Mlist.append(array)
Qlist = []
for i in range(Q):
    array = list(map(int, input().strip().split()))
    Qlist.append(array)

r = [[0 for i in range(N)] for j in range(N)]


for i in range(len(Qlist)):
    q = 0
    for j in range(Qlist[i][0],Qlist[i][1]+1):
        q = q + r[j-1][Qlist[i][1]-1]
        if j - 1> 0:
            q = q - r[j-1][j-2]
    print(q)

### FIXED CODE ###

A,B = map(int,input().split())
print(A*B-A-B+1)
N=int(input())
C=[]
S=[]
F=[]
from math import ceil
for _ in range(N-1):
    c,s,f=map(int,input().split())
    C.append(c)
    S.append(s)
    F.append(f)
ans=[]
for i in range(0,N-1):
    t=S[i]+C[i]
    sta=i+1
    while sta<N-1:
        if t<=S[sta]:
            t=S[sta]+C[sta]
        else:
            k=ceil((t-S[sta])/F[sta])
            t=S[sta]+k*F[sta]+C[sta]
        sta+=1
    ans.append(t)
for a in ans:
    print(a)
print(0)


### FIXED CODE ###

N=int(input())
F=[list(map(int,input().split())) for _ in range(N)]
P=[list(map(int,input().split())) for _ in range(N)]
from itertools import product
gain=[]
for p in product([0,1,2,3],repeat=5):
    C=[0 for i in range(N)]
    for i in range(5):
        for j in range(N):
            am=F[j][2*i]
            pm=F[j][2*i+1]
            if p[i]==1:
                C[j]+=am
            elif p[i]==2:
                C[j]+=pm
            elif p[i]==3:
                C[j]+=am+pm
    g=0
    for j in range(N):
        g+=P[j][C[j]]
    
    flag=False
    for i in range(5):
        if p[i]!=0:
            flag=True
    if flag:
        gain.append(g)

print(max(gain))
l = list(map(int(input(),16).split))

if l[0] < l[1]:
  print("<")
elif l[0] = l[1]:
  print ("=")
elif l[0] > l[1]:
  print(">")

### FIXED CODE ###

l = input().split()
l2 = [int(s, 16) for s in l]

if l2[0] < l2[1]:
  print("<")
elif l2[0] == l2[1]:
  print ("=")
elif l2[0] > l2[1]:
  print(">")
'''input
3 5
1 2 3
'''
from fractions import gcd
n,x = map(int,raw_input().split())
arr = map(int,raw_input().split())
arr.append(x)
arr.sort()
diff = []
for i in range(1,n):
	diff.append(arr[i]-arr[i-1])
gc = diff[0]
for i in range(1,len(diff)):
	gc = gcd(gc,diff[i])
print gc


### FIXED CODE ###

'''input
2 2
'''
from sys import exit
a,b = map(int,raw_input().split())
for i in range(1,4):
	if a*b*i&1:
		print "Yes"
		exit(0)
print "No"
a = list(map(int,input()))

if a[1]%a[0]==0:
  print(a[0]+a[1])
else:
  print(a[1]-a[0])

### FIXED CODE ###

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

if a[1]%a[0]==0:
  print(a[0]+a[1])
else:
  print(a[1]-a[0])
import math
import bisect
from collections import deque

N=int(input())
a=list(map(int,input().split()))
u=[]
v=[]
road=[[] for i in range(N)]
for i in range(N-1):
  u1,v1=map(int,input().split())
  road[u1-1].append(v1-1)
  road[v1-1].append(u1-1)
  
#幅優先探索BFSか
ans=[0]*N
houmon=[0]*N
s=deque([])
s.append(0)
dp=[[] for i in range(N)]
dp[0].append(a[0])
while(s):
  v=s.popleft()
  for x in road[v]:#vから行ける場所x
    if(houmon[x]==0):
      dp[x].extend(dp[v])
      s.append(x)
      dp[x].append(a[x])
  houmon[v]=1
  #print(dp)
for i in range(N):
  seq=dp[i]
  #print(seq)
  LIS = [seq[0]]
  for i in range(len(seq)):
    if seq[i] > LIS[-1]:
      LIS.append(seq[i])
    else:
      LIS[bisect.bisect_left(LIS, seq[i])] = seq[i]
  print(len(LIS))

### FIXED CODE ###

K=int(input())
A,B=map(int,input().split())

if(B//K-(A-1)//K>0):
  print("OK")
else:
  print("NG")
n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[]
  y=[]
  for j in range(a):
    x,y=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
c=0
for i in range(int(n/2)):
  l=[1]*n
  for j in range(i, n-i):
    #if l[j]==0:continue
    #for k in range(A[j]):
      #b=X[j][k]
      #l[b] *= Y[j][k]

if c < l.count(1):
  c=l.count(1) 
  
        
  
print(c)  
   

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
x = ''.join(input().split())
if x % 4 == 0:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

x = int(''.join(input().split()))
if x % 4 == 0:
    print('YES')
else:
    print('NO')
n, m, k = map( int, input().split() )
friend = [ [] for _ in range( n ) ]

for _ in range( m ):
    a, b = map( int, input().split() )
    friend[ a - 1 ].append( b - 1 )
    friend[ b - 1 ].append( a - 1 )

VISITED = 1
NOT_VISITED = 0
visit = [ NOT_VISITED for _ in range( n ) ]
graph_id = [ -1 for _ in range( n ) ]

def dfs( ver, g_id ):
    if graph_id[ ver ] == -1:
        graph_id[ ver ] = g_id
    else:
        return
    for next_v in friend[ ver ]:
        dfs( next_v, g_id )

g_id = 0
for ver in range( n ):
    if graph_id[ ver ] != -1:
        continue
    dfs( ver, g_id )
    g_id += 1

graph_size = [ 0 for _ in range( n ) ]
for ver in range( n ):
    graph_size[ graph_id[ ver ] ] += 1

ans = [ graph_size[ graph_id[ ver ] ] for ver in range( n ) ]

for _ in range( k ):
    c, d = map( int, input().split() )
    if graph_id[ c - 1 ] == graph_id[ d - 1 ]:
        ans[ c - 1 ] -= 1
        ans[ d - 1 ] -= 1

for ver in range( n ):
    ans[ ver ] = ans[ ver ] - len( friend[ ver ] ) - 1

print( " ".join( map( str, ans ) ) )

### FIXED CODE ###

import sys
sys.setrecursionlimit(200100)
n, m, k = map( int, input().split() )
friend = [ [] for _ in range( n ) ]

for _ in range( m ):
    a, b = map( int, input().split() )
    friend[ a - 1 ].append( b - 1 )
    friend[ b - 1 ].append( a - 1 )

graph_id = [ -1 for _ in range( n ) ]

def dfs( ver, g_id ):
    if graph_id[ ver ] == -1:
        graph_id[ ver ] = g_id
    else:
        return
    for next_v in friend[ ver ]:
        dfs( next_v, g_id )

g_id = 0
for ver in range( n ):
    if graph_id[ ver ] != -1:
        continue
    dfs( ver, g_id )
    g_id += 1

graph_size = [ 0 for _ in range( n ) ]
for ver in range( n ):
    graph_size[ graph_id[ ver ] ] += 1

ans = [ graph_size[ graph_id[ ver ] ] for ver in range( n ) ]

for _ in range( k ):
    c, d = map( int, input().split() )
    if graph_id[ c - 1 ] == graph_id[ d - 1 ]:
        ans[ c - 1 ] -= 1
        ans[ d - 1 ] -= 1

for ver in range( n ):
    ans[ ver ] = ans[ ver ] - len( friend[ ver ] ) - 1

print( " ".join( map( str, ans ) ) )
#read in input
s = map((lambda x: ord(x) - 96), raw_input())
k = int(raw_input())


for i in range(len(s)):
  sv = s[i]
  if sv == 1 || (27 - sv) > k:
    continue
  s[i] = 1
  k = k - (27 - sv)

s[-1] = (((s[-1] + k) - 1) % 26) + 1

print "".join(map((lambda x: chr(x + 96)), s))

### FIXED CODE ###

#read in input
s = map((lambda x: ord(x) - 96), raw_input())
k = int(raw_input())


for i in range(len(s)):
  sv = s[i]
  if sv == 1 or (27 - sv) > k:
    continue
  s[i] = 1
  k = k - (27 - sv)

s[-1] = (((s[-1] + k) - 1) % 26) + 1

print "".join(map((lambda x: chr(x + 96)), s))
# coding:utf-8

INF = float('inf')


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


def move(x, y):
    command = ''
    if x > 0:
        command += 'R' * x
    else:
        command += 'L' * abs(x)
    if y > 0:
        command += 'U' * y
    else:
        command += 'D' * abs(y)
    command += 'RL' * ((max_length - abs(x) - abs(y)) // 2)
    return command


N = int(input())
point = []
max_length = 0
for i in range(N):
    x, y = inpl()
    max_length = max(max_length, abs(x) + abs(y))
    point.append([x, y])

tmp = sum(point[0]) % 2
judge = True
for p in point:
    if tmp ^ sum(p) % 2:
        judge = False

if judge:
    print(max_length)
    print(' '.join(['1'] * max_length))
    for x, y in point:
        print(move(x, y))
else:
    print(-1)


### FIXED CODE ###

# coding:utf-8

import sys
input = sys.stdin.readline
INF = float('inf')


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


def move_uv(x, y):
    ut = x + y
    vt = x - y
    command = ''
    u, v = 0, 0
    for i in range(len(D)):
        if u <= ut and v <= vt:
            command += 'R'
            u += D[i]
            v += D[i]
        elif u <= ut and v > vt:
            command += 'U'
            u += D[i]
            v -= D[i]
        elif u > ut and v <= vt:
            command += 'D'
            u -= D[i]
            v += D[i]
        else:
            command += 'L'
            u -= D[i]
            v -= D[i]

    return command


N = int(input())
point = []
max_length = 0
for i in range(N):
    x, y = inpl()
    max_length = max(max_length, abs(x) + abs(y))
    point.append([x, y])

parity = sum(point[0]) % 2
judge = True
for p in point:
    if parity ^ sum(p) % 2:
        judge = False
        break

if not judge:
    print(-1)
else:
    D = [2 ** i for i in range(len(bin(max_length)) - 1)]
    D.reverse()

    # X + Yが偶数の時は長さ1の腕を足す
    if parity == 0:
        D.append(1)
    print(len(D))
    print(' '.join(map(str, D)))
    for i in range(N):
        print(move_uv(point[i][0], point[i][1]))
N = int(input())

S = input()
T = input()

#print(S)
#print(len(S))
#print(len(T))

moji = ""

if(len(S) == len(T) == N):
  for i in range(0, N):
    str = (S + T)[i::N]
    moji += str
print(moji)

### FIXED CODE ###

N = int(input())

S, T = map(str, input().split())

#print(S)
#print(len(S))
#print(len(T))

moji = ""

if(len(S) == len(T) == N):
  for i in range(0, N):
    str = (S + T)[i::N]
    moji += str
print(moji)
N = int(input())
M = int(input())
print(N - M + 1)

### FIXED CODE ###

N,M = map(int,input().split())
print(N - M + 1)
n=int(input())
a=list(map(int,input().split()))
ans=0
a=sorted(a)
for i in range(n):
  if a[i]==a[i+1]:
    ans=1
    break
if ans==1:
  print('NO')
else:
  print('YES')

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
b=sorted(a)
for i in range(n-1):
  if b[i]==b[i+1]:
    ans=1
    break
if ans==1:
  print('NO')
else:
  print('YES')
n = input()
N = int(n)
n = list(n)
ans = 0
for i in range(len(n)):
  n[i] = int(n[i])
ans += int(n[i])
if N % ans == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = input()
N = int(n)
n = list(n)
ans = 0
for i in range(len(n)):
  n[i] = int(n[i])
  ans += int(n[i])
if N % ans == 0:
  print("Yes")
else:
  print("No")
n=int(input())
ln=[int(a) for a in input().split()]
i=0
while all([a % 2 for a in ln]==0):
    i+=1
print(i)

### FIXED CODE ###

n=int(input())
ln=[int(a) for a in input().split()]
i=0
while all(a % 2 ==0 for a in ln):
    ln=[a/2 for a in ln]
    i+=1
print(i)
L,R= map(int,input().split())
#境界条件
if L == 0:
    ans = 0
#一個違い
elif R == L+1:
    ans = L*R % 2019
else:
    l = L % 2019
    r = R % 2019
    for i in range(l,r):
        for j in range(l+1,r+1):
            temp = (i * j) % 2019
            if i == 1 and j==2:
                min = temp
            elif min > temp:
                min = temp
    ans = min
print(ans)

### FIXED CODE ###

L,R= map(int,input().split())
#境界条件
bool = True
flag = False
for i in range(L,R):
    for j in range(i+1,R+1):
        temp = (i * j) % 2019
        if bool:
            min = temp
            ans = min
            bool = False
        elif min > temp:
            min = temp
            ans = min
        if min == 0:
            flag = True
            break
    if flag:
        break
print(ans)
S=input()
N=len(S)

A=S[:(N-1)//2]
B=S[(N+3)//2-1:])
for i in range(len(A)):
	if A[i]!=A[-(i+1)]:
		print("No")
		exit()
for i in range(len(B)):
	if B[i]!=B[-(i+1)]:
		print("No")
		exit()
print("Yes")

### FIXED CODE ###

S=input()
N=len(S)

A=S[:(N-1)//2]
B=S[(N+3)//2-1:]

for i in range(len(S)):
	if S[i]!=S[-(i+1)]:
		print("No")
		exit()
for i in range(len(A)):
	if A[i]!=A[-(i+1)]:
		print("No")
		exit()
for i in range(len(B)):
	if B[i]!=B[-(i+1)]:
		print("No")
		exit()
print("Yes")
n = int(input())
s = list(input())
j = []
now = 0
unclosen = 0
opened = 0
for i in s:
    if i == ")":
        now -= 1
        if opened:
            opened -= 1
        else:
            unclosen += 1
    else:
        now += 1
        opened += 1
j = np.array(j)
print("(" * unclosen + "".join(s) + ")" * opened)

### FIXED CODE ###

import numpy as np
n = int(input())
s = list(input())
j = []
now = 0
unclosen = 0
opened = 0
for i in s:
    if i == ")":
        now -= 1
        if opened:
            opened -= 1
        else:
            unclosen += 1
    else:
        now += 1
        opened += 1
j = np.array(j)
print("(" * unclosen + "".join(s) + ")" * opened)
n,a = map(int,input().split())
x = list(map(int,input().split()))
t = [[0]*5001 for _ in range(n+1)]
ans = 0
for i in range(1, n+1):
  for y in x:
    for z in t[i-1]:
      t[i][z+y-a] += 1
  ans += t[i][0]
print(ans)

### FIXED CODE ###

n,a = map(int,input().split())
x = list(map(int,input().split()))
t = [[[0] * (50*(j+1)+1) for j in range(i+2)] for i in range(n+1)]
ans = 0
t[0][0][0] = 1

for i in range(1, n+1):
    for j in range(i+1):
        for k in range(50*j + 1):
            if j >= 1 and k >= x[i-1]:
                t[i][j][k] = t[i - 1][j - 1][k - x[i-1]] + t[i - 1][j][k]
            else:
                t[i][j][k] = t[i - 1][j][k]
for i in range(1,n+1):
    ans += t[n][i][i*a]
print(ans)
#!/usr/bin/env python3
# coding=utf-8

import sys
import numpy as np


def culc_pos(x, y, commands, pos=np.matrix([0, 0]), d=np.matrix([1, 0])):
    if len(commands) == 1:
        if commands[0]:
            return pos[0, 0] == x and pos[0, 1] == y
        else:
            pos = pos + d
            return pos[0, 0] == x and pos[0, 1] == y
    if commands[0]:
        ccw = np.matrix([[0, -1], [1, 0]])
        cw = np.matrix([[0, 1], [-1, 0]])
        d1 = d * ccw
        d2 = d * cw
        return culc_pos(x, y, commands[1:], pos, d1) or culc_pos(x, y, commands[1:], pos, d2)
    else:
        pos = pos+d
        return culc_pos(x, y, commands[1:], pos, d)


s = sys.stdin.readline().strip()
x, y = sys.stdin.readline().strip().split(" ")
x = int(x)
y = int(y)
s_list = [_s == "T" for _s in list(s)]
if culc_pos(x, y, s_list):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

#!/usr/bin/env python3
# coding=utf-8

import sys

s = sys.stdin.readline().strip().split("T")
x, y = sys.stdin.readline().strip().split(" ")
x = int(x)
y = int(y)
move_all = [len(_s) for _s in s]
pos_x = set([move_all[0]])
pos_y = set([0])
move_x = move_all[2::2] or None
move_y = move_all[1::2] or None
if move_x:
    for move in move_x:
        pos_x = {_x + move for _x in pos_x} | {_x - move for _x in pos_x}
if move_y:
    for move in move_y:
        pos_y = {_y + move for _y in pos_y} | {_y - move for _y in pos_y}
if x in pos_x and y in pos_y:
    print("Yes")
else:
    print("No")
N = int(input())
numbers = list(map(int, input().split()))
canDevide = True
count = 0;
while canDevide :
  for i in range(N) :
    if numbers[i]%2 == 0 :
      numbers[i] /= 2
    else :
      canDevide = False
      break
  if canDevide :
    count += 1
print(count)

### FIXED CODE ###

s = input()
numbers = [int(number) for number in s]
print(numbers.count(1))