peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N,M=map(int,input().split())
for i in range(M//N,0,-1):
  if M%i==0:
    break
print(i)
# Judge status: Wrong Answer
N=int(input())
listS=[]
for i in range(N):
  S=input()
  listS+=[S]
listS.sort()
counter=[]
count=1
for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
    if count==N:
      counter+=[count]
  else:
    counter+=[count]
    count=1
    
MAX=max(counter)
count=1

for i in range(N-1):
  if listS[i]==listS[i+1]:
    count+=1
    if count==MAX:
      print(listS[i+1])
  else:
    counter+=[count]
    count=1
# Judge status: Accepted
n, m = map(int, input().split(' '))

b = (n + 1)*(n**2 + 2*n + 6)
a = m*(2*m**2 - 3*m*(n + 2) + 3*n - 2)

ans = (a + b)//6+1
ans = ans % 1000000007
print(ans)
# Judge status: Wrong Answer
N = int(input())
AB = []
for i in range(N):
  AB.append(list(map(int, input().split())))

l = 0
r = 0

AB.sort()
if N % 2 == 0:
  l = AB[N//2][0] + AB[N//2 - 1][0]
else:
  l = AB[N//2][0]
AB.sort(key = lambda x: x[1])
if N % 2 == 0:
  r = AB[N//2][1] + AB[N//2 - 1][0]
else:
  r = AB[N//2][1]
  
if N % 2 == 0:
  print((r - l) * 2 + 1)
else:
  print(r - l + 1)
# Judge status: Accepted
import math
n = int(input())
print(math.factorial(n)%(10**9+7))
# Judge status: Accepted
import math

x = int(input())
while True:
    for i in range(2,int(math.sqrt(x))+1):
        if x%i==0:
            break
    else:
        print(x)
        break
    x += 1
# Judge status: Accepted
a,b,c,x,y = map(int,input().split())
cur = a*x+b*y
z = 0
while True:
  x,y,z = x-1,y-1,z+2
  if a*max(0,x)+b*max(0,y)+c*z <= cur:
    cur = a*max(0,x)+b*max(0,y)+c*z
  else:
    print(cur)
    exit()
# Judge status: Accepted
def mp(): return map(int, input().split())
def lmp(): return list(map(int, input().split()))

import math
a,b,h,m = mp()
hkaku = h*30+m*0.5
mkaku = m*6
cos = math.cos((mkaku-hkaku)*math.pi/180)
u = a**2+b**2-2*a*b*cos
print(math.sqrt(u))
# Judge status: Accepted
import sys
input=sys.stdin.readline

N,M=(int(x) for x in input().rstrip('\n').split())
Hs = [int(x) for x in input().rstrip('\n').split()]
nums = [1 for x in Hs]
for i in range(M):
  roads = [int(x) for x in input().rstrip('\n').split()]
  if Hs[roads[0]-1] < Hs[roads[1]-1]:
    nums[roads[0]-1] = 0
  elif Hs[roads[0]-1] > Hs[roads[1]-1]:
    nums[roads[1]-1] = 0
  else:
    nums[roads[0]-1] = 0
    nums[roads[1]-1] = 0
print(sum(nums))
# Judge status: Wrong Answer
N = int(input())
S = list(input())

cnt = 0

for i in range(N-1):
    if (S[i] == "#" and S[i+1] == "."):
        cnt += 1
        S[i+1] = "#"

print(cnt)
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
print(max(0,min(b,d)-c))
# Judge status: Accepted
import math

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

print(N*800-N//15*200)
# Judge status: Wrong Answer
H1, M1, H2, M2, K = map(int,input().split())
import math
p=(H2-H1)*60
if M1-M2<0:
    a=M1-M2+60
    p-=60
else:
    a=M1-M2
p+=a
time = K*math.floor(p/K)
if p%K==0:
    time=time-K
print(time)
# Judge status: Accepted
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

ans = 'No'
for i in range(n-m+1):
    for j in range(n-m+1):
        match = 1
        for k in range(m):
            for l in range(m):
                if a[i+k][j+l] != b[k][l]:
                    match = 0
        if match:
            ans = 'Yes'
print(ans)
# Judge status: Accepted
S=input()
if S=="RSR":
  print(1)
else:
  print(S.count("R"))
# Judge status: Accepted
N, A, B = map(int,input().split())
S = list(input())
b = 0
c = 0

for i in range(N) :
    if (S[i] == 'a') and (c < A + B) :
        print('Yes')
        c += 1
    elif S[i] == 'b' and (c < A + B) and b < B:
        print('Yes')
        b += 1
        c += 1
    else :
        print('No')
# Judge status: Accepted
n,m=map(int,input().split())

cnt=0

if m-2*n>=0:
  m=m-2*n
  cnt+=n
  num=m//4
  cnt+=num
else:
  num=m//2
  n=n-num
  if n>=0:
    cnt+=num

print(cnt)
# Judge status: Accepted
n = int(input())

ans = [0] * (n+1)
for x in range(100):
    for y in range(100):
        for z in range(100):
            m = x**2 + y**2 + z**2 + x*y + y*z + z*x
            if 1 <= x * y * z and 0 <= m <= n:
                ans[m] += 1

for i in range(n):
    print(ans[i+1])
# Judge status: Accepted
K,X = map(int,input().split())

if K*500>=X:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
in_1 = input()
L, R, d = in_1.split()
L, R, d = int(L), int(R), int(d)

cnt = 0
for i in range(L, R + 1):
  if i % d == 0:
    cnt += 1
    
print(cnt)
# Judge status: Accepted
from collections import Counter

s=Counter(input())
b,m=max(s.values()),min(s.values())
kind = len(s.keys())
if kind==3:
    if b-m<=1: print("YES")
    else: print("NO")
elif kind==2:
    if b==1 and m==1: print("YES")
    else: print("NO")
else:
    if b==1: print("YES")
    else: print("NO")
# Judge status: Wrong Answer
import numpy as np
D = int(input())
c = list(map(int,input().split()))
s=[]
f=[]
for i in range(D):
  if(i%26 == 0):
    f = [0]*26
  x = np.array(list(map(int, input().split())))
  for j in range(26):
    if(f[j]!=0):
      x.delete(1,j)
  s.append(x.argmax())
for i in range(D):
  print(s[i])
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a + b > 16 or a > 8 or b > 8:
  print(":(")
else:
  print("yey!")
# Judge status: Wrong Answer
S = input()
T = input()
ans=float('inf')
for start in range(len(S) - len(T)):
    ans = min(ans, sum(s != t for s, t in zip(S, T)))
print(ans)
# Judge status: Accepted
num1 = [i for i in range(1,10)]
num2 = [i for i in range(1,10)]
ans = []
for i in num1:
    for j in num2:
        ans.append(i*j)
n = int(input())
if n in ans:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import math
def main():
  n=int(input())
  a=int(n/100)
  b=int((n-a*100)/10)
  c=n%10
  max=a
  if b > max:
    max = b
  if c > max:
    max = c
  print(max*100+max*10+max)
main()
# Judge status: Accepted
h=int(input())
w=int(input())
n=int(input())
x=max(h,w)
for i in range(10**4):
    if x>=n:
        print(i+1)
        exit()
    if h>w:
        x+=h
    else:
        x+=w
# Judge status: Wrong Answer
X = int(input())

def isprime(n):
    if n < 2:
    # 2未満は素数でない
        return False
    if n == 2:
    # 2は素数
        return True
    for p in range(2, n):
        if n % p == 0:
        # nまでの数で割り切れたら素数ではない
            return False
        # nまでの数で割り切れなかったら素数
        return True

while isprime(X)==False:
    isprime(X)
    X = X + 1

print(X)
# Judge status: Wrong Answer
n,k = map(int, input().split())
p = list(map(int, input().split()))
p.sort()
print(sum(p[:3]))
# Judge status: Wrong Answer
S=int(input())
x1,y1,x2,y2,x3,y3=0,0,-(-S//10**9),10**9-S%10**9,1,10**9
print(x1,y1,x2,y2,x3,y3)
# Judge status: Accepted
c = input()
bo = "aeiou"

if c in bo:
    print("vowel")
else:
    print("consonant")
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
INF = 10**18
sys.setrecursionlimit(10**6)

def li():
    return [int(x) for x in input().split()]


N = int(input())
md = []
for i in range(N):
    x, y = li()
    md.append(x + y)

maxv = max(md)
minv = min(md)

print(maxv - minv)
# Judge status: Accepted
n=int(input())
b =list(map(int,input().split()))

res=[0] * n

for i in range(n):
    res[b[i]-1] = i+1

for i in res:
    print(i,end=' ')
# Judge status: Wrong Answer
from collections import defaultdict
S, T = map(lambda x: x.strip(), open(0).read().split())

ds, dt = defaultdict(str), defaultdict(str)
ans = 'Yes'
for s, t in zip(S, T):
    if ds[s] or ds[s] == t:
        ds[s] = t
    else:
        ans = 'No'
        break
    if dt[t] or dt[t] == s:
        dt[t] = s
    else:
        ans = 'No'
        break
print(ans)
# Judge status: Accepted
N = int(input())
numbers = [int(x) for x in input().split()]

numbers.sort()

n = numbers.pop()
r = min(numbers, key=lambda x: abs(x - n / 2))  # N

print(n, r)
# Judge status: Wrong Answer
def main():
    A = list(map(int, input().split()))
    k = int(input())

    A.sort()
    print(sum(A[:-1])+A[-1]*2*k)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import math
n=int(input())
a=math.pi
print((n+n)*a)
# Judge status: Wrong Answer
# C - Takahashi's Information
a =[list(map(int, input().split())) for i in range(3)]
sum_a = sum(map(sum, a))

for i in range(3,300):
    if sum_a % i == 0 and sum_a // i >= 3:
        print("Yes")
        exit()
    else:
        pass

print("No")
# Judge status: Accepted
n=int(input())
value=list(map(int, input().split()))
value.sort()
for i in range(n-1):
  value[i+1] = (value[i]+value[i+1])/2
print(value[n-1])
# Judge status: Accepted
k=int(input())
s=input()

if int(len(s))<=k:
    print(s)
else:
    print(s[0:k]+"...")
# Judge status: Accepted
N = int(input())
an = list(map(int, input().split()))

cost = 10000*N
ans = 10000*N
for i in range(-100,100+1):
    cost = sum([(j - i)**2 for j in an])
    ans = min(ans, cost)

print(ans)
# Judge status: Wrong Answer
h = int(input())

lhb = len(format(h, "b"))
print(2 ** lhb  - 1 + lhb)
# Judge status: Accepted
n=int(input())
x=list(map(int,input().split()))
y=sorted(x)
ans1=y[(n//2)-1]
ans2=y[n//2]     
for i in range(n):
    if x[i]<=ans1:
        print(ans2)
    else:
        print(ans1)
# Judge status: Accepted
N = int(input())
S = input()

need_left = 0
pointer = 0
for i in range(len(S)):
    if S[i] == '(':
        pointer += 1
    else:
        if pointer == 0:
            need_left += 1
        else:
            pointer -= 1
need_right = pointer

res = "(" * need_left + S + ")" * need_right
print(res)
# Judge status: Accepted
a = input()
small = list(range(ord("a"), ord("z")+1))
big = list(range(ord("A"), ord("Z")+1))
if ord(a) in small:
  print("a")
else:
  print("A")
# Judge status: Wrong Answer
n, m = map(int, input().split())
a =0
for i in range(n+1):
    for s in range(0, n+1-i)[::-1]:
        if 4*(i) + 2*(s) == m:
            a = a + 1
        else:
            a = a
if a > 0:
    print('Yes')
else:
    print("No")
# Judge status: Accepted
a,b,c = map(int,input().split())
print(max(a,b,c)*9+sum([a,b,c]))
# Judge status: Accepted
a = input()
b = len(a)
c = []
for i in range(b):
    d = a[i]
    if d == '?':
        d='D'
    else:
        d = a[i]
    c.append(d)
print(''.join(c))
# Judge status: Wrong Answer
from string import ascii_lowercase
n = int(input())
d = {s: i for i, s in enumerate(ascii_lowercase)}
a = [s for s, i in d.items()]
ans = []

def dfs(k, s):
    if n == k:
        ans.append(s)
    elif n > k:
        for i in range(max([d[c] for c in s])+2):
            v = s + a[i]
            dfs(k+1, v)
dfs(1,"a")
ans.sort()
for k in ans:
    print(k)
print('\n')
# Judge status: Wrong Answer
a,b,c=input().split()
num=int(a+b+c)
if num%4==0:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
s=input()
l='keyence'
n=len(s)
for i in range(n-1):
    for j in range(i,n):
        r=s[:i]+s[j:]
        if(r==l):
            print("YES")
            exit()
print("NO")
# Judge status: Accepted
n,m = map(int,input().split())
s = set(range(1,m+1))
for i in range(n):
    k,*a = map(int,input().split())
    s &= set(a)
print(len(s))
# Judge status: Accepted
n, k = map(int, input().split())
s = input()
print(s[:k-1] + s.lower()[k-1] + s[k:])
# Judge status: Accepted
import math
a,b,c,d = map(int, input().split())
C = b//c - (a-1)//c
D = b//d - (a-1)//d
x = c*d//math.gcd(c,d)
CD = b//x - (a-1)//x
print((b-a+1) - (C+D-CD))
# Judge status: Accepted
import numpy as np

n=10**6
nsq=10**3
mod=10**9+7
fact=np.arange(n,dtype=np.int64).reshape(nsq,nsq); fact[0,0]=1
for n in range(1,nsq):
    fact[:,n]*=fact[:,n-1]; fact[:,n]%=mod
for n in range(1,nsq):
    fact[n]*=fact[n-1,-1];fact[n]%=mod
fact=fact.ravel()

n,m=map(int,input().split())
p=fact[n]
q=fact[m]
if abs(n-m)>=2:
    print(0)
elif abs(n-m)==1:
    print((p*q)%(10**9+7))
else:
    print(2*(p*q)%(10**9+7))
# Judge status: Wrong Answer
s = input()

k = 'keyence'

ans = ''
j=0
for i, c in enumerate(s):
  if c == k[i]:
    pass
  else:
    ans = s[0:i]
    s = s[i:]
    j=i
    break

for i, c in enumerate(s):
  if k[j] == c:
    j = i
    ans += s[i:]
    break

if ans == k:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for i in range(d)]
cmax=max(c)
c_index = c.index(cmax)
for i in range(d):
  if i % 5 == 4:
    print(c_index+1)
  else:
    max_value = max(s[i])
    max_index = s[i].index(max_value)
    print(max_index+1)
# Judge status: Wrong Answer
n,m=map(int,input().split())
if n>=3 and m>=3:
  print((n-2)*(m-2))
elif n==1 or m==1:
  print(n*m-2)
# Judge status: Accepted
N = int(input())
S = input()

if N % 2 == 1:
  print("No")
else:
  print("Yes" if S[0:N//2] == S[N//2:N] else "No")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in a:
  if i in dic:
    dic[i] += 1
  else:
    dic[i] = 1
    
first = 0
second = 0
for i,j in dic.items():
  if j >= 2:
    if i > first :
      second = first
      first = i
    elif i > second:
      second = i
      
  if j >= 4:
    if i > first :
      second = first
      first = i
    elif i > second:
      second = i
  
print(first*second)
# Judge status: Accepted
n = int(input())
arr = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    if arr[i] == i + 1:
        ans += 1
        arr[i+1], arr[i] = arr[i], arr[i+1]
if arr[n-1] == n:
    ans += 1
print (ans)
# Judge status: Wrong Answer
N, X = map(int, input().split())
L = list(map(int, input().split()))
S = 0
for i in range(N):
  S += L[i]
  if S>X:
    print(i+1)
    break
# Judge status: Accepted
s = list(input())
print(2 * min(s.count("1"), s.count("0")))
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
print('Yes' if A <=C<=B else 'No')
# Judge status: Accepted
S = list(input())
cnt = 0
length = len(S) // 2
for i in range(length):
    if S[i] != S[-1-i]:
        cnt += 1
print(cnt)
# Judge status: Accepted
n = int(input())

for i in range(1, 10**5):
    p = i**2
    if p > n:
        print((i-1)**2)
        break
# Judge status: Accepted
import sys
 
_input1 = int(input())
_input2 = [int(s) for s in input().split()]
_output = sys.maxsize
 
for i in range(min(_input2),max(_input2)+1):
    score = 0
    for j in _input2:
        score += (j-i)**2
 
    if score < _output:
        _output = score
 
print(_output)
# Judge status: Wrong Answer
a, b = map(str, input().split())
c = int(a + b)

for i in range(1, 101):
    if c == i*i:
        print("Yes")
        exit()

print("No")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

d = [1] * (N+1)
d[0] -= A[0]
for i in range(N):
    d[i+1] = d[i] * 2 - A[i+1]
if d[-1] < 0:
    print(-1)
    exit()

d[-1] = A[-1]
for i in range(N, 0, -1):
    d[i-1] = min(d[i]+A[i-1], d[i-1]+A[i-1])
print(sum(d))
# Judge status: Accepted
N, L = map(int, input().split())
min_s = 100000000000
s = 0
for i in range(1,N+1):
    t = L+i-1
    s += t

    if abs(t) <= abs(min_s):
        min_s = t

print(s-min_s)
# Judge status: Accepted
N = int(input())
d = list(map(int,input().split()))
d.sort()
n= int(N/2)
print(d[n]-d[n-1])
# Judge status: Wrong Answer
N,M=list(map(int,input().split()))
a=(N==M)
print("WAC"[a:a+2])
# Judge status: Accepted
n = int(input())
K = []
for i in range(5):
    K.append(int(input()))
x = min(K)
print((n-1)//x+5)
# Judge status: Wrong Answer
N = int(input())
A = [int(i) for i in input().split()]
res = 1
for i in range(N):
    break
    if A[i] == 0:
        res = 0
    elif A[i] > 0:
        res *= A[i];
    if res > 1e+18:
        res = -1

if res > 1e+18: print("-1")
else          : print(res)
# Judge status: Accepted
from collections import defaultdict
n = int(input())
A = defaultdict(int)
for i in range(n):
    a = int(input())
    if A[a] == 1:
        A[a] = 0
    else:
        A[a] = 1
print(sum(A.values()))
# Judge status: Wrong Answer
s = input().lower()

if s[2] == s[3]:
  if s[4] == s[5]:
    print('yes')
else:
  print('no')
# Judge status: Wrong Answer
N=int(input())
if N==2:
    print("1")
else:
    print(N*(N//2))
# Judge status: Wrong Answer
#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
n = int(input()) - 1
if n == 0:
    print('a')
else:
    ans = []
    while n > 0:
        ans.append(n % 26)
        n //= 26
    print(*reversed([chr(ord('a') + x) if i == 0 else ('z' if x == 0 else chr(ord('a') + x - 1)) for i, x in enumerate(ans)]), sep='')
# Judge status: Accepted
import math
n = int(input())
a = list(int(input()) for _ in range(5))
print(math.ceil((n/min(a)))+4)
# Judge status: Accepted
N, M = map(int, input().split())
mod = 1000000007
brokens = set([int(input()) for i in range(M)])

dp = [0] * (N + 1)
dp[0] = 1
for now in range(N + 1):
    if now + 1 < N:
        dp[now + 1] += dp[now] if now + 1 not in brokens else 0
        dp[now + 2] += dp[now] if now + 2 not in brokens else 0
    elif now < N:
        dp[now + 1] += dp[now] if now + 1 not in brokens else 0

print(dp[-1] % mod)
# Judge status: Wrong Answer
D, N = map(int, input().split())

print(100 ** D * N)
# Judge status: Accepted
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

min_tmp = 10 ** 5
index = 0
for i in range(n):
    tmp = abs(a - (t - 0.006 * h[i]))
    if tmp <= min_tmp:
        min_tmp = tmp
        index = i
    # print(tmp)
print(index + 1)
# Judge status: Accepted
a,b,c = map(int,input().split())
if b - a == c - b:
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
n=int(input())
a_list=list(map(int,input().split()))
cnt = [0] * int(1e5 + 10)
sum=0
for i in a_list:
 cnt[i] +=1
 sum+=i
q=int(input())
ans=0

for j in range(q):
 x,y=map(int,input().split())
 ans=-(x-y)*cnt[x]+sum
 print(ans)
 cnt[x]+=cnt[y]
 cnt[y]=0
# Judge status: Accepted
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI0(): return map(lambda s: int(s) - 1, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
def LMI0(): return list(map(lambda s: int(s) - 1, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


N = I()
A = LMI()
ans = 0
for i, a in enumerate(A):
    if i % 2 == 0 and a % 2 != 0:
        ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
ans = ''
if N == 0:
    print(0)
    exit()
while N != 0:
    r = N%2
    N = (N-r)//(-2)
    ans += '1' if r else '0'
print(ans[::-1])
# Judge status: Accepted
S = input()
x = S.replace('eraser', '').replace('erase', '').replace('dreamer','').replace('dream','')
print('YES' if not x else 'NO')
# Judge status: Wrong Answer
S = input()

if (S[0]=='A') and (S[2:-1].count('C') == 1) \
    and (S not in 'BDEFGHIJKLMNOPQRSTUVWXYZ') and (S.count('C')==1) and (S.count('A')==1):
    print('AC')
else:
    print('WA')
# Judge status: Accepted
char = input()
print(chr(ord(char) + 1))
# Judge status: Accepted
import fractions
a, b = map(int, input().split())
c = fractions.gcd(a, b)

def prime_factorize(n):
    s = set()
    while n % 2 == 0:
        s.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            s.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        s.add(n)
    return s
print(1+len(prime_factorize(c)))
# Judge status: Wrong Answer
a, b = map(int, input().split())
for i in range(min(a,b), max(a,b)+1):
  if not i % a and not i % b:
    print(i)
    quit()
# Judge status: Accepted
import sys
C11,C12,C13 = map(int, input().split())
C21,C22,C23 = map(int, input().split())
C31,C32,C33 = map(int, input().split())





if (C11+C22==C12+C21) and (C12+C23==C13+C22) and (C21+C32==C22+C31) and (C22+C33==C23+C32):
    print('Yes')
    sys.exit()


print("No")
# Judge status: Wrong Answer
w, h, x, y = map(int, input().split())
print((h * w) / 2, int(x == (w // 2) and y == (h // 2)))
# Judge status: Wrong Answer
l=[int(input()) for i in range(5)]
k=int(input())

cnt=0
for i in range(1,len(l)):
    if l[i]-l[i-1] > k:
        cnt +=1

if cnt > 0:
    print(":(")
else:
    print("Yay!")
# Judge status: Accepted
x=int(input())
print(max([i**j for i in range(33) for j in range(2,10) if i**j<=x]))
# Judge status: Accepted
n, m = map(int, input().split())
a = list(map(int, input().split()))

s = sum(a) * (1 / (4 * m))

cnt = 0
for i in a:
    if i >= s:
        cnt += 1
if cnt >= m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def solve(K, S):
    count = 0
    
    for x in range(K+1):
        for y in range(K+1):
                if K >= S - (x + y) >= 0 :
                    count += 1
                    
    print(count)

if __name__ == '__main__':
    K, S = map(int, input().split())
    solve(K, S)
# Judge status: Accepted
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=sorted(A)
if N>=M:
  print(0)
else:
  a=M-N
  C=[0]*(M-1)
  for i in range(M-1):
    C[i]=B[i+1]-B[i]
  D=sorted(C)
  ans=sum(D[:a])
  print(ans)
# Judge status: Wrong Answer
N = int(input())
S = str(input())
cnt = 0
for i in range(1,N+1):
  for j in range(i+1,N+1):
    if S[i-1]==S[j-1]:
      break
    for k in range(j+1,N+1):
      if S[i-1]==S[k-1] or S[j-1]==S[k-1]:
        break
      elif j-i == k-j:
        break
      else:
        cnt = cnt+1
print(cnt)
# Judge status: Wrong Answer
def resolve():
    s = input()
    k = int(input())
    cnt = -1
    for i in range(len(s)):
        if s[i] != '1':
            break
        cnt = i + 1
    if cnt > k:
        print(1)
    else:
        print(s[cnt] if len(s) > cnt > -1 else s[0])

if __name__ == '__main__':
    resolve()
# Judge status: Accepted
s=list(input())

l=[]
for i in s[1::2]:
  l.append(i)

new_l=[]
for i in s[::2]:
  new_l.append(i)
ans=0
if 'L' in new_l:
  ans='No'
else:
  ans='Yes'
num=0
if 'R' in l:
  num='No'
else:
  num='Yes'

if ans == 'Yes' and num == 'Yes':
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import math

a,b,x = (int(a) for a in input().split())
if x <= a**2 * b / 2 :
    t = b
    s = 2 * x / (a*b)
    r = s / t
    print(90 - math.degrees(math.atan(r)))
else : 
    t = a
    s = 2 * b ** 2 - 2 * x / (a ** 2)
    r = s / t
    print(math.degrees(math.atan(r)))
# Judge status: Accepted
w, a, b = map(int, input().split())

if a <= b <= a + w or b <= a + w <= b + w or b <= a <= b+w or a <= b + w <= a + w:
    print(0)
elif a + w < b:
    print(b - a - w)
elif b+w < a:
    print(a - b - w)
# Judge status: Wrong Answer
import math, sys
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache
from heapq import heapify, heappop, heappush
from itertools import accumulate, combinations, permutations
input = sys.stdin.readline
mod = 10**9 + 7
ns = lambda: input().strip()
ni = lambda: int(input().strip())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()

if n < 999:
    print('ABC')
else:
    print('ABD')
# Judge status: Accepted
N,x=map(int,input().split())
a=list(map(int,input().split()))
eat=0
for i in range(N-1):
    num1=a[i]
    num2=a[i+1]
    if num1+num2>x:
        buf=min(num1+num2-x,num2)
        eat=eat+buf
        num2=num2-buf
        if num1>x:
            buf=num1-x
            eat=eat+buf
            num1=num1-buf
    a[i]=num1
    a[i+1]=num2
    #print(a)
print(eat)
# Judge status: Accepted
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
ans = 0
t = (n - 1) * (n - 2) // 2
for k, v in c.items():
    ans += v * (v - 1) // 2
for y in a:
    x = c[y]
    print(ans - x * (x - 1) // 2 + (x - 1) * (x - 2) // 2)
# Judge status: Accepted
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


N,P = MI()
A = LI()

x = sum(A[i] % 2 == 0 for i in range(N))  # Aiの中で、偶数であるものの個数
y = N-x  # Aiの中で、奇数であるものの個数

if y == 0:
    print(0 if P == 1 else 2**x)
else:
    print(2**(x+y-1))
# Judge status: Accepted
a,b,x=map(int,input().split())
print("YES" if a+b-x>=0 and x>=a else "NO")
# Judge status: Accepted
x=int(input())
t,m=divmod(x,100)
if t*5>=m:print(1)
else:print(0)