peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N, K = map(int, input().split())
if N%K == 0:
    print(0)
else:
    print(1)
# Judge status: Accepted
import sys
input = sys.stdin.readline

N = [int(x) for x in input().rstrip()][::-1] + [0]
L = len(N)

dp = [[10 ** 18, 10 ** 18] for _ in range(L + 1)]
dp[0] = [0, 0]
dp[1] = [N[0], 10 - N[0]]

for i in range(2, L + 1):
    n = N[i - 1]
    dp[i][0] = min(dp[i - 1][0] + n, dp[i - 1][1] + (n + 1))
    dp[i][1] = min(dp[i - 1][0] + (10 - n), dp[i - 1][1] + (10 - (n + 1)))

print(dp[-1][0])
# Judge status: Accepted
A, B, C = map(int, input().split())
K = int(input())
cnt = 0
ans = False
while True:
  if cnt > K:
    break

  if B > A and C > B:
    ans = True
    break

  if B <= A:
    B *= 2
    cnt += 1
    continue
    
  if C <= B:
    C *= 2
    cnt += 1

if ans:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
s = set(input())

if len(s)==1:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
x, k, d = map(int, input().split())
x = abs(x)

if x >= k*d:
    ans = x - k*d
elif k&1:
    ans = min((x-d)%(2*d), 2*d - (x-d)%(2*d) )
else:
    ans = min(x%(2*d), 2*d - x%(2*d))

print(ans)
# Judge status: Wrong Answer
#ABC056

x = int(input())

for i in range(10 ** 4):
    if i * (i - 1) // 2 < x <= i * (i + 1) // 2:
        print(i)
        break
# Judge status: Accepted
N = int(input())

sum = 0
for i in range(1, N+1):
  if i % 3 != 0 and i % 5 != 0:
    sum += i
print(sum)
# Judge status: Wrong Answer
import sys
import math
import statistics
import itertools
from collections import deque
N=int(input())

ans_lis =[0]*10000000


nn=math.sqrt(N)
n=int(nn)
#per_lis=itertools.permutations(list(range(1,4)))
for i in range(1,n+1):
    for j in range(1,n+1):
        for k in range(1,n+1):
            tmp=0
            tmp=i**2+j**2+k**2+i*j+j*k+k*i
            ans_lis[tmp-1]+=1
for g in range(n):
    print(ans_lis[g])
# Judge status: Wrong Answer
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def f(x, a, b):
    return ((a*x)//b) - (a*(x//b))

def main():
    a, b, n = map(int, readline().split())
    print(min(f(n, a, b), f(b-1, a, b)))
if __name__ == '__main__':
    main()
# Judge status: Accepted
n = list(map(int,input()))
if sum(n)%9==0:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N,M=map(int,input().split())
*A,=map(int,input().split())
A=sorted(A)[::-1]

i=0
while M:
    A[i]//=2
    M-=1
    if A[i]<A[min(i+M,N-1)]:
        i+=1
    if i==N:
        A=sorted(A)[::-1]
        i=0

print(sum(A))
# Judge status: Accepted
n,k,q = map(int,input().split())
a = [int(input()) for _ in range(q)]

ans = [0] * n

for i in range(q):
  ans[a[i]-1] += 1
for anss in ans:
  print("Yes" if k - q + anss > 0 else "No")
# Judge status: Accepted
from math import ceil
H = int(input())
W = int(input())
N = int(input())

print(ceil(N/(max(H, W))))
# Judge status: Wrong Answer
a,b=(int(x) for x in input().split())

if a>b:
    for i in range(b):
        print(a,end='')
else:
    for i in range(a):
        print(b,end='')
        
print()
# Judge status: Accepted
a,b = map(int,input().split())

if a > 0:
  print("Positive")
elif (a <= 0 and b >= 0):
  print("Zero")
else:
  if (b - a) % 2 == 0:
    print("Negative")
  else:
    print("Positive")
# Judge status: Wrong Answer
h = int(input())
w = int(input())
n = int(input())
a = max(h, w)
if n % a == 0:
    print(n//a)
else:
    print((n//1 + 1))
# Judge status: Wrong Answer
a = int(input())
print(a+a**a+a**a*a)
# Judge status: Accepted
a, b, k = map(int, input().split())
if k <= a:
    print(a-k, b)
elif k - a <= b:
    print(0, b-(k-a))
else:
    print(0, 0)
# Judge status: Accepted
L,R=map(int,input().split())

if R<L+2019:
  end=R
else:
  end=L+2018

ans=2020*2020
for l in range(L,end):
  for r in range(l+1,end+1):
    if ans>(l*r)%2019:
      ans=(l*r)%2019
    if ans==0:
      break
print(ans)
# Judge status: Accepted
def main():
    N = int(input()) - 1
    digit = 1
    while N >= 26 ** digit:
        N -= 26 ** digit
        digit += 1
    buf = []
    a = ord("a")
    for i in range(digit):
        buf.append(chr(a + (N % 26)))
        N //= 26
    ans = "".join(buf[::-1])
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
#! /usr/bin/env python3

from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

A = input()
B = input()
C = input()

ABC = {"a":deque(A), "b":deque(B), "c":deque(C)}
ABC_H = {"a":"A", "b":"B", "c":"C"}

ind = A[0]
while True:

    if len(ABC[ind]) == 0:
        break 
    ind = ABC[ind].popleft()

print(ABC_H[ind])
# Judge status: Accepted
#200802B
import math
N, D = map(int, input().split())

count = 0
for i in range(N):
    X, Y = map(int, input().split())
    Dxy = math.sqrt(X**2 + Y**2)
    if Dxy <= D:
        count += 1
print(count)
# Judge status: Accepted
input()
s=input()
half=int(len(s)/2)
print("Yes" if s[:half]==s[half:] else "No")
# Judge status: Wrong Answer
x = int(input())

while True:
    if x % 2 == 0:
        x += 1
        continue
    i = 2
    while i * i <= x:
        if x % i == 0:
            break
        i += 1
    else:
        print(x)
        exit()
    x += 1
# Judge status: Accepted
import sys
input = sys.stdin.readline
ins = lambda: input().strip()
inn = lambda: int(input())
inl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

n, a, b = inl()

def comb(n, k):
	p, q = 1, 1
	for i in range(1, k+1):
		p = p * (n-i+1) % mod
		q = q * i % mod
	return p * pow(q, mod-2, mod) % mod

sum_comb = pow(2, n, mod) - 1
sum_comb -= comb(n, a)
sum_comb -= comb(n, b)

print(sum_comb % mod)
# Judge status: Accepted
import math

s = int(input())

rot = int(math.sqrt(s) // 1)
if s == rot**2:
    print("0 0 " + str(rot) + " 0 0 " + str(rot))
    exit()

rot += 1
ans = (rot**2) - s
print("0 0 " + str(rot) + " 1 " + str(ans) + " " + str(rot))
# Judge status: Accepted
n, l = map(int, input().split())

p = [0]*n
for i in range(n):
  p[i] = l + (i + 1) - 1

s = p[0]
for i in p:
  if abs(i) < abs(s):
    s = i

print(sum(p) - s)
# Judge status: Accepted
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

s = input().strip()
a = set()
for i in s:
    if i in a:
        print('no')
        sys.exit()
    a.add(i)
print('yes')
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
y = sorted([(i+1, A[i]) for i in range(N)], key=lambda x: x[1])
print(" ".join(map(str, [z[0] for z in y])))
# Judge status: Accepted
N, M = map(int, input().split())

l = [0] * (N + 1)
l[1] = 1
c = [1] * (N + 1)

for _ in range(M):
    x, y = map(int, input().split())
    if l[x] == 1:
        l[y] = 1
    if c[x] == 1:
        l[x] = 0
    c[x] -= 1
    c[y] += 1

print(sum(l))
# Judge status: Wrong Answer
n = int(input())
a = input().split()

a = list(map(int, a))

alice_n = a[::2]
bob_n = a[1::2]

print(sum(alice_n) - sum(bob_n))
# Judge status: Accepted
din =input()
out = 0
for ind in range(len(din)):
  out = out + int(din[ind])
print(out)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
k = int(input())

m = max(a, b, c)
print(sum([a, b, c])-m+m*2*k)
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())

for cnt in range(k):
    if a < b and b < c:
        break
    elif a >= b:
        b = int(b * 2)
        continue
    elif b >= c:
        c = int(c * 2)
        continue

if a < b < c:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N=int(input())

flag=0
for i in range(1,10):
  for j in range(1,10):
    if N==i*j:
      print('Yes')
      flag=1
      break
      
if flag==0:
  print('No')
# Judge status: Accepted
from math import log10
n,k=map(int,input().split())
m=int(log10(n)/log10(k))
print(m+1)
# Judge status: Wrong Answer
import numpy as np

a = np.arange(365)

np.random.shuffle(a)

print(*a, sep='\n')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

count = 0
last = 0#前のBの余力
for i in range(N):
    at = min(A[i] - last, B[i])
    if at < 0:
        at = 0
    if at == 0:
        count += A[i]
    else:
        count += at + last
    last = B[i] - at
    
if A[-1]-last > 0:
    count += A[-1]-last
else:
    count += A[-1]
print(count)
# Judge status: Wrong Answer
k, x = map(int, input().split())
if 500*k >= x:
  print("Yes")
else:
  print("NO")
# Judge status: Wrong Answer
x = int(input())
if x == 1:
  print(1)
else:
  print(0)
# Judge status: Accepted
n,m=map(int,input().split())
l=[]
if n%2==0:
  i=1
  while i<n//2+1-i:
    l.append((i,n//2+1-i))
    i+=1
  j=1
  while j<n//2-j:
    l.append((n//2+j,n-j))
    j+=1
else:
  for i in range(1,n//2+1):
    l.append((i,n-i))
for a,b in l[:m]:
  print(a,b)
# Judge status: Wrong Answer
N = input()
if len(N) == 1 or N[1:len(N)].count('9') == len(N)-1:
    print(N)
else :
    print(int(N[0])-1+9*(len(N)-1))
# Judge status: Accepted
s = set(input())
al = set(list(map(chr, [i for i in range(97, 97+26)])))
print('None' if len(s)==len(al) else min(al-s))
# Judge status: Accepted
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    x=int(readline())

    l=0
    r=10**9
    while l<r-1:
        m=(l+r)//2
        if m*(m+1)//2>=x:
            r=m
        else:
            l=m

    print(r)

if __name__=="__main__":
    main()
# Judge status: Accepted
N=int(input())
s=0
for i in range(0,N+1):
    s=s+i
print(s)
# Judge status: Accepted
d, t, s = map(int, input().split())

time = d / s
ans = "Yes"

if time > t:
  ans = "No"
  
print(ans)
# Judge status: Wrong Answer
A=[]
A+=list(map(int, input().split()))
A+=list(map(int, input().split()))
A+=list(map(int, input().split()))
N=int(input())

b=[]
for _ in range(N):
    b.append(int(input()))

find=set()
for num in b:
    if num in A:
        find.add(A.index(num))
BINGO=[{0, 3, 6}, {1, 4, 7}, {2, 5, 8},  {0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 4, 8}, {2, 4, 6}]
for tri in BINGO:
    if tri < find:
        print('Yes')
        break
else:
    print('No')
# Judge status: Accepted
import itertools
a=[i for i in input()]
b=[i for i in input()]
l=list(itertools.zip_longest(a,b,fillvalue=0))
ll=[]
for i in l:
  if i[0]!=0:
    ll.append(i[0])
  if i[1]!=0:
    ll.append(i[1])  
print("".join(ll))
# Judge status: Accepted
(N, M), *AB = [map(int, s.split()) for s in open(0)]
cnt = [1] * N
possibly_red = [False] * N
possibly_red[0] = True
for a, b in AB:
    a -= 1
    b -= 1
    cnt[a] -= 1
    cnt[b] += 1
    if possibly_red[a]:
        possibly_red[b] = True
        if cnt[a] == 0:
            possibly_red[a] = False
print(sum(possibly_red))
# Judge status: Accepted
from collections import Counter

n = int(input())
A = list(map(int, input().split()))
c = Counter(A)
print(sum(v - k if k <= v else v for k, v in c.items()))
# Judge status: Accepted
s = input()

if s == 'RSR':
    print(1)
    exit()

ans = 0

for i in s:
    if i == 'R':
        ans += 1

print(ans)
# Judge status: Accepted
import itertools
 
n = int(input())
A = list(map(int,input().split()))
A.sort()
 
def binary_search(l,r,v):
    while r >= l:
        h = (l+r) // 2
        if A[h] < v:
            l = h+1
        else:
            r = h-1
    return r
 
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        a = binary_search(j,n-1,A[i]+A[j])
        ans += a-j
 
print(ans)
# Judge status: Accepted
n_num = int(input())
nums = map(int, input().split())

for num in nums:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            print('DENIED')
            break
else:
    print('APPROVED')
# Judge status: Wrong Answer
import itertools

n, m, q = map(int, input().split())
abcd = []
a_pre = [] 


for i in range(q):
  abcd.append(list(map(int, input().split())))

lis = [i for i in range(1,m+1)]
for pair in itertools.combinations(lis, n):
  a_pre.append(list(pair))

sum = 0
for i in range(len(a_pre)):
  sum_pre = 0
  for j in range(len(abcd)):
    if (a_pre[i][abcd[j][1] - 1] - a_pre[i][abcd[j][0] - 1]) == abcd[j][2]:
      sum_pre += abcd[j][3]
  if sum_pre > sum:
    sum = sum_pre

print(sum)
# Judge status: Accepted
ab, bc, ca = map(int, input().split())
print(ab * bc // 2)
# Judge status: Accepted
N = int(input())
count = 0
if 105 <= N <= 106:
  count = 1
elif N < 105:
  count = 0
else:
  count = 1
  for i in range(107, N + 1, 2):
    prime_count = 0
    for j in range(1, int(i ** (1/2)) + 1):
      if i % j == 0:
        prime_count += 1
        if i / j != j:
          prime_count += 1
    if prime_count == 8:
      count += 1
print(count)
# Judge status: Accepted
N, X, Y = map(int, input().split())
from itertools import combinations
cmb = combinations(range(1, N+1), 2)
k = [0] * (N-1)
for i, j in cmb:
    distance = min(j-i, abs(X-i) + abs(Y-j) + 1)
    k[distance-1] += 1
for i in k:
    print(i)
# Judge status: Accepted
n = list(input())

if '7' in n:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
a,b = map(int, input().split())

M = sum(range(b-a))

print(M - a)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**6)

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

ans = 0

for i in range(1, n-1):
    if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
        ans += 1
        
print(ans)
# Judge status: Accepted
import math
X = int(input())
maxv = [1]

for i in range(1,32):
    for j in range(2,11):
        if i**j > X:
            if j != 2:
                maxv.append(i**(j-1))
            break

print(max(maxv))
# Judge status: Wrong Answer
N,K = map(int,input().split())
P = list(map(int,input().split()))

res = 10**16
for i in range(N-K+1):
  res = min(res, sum(P[i:i+K]))

print(res)
# Judge status: Accepted
def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1,n+1):
        for j in range(i,n+1,i):
            table[j] += 1
    return table
def resolve():
    n = int(input())
    print(sum(num_divisors_table((n)-1)))
resolve()
# Judge status: Wrong Answer
S = input()

if S.count('h') == S.count('i') and S.count('i') == S.count('hi'):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
K,A,B=map(int,input().split())
bis=1
if A>=B-1:
  bis=K+1
else:
  if K-(A-1)%2==0:
    bis=A+(B-A)*(K-(A-1))/2
  else:
    bis=A+(B-A)*((K-(A-1))//2)+1
print(bis)
# Judge status: Accepted
n = int(input())
if 0<= n <=1000:
    print(1000- n)
elif 1000< n <=2000:
    print(2000- n)
elif 2000< n <=3000:
    print(3000- n)
elif 3000< n <=4000:
    print(4000- n)
elif 4000< n <=5000:
    print(5000- n)
elif 5000< n <=6000:
    print(6000- n)
elif 6000< n <=7000:
    print(7000- n)
elif 7000< n <=8000:
    print(8000- n)
elif 8000< n <=9000:
    print(9000- n)
elif 1000< n <=10000:
    print(10000- n)
# Judge status: Accepted
A, B, C = map(int, input().split())

if A%2 == 0 or B%2 == 0 or C%2 == 0:
    print(0)
else:
    print(min(A*B, A*C, B*C))
# Judge status: Accepted
n = int(input())
s = input()
ans = 0
tmp = [0]
for ss in s:
	if ss == "I":
		ans += 1
		tmp.append(ans)
	else:
		ans -= 1
		tmp.append(ans)
print(max(tmp))
# Judge status: Accepted
N=int(input())
AA=list(map(int,input().split()))
Lmax=0
for i in range(N):
    Lmax = max(Lmax,AA[i])
print("Yes" if Lmax<(sum(AA)-Lmax) else "No")
# Judge status: Accepted
A,V=map(int,input().split())
B,W=map(int,input().split())
T=int(input())

if A<B:
    a=V*T
    b=W*T
    a=A+a
    b=B+b
    if b<=a:
        print("YES")
    else:
        print("NO")
elif B<A:
    a=V*T
    b=W*T
    a=A-a
    b=B-b
    if a<=b:
        print("YES")
    else:
        print("NO")
else:
    print("YES")
# Judge status: Accepted
n = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
ans = 0

for i in range(n):
    candies = 0
    candies += sum(A1[:i+1]) + sum(A2[i:])
    ans = max(ans,candies)
    
print(ans)
# Judge status: Wrong Answer
a,b,c=map(int,input().split(" "))
print("Yes") if a<=c and b<=c else print("No")
# Judge status: Accepted
import sys
input = sys.stdin.readline

X,Y = list(map(int,input().split()))
print(X+Y//2)
# Judge status: Accepted
a, b, k = map(int, input().split())

if a <= k:
  if b-(k-a) > 0:
    print(0, b-(k-a))
  else:
    print(0, 0)
else:
  print(a-k, b)
# Judge status: Accepted
import sys
import fractions

sys.setrecursionlimit(10000000)
input=sys.stdin.readline

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

def gcd(a, b):
    return a if b == 0 else gcd(b, a%b)

def lcm(a, b):
    return a // fractions.gcd(a, b) * b

mod = 10**9+7

x=a[0]

for i in a[1:]:
    x=lcm(x,i)
ans=0
for i in range(n):
    ans+= x//a[i]

print(ans%mod)
# Judge status: Accepted

def myAnswer(S:str)-> str:
   #len(S)が2の時種類数が１以外ならOK
   dic = {"a":0,"b":0,"c":0}
   for s in S:
      dic[s]+= 1
   # print(dic)
   dic2 = sorted(dic.values(),reverse = True)
   sub = dic2[0] - dic2[1] + dic2[1] - dic2[2]
   # print(dic2)
   if(sub >=2):
      return "NO"
   else:
      return "YES"
def modelAnswer():
   return
def main():
   S = (input())
   print(myAnswer(S))
if __name__ == '__main__':
   main()
# Judge status: Accepted
n, k, s = map(int, input().split())

if s == 10**9:
    for _ in range(k):
        print(s, end=" ")
    for j in range(n-k):
        print(10**9-1, end=" ")
else:
    for _ in range(k):
        print(s, end=" ")
    for j in range(n-k):
        print(10**9, end=" ")
# Judge status: Accepted
h, w =  map(int,input().split())
if h == 1 or w == 1:
    print(1)
    exit()
else:
    print((h * w + 1) // 2)
# Judge status: Accepted
s = input()
s_length = len(s)

keep = '01' * 100000
keep_1 = keep[:s_length]
keep_2 = keep[1:s_length + 1]


ans_1 = 0
ans_2 = 0
for i in range(s_length):
    if s[i] != keep_1[i]:
        ans_1 += 1
    else:
        ans_2 += 1
print(min(ans_1, ans_2))
# Judge status: Accepted
a,b,c = sorted(list(map(int,input().split())))
if a == c:
    print("1")
elif a == b or b == c:
    print("2")
else:
    print("3")
# Judge status: Wrong Answer
a, b, c = map(int, input().split(' '))
print(a*b/2)
# Judge status: Accepted
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    K = int(input())

    mod = 7
    ans = 1
    for i in range(K):
        if mod % K == 0:
            print(ans)
            exit()
        mod = (mod * 10 + 7) % K
        ans += 1
    print(-1)


if __name__ == "__main__":
    main()
# Judge status: Accepted
data = sorted([int(i) for i in input().split()])
print((data[2] * 2 - data[0] - data[1])//2) if data[0] % 2 == data[1] % 2 else print(((data[2] + 1) * 2 - data[0] - data[1] - 1)//2 + 1)
# Judge status: Wrong Answer
import math
ab = int(input().replace(' ', ''))
ab_sqrt = math.sqrt(ab)
print('Yes' if int(ab_sqrt ** 2) == ab else 'No')
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(N):
    if A[i] >= B[i]:
        ans += B[i]
    else:
        ans += A[i]
        B[i] -= A[i]
        if A[i + 1] >= B[i]:
            ans += B[i]
            A[i + 1] -= B[i]
        else:
            ans += A[i + 1]
print(ans)
# Judge status: Wrong Answer
a = list(input())
b = list(input())


if a == list(reversed(b)):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
count = int(input())

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

total = 0
for i in range(count):
    a = data.count(i + 1)
    total += a
    print(a)
    if total == count - 1:
        print("0\n" * (count - i))
        break
# Judge status: Accepted
c = input()
nextc = chr(ord(c) + 1)
print(nextc)
# Judge status: Accepted
d={'A':'a','B':'b','C':'c'}
N,K=map(int,input().split())
S=input()
print(S[:K-1]+d[S[K-1]]+S[K:])
# Judge status: Accepted
if __name__ == '__main__':

    n = int(input())

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

    top = A[0]
    ans = 0
    for i in range(n-1):
        if top > A[i+1]:
            ans += top - A[i+1]
        else:
            top = A[i+1]
    print(ans)
# Judge status: Accepted
N = int (input ())
A = [int (x) for x in input().split()]
X = A[0]
P = 0
for i in range (N-1):
  if A[i+1] < X:
    P += X-A[i+1]
  elif A[i+1] > X:
    X = A[i+1]
print (P)
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
result = 0
if (b - a)%2 == 1:
    temp1 = b - 1
    temp2 = n - a
    if temp1 < temp2:
        result = temp1
    else:
        result = temp2
else:
    result = (b - a) // 2
print(result)
# Judge status: Accepted
x = int(input())
for i in range(-1000, 1000):
    for j in range(-1000, 1000):
        if i**5 - j**5 == x:
            print(str(i) + " " + str(j))
            exit()
# Judge status: Accepted
#!/usr/bin/env python3

import math
from decimal import *

def main():
    h,w = map(int, input().split())
    if h == 1:
        print(1)
        exit()
    elif w ==1:
        print(1)
        exit()
    else:
        print(math.ceil(h*w/2))

if __name__ == '__main__':
    main()
# Judge status: Accepted
a,b = map(int,input().split())
s = list(input())
print("Yes" if s.count("-")==1 and s[a]=="-" else "No")
# Judge status: Accepted
N = int(input())
A = 1
B = 2
C = 1
mod = 10**9+7
for i in range(N):
  A *= 10
  A %= mod
  B *= 9
  B %= mod
  C *= 8
  C %= mod
ans = (A-B+C)%mod
print(ans)
# Judge status: Accepted
print('Yes' if input() in input() * 2 else 'No')
# Judge status: Wrong Answer
from math import ceil
N,H=map(int,input().split())
AB=[list(map(int,input().split())) for i in range(N)]
sw=max(AB[i][0] for i in range(N))
cnt=0
dam=0
for i in range(N):
    if AB[i][1]>=sw:
        cnt+=1
        dam+=AB[i][1]
        if(dam>=H):
            print(cnt)
            exit()
cnt+=ceil((H-dam)/sw)
print(cnt)
# Judge status: Accepted
n = int(input())
print(-((-n)//2))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(min(a), max(a)):
  tmp = a.count(i) + a.count(i-1) + a.count(i+1) 
  if ans < tmp:
    ans = tmp
if n > 1:
  print(ans)
else:
  print(1)
# Judge status: Wrong Answer
a, b = input().split()
list = [a*int(b), b*int(a)]
sorted(list)
print(list[0])
# Judge status: Accepted
from collections import deque

n,m = map(int,input().split())
tree = [[] for _ in range(n)]

for i in range(m):
  a,b = map(int, input().split())
  tree[a-1].append(b-1)
  tree[b-1].append(a-1)
  
depth = [-1] * n
prev = [-1] * n

q = deque([0])
depth[0] = 0

while len(q) > 0:
  pos = q.popleft()
  for i in tree[pos]:
    if depth[i] == -1:
      depth[i] = depth[pos] + 1
      prev[i] = pos
      q.append(i)
      
print('Yes')
for i in range(1,n):
  ans = prev[i] + 1
  print(ans)
# Judge status: Accepted
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    X, Y = MI()


    if (Y%2 == 0) and (2*X<=Y) and (Y <= 4*X):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
	main()
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))

def hoge(x):
    for i in range(10):
        if x % 2 == 0:
            x = x//2
        else:
            break
    return i

print(min([hoge(x) for x in l]))
# Judge status: Accepted
N, *A = map(int, open(0).read().split())

s = 0
m = 1000
for i in range(N):
    m += s * A[i]
    s = 0
    if i+1 < N and A[i] < A[i+1]:
        s = m // A[i]
        m -= s * A[i]

print(m)
# Judge status: Wrong Answer
from collections import *
from itertools import *
from bisect import *
from heapq import *
import copy
import math
from fractions import gcd
import sys
#input = sys.stdin.readline


#N=int(input())

#A=list(map(int,input().split()))
#XY=[list(map(int,input().split())) for i in range(N)]

a,b,c=map(int,input().split())
X=gcd(gcd(a,b),c)
c//=X
a//=X
b//=X
if c**.5-a**.5-b**.5>0.1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
S = input()
ans = []
for s in S:
  if s == 'B' and ans:
    ans.pop()
  elif s != 'B':
    ans.append(s)

print(''.join(ans))