peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a, b = map(int, input().split())
if a < 6:
    print(0)
else:
    print(b if a > 12 else b // 2)
# Judge status: Accepted
import math

N, X, Y = map(int, input().split())

distnum = [0 for i in range(N)]


for i in range(1, N+1):
  for j in range(i, N+1):
    dist = min(abs(X-i) + 1 + abs(Y-j), abs(X-j)+1+abs(Y-i), abs(i-j))
    distnum[dist] += 1

for i in range(1, N):
  print(distnum[i])
# 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 sum(a[i:])+b[-1] <= a[i]+sum(b[i:]):
        ans += sum(b[i:])+a[i]
        break
    else: ans += a[i]    
if N == 1:
    print(a[0]+b[0])
else:
    print(ans)
# Judge status: Wrong Answer
n=int(input())
s=input()
a=0 #"("
b=0 #")"
cnt=0
for i in range(n):
    if s[i]=="(":
        if a<b:
            cnt+=b-a
            a,b=1,0
        else:
            a+=1
    else:
        b+=1
if a<b:
    cnt+=b-a
s=(cnt*"("+s)
print(s+")"*(len(s)-s.count("(")))
# Judge status: Accepted
x,a,b=map(int,input().split())
print("A" if abs(x-a)<=abs(x-b) else "B")
# Judge status: Wrong Answer
import math
a,b=input().split()
x=int(a+b)
if math.sqrt(x).is_integer:
	print('Yes')
else:
	print('No')
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))

print(-1)
# Judge status: Accepted
a,b,c,d=list(map(int,input().split())),[],0,0
for i in range(a[0]):
    b.append(list(map(int,input().split())))
b.sort()
for i in range(a[1]):
    c+=b[d][0]
    b[d][1]-=1
    if b[d][1]==0:
        d+=1
print(c)
# Judge status: Accepted
def solve(n, m):
    return m // 2 if 2 * n >= m else (2 * n + m) // 4

_n, _m = map(int, input().split())
print(solve(_n, _m))
# Judge status: Accepted
def resolve():
	count = 0
	N = int(input())
	L = sorted(list(map(int, input().split())))
	for i in range(N-2):
		for j in range(i+1, N-1):
			for k in range(j+1, N):
				if L[i] == L[j]:
					None
				elif L[j] == L[k]:
					None
				elif L[i] == L[k]:
					None
				elif (L[i] + L[j]) > L[k]:
					# print(i,j,k, file=sys.stderr)
					count += 1
	print(count)
resolve()
# Judge status: Accepted
a,b,c = map(int, input().split())
k = int(input())
l = [a,b,c]
l.sort()
print(l[-1]*2**k + sum(l[:-1]))
# Judge status: Accepted
a = input()
if a[0] == a[1] == a[2]:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
s= input()
print(s.rindex("Z")-s.index("A")+1)
# Judge status: Accepted
N = int(input())
t,x,y = 0,0,0

for i in range(N):
  a,b,c = map(int, input().split())
  tmp = abs(a-t) - abs(b-x) - abs(c-y) 
  if tmp >= 0 and tmp % 2 == 0:
    t,x,y = a,b,c
  else:
    print('No')
    exit()
print('Yes')
# Judge status: Wrong Answer
N,C,K = map(int,input().split())
T = []
for _ in range(N):
    t = int(input())
    T.append(t)
T.sort()
angry = 0
ans = 0
c = 0
for i in T:
    if angry == 0:
        angry = i + K
    c += 1
    if i >= angry :
        #print(i,angry)
        angry = i + K
        ans += 1
        c = 1
    elif c == C:
        angry = 0
        ans += 1
        c = 0
    #print(ans,angry,c)
if c > 0:
    ans += 1
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
x = sorted(map(int, input().split()))
y = sorted([x[i] - x[i - 1] for i in range(1, m)],reverse=True)
ans = x[-1] - x[0]
ans -= sum(y[:n-1])
print(ans)
# Judge status: Accepted
from collections import deque
s = input()
q = int(input())

s = deque(s)
t = 0
for _ in range(q):
  query = list(map(str, input().split()))
  if query[0] == "1": t = 1 - t
  else:
    if t == 0:
      if query[1] == "1": s.appendleft(query[2])
      elif query[1] == "2": s.append(query[2])
    elif t == 1:
      if query[1] == "1": s.append(query[2])
      elif query[1] == "2": s.appendleft(query[2])
if t == 1:print("".join(s)[::-1])
else: print("".join(s))
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(n) :
    if i == 0 :
        mn = p[i]
        count += 1
    else :
        if mn > p[i] :
            mn = p[i]
            count += 1
print(count)
# Judge status: Accepted
str_list = list(input().split(' '))
print(str_list[1]+str_list[0])
# Judge status: Wrong Answer
N = int(input())
A = sorted(list(map(int, input().split())))

from bisect import bisect_right
if A[-1] % 2 == 0:
    i = bisect_right(A, A[-1]//2)
else:
    i = bisect_right(A, (A[-1]+1)//2)
if A[i-1]-N//2 <= A[i]-N//2:
    r = A[i-1]
else:
    r = A[i]
print(A[-1], r)
# Judge status: Accepted

def solve():
    cnt = 0
    ans = 0
    for i in range(N-1):
        if H[i] >= H[i+1]:
            cnt += 1
            ans =max(ans, cnt)
        else:
            cnt = 0
    print(ans)

if __name__ == "__main__":
    N = int(input())
    H = list(map(int, input().split()))
    solve()
# Judge status: Accepted
N, L =map(int, input().split())
cost = 1001
count = 0
for i in range(N):
  c, t =map(int, input().split())
  if t <= L:
    if c < cost:
      cost = c
      count += 1
  elif t > L:
    continue;
if count == 0:
  print("TLE")
else:
  print(cost)
# Judge status: Wrong Answer
k = int(input())
s = 0
for x in range(2, k + 1, 2):
  for y in range(x, k + 1):
    if y % 2 == 1:
      s += 1
print(s)
# Judge status: Wrong Answer
n, a, b, c, d = map(int, input().split())
s = '_' + input()

if s[c] == '#' or s[d] == '#':
    print('No')
    exit()

# '##'を検知
num_hash = s[a:].count('##')
if num_hash > 0:
    print('No')
    exit()

if c > d:
    # 3 マス以上の連続する'.'が必要
    num_dot = s[b:].count("...")
    if num_dot == 0:
        print('No')
        exit()

print('Yes')
# Judge status: Accepted
n=int(input());print(n*800-n//15*200)
# Judge status: Accepted
def main():
    N, *AB = map(int, open(0).read().split())
    ans = 0
    for i in range(N):
        index = N - 1 - i
        a = AB[index * 2 + 0] + ans
        b = AB[index * 2 + 1]
        remainder = a % b
        ans += (b - remainder) % b
    print(ans)

if __name__ == "__main__":
    main()
# Judge status: Accepted
n, m = map(int, input().split())
for i in range(m):
    if n % 2 == 0 and n // 2 <= (m - i) * 2 - 1:
        x = 1
    else:
        x = 0
    print(i + 1, (m - i) * 2 + i + x)
# Judge status: Wrong Answer
import math
t = int(input())

for i in range(t,t+50):
    v = int(math.sqrt(i))
    f=0
    for j in range(2,v+1):
        if i%j==0:
            f=1
            break
    if(f==0):
        print(i)
        break
# Judge status: Accepted
N, D = map(int, input().split())
X = list()
Y = list()
for i in range(N):
    x, y = map(int, input().split())
    X.append(x)
    Y.append(y)

count = 0
for i in range(N):
    if X[i] * X[i] + Y[i] * Y[i] <= D * D:
        count += 1

print(count)
# Judge status: Wrong Answer
n = int(input())
s = list(map(int, input().split()))

count = 0
for i in range(n-1):
  if s[i] > s[i+1]:
    count += 1

print("YES" if count < 3 else "NO")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
a.sort()
x = a[-1]
y1 = x//2
y2 = x//2 + 1
sa1, sa2 = float("inf"), float("inf")
z1, z2 = 0, 0
for i in range(n-1):
    if sa1 > abs(y1 - a[i]):
        sa1 = abs(y1-a[i])
        z1 = a[i]
    if sa2 > abs(y2 - a[i]):
        sa2 = abs(y2 - a[i])
        z2 = a[i]

if sa1 >= sa2:
    print(x, z2)
else:
    print(x, z1)
# Judge status: Accepted
n=int(input())
p=tuple(map(int,input().split()))
q=tuple(map(int,input().split()))

from itertools import permutations
dict_num=[]
for i in permutations(range(1,n+1)):
    dict_num.append(i)

ans=abs(dict_num.index(p)-dict_num.index(q))
print(ans)
# Judge status: Accepted
X, N = map(int, input().split())
if N==0: print(X);exit()
p = list(map(int, input().split()))
count = 0
while True:
  if X - count not in p:
    print(X-count)
    exit()
  if X + count not in p:
    print(X+count)
    exit()
  count += 1
# Judge status: Accepted
import math

h=int(input())
w=int(input())
n=int(input())

ima=0

print(min(math.ceil(n/h), math.ceil(n/w)))
# Judge status: Accepted
from collections import Counter
 
s = Counter(input())
t = Counter(input())
 
sv = sorted(s.values())
tv = sorted(t.values())
 

if sv == tv:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s = input()

if s == "AAA" or s == "BBB":
    print("No")
else:
    print("Yes")
# Judge status: Accepted
def actual(n, k):
    """10進数のnをk進数に変換してその桁数を返す"""

    # 文字列で考えていく方が楽 
    s = ''
    
    while True:
        n, y = divmod(n, k)

        s += str(y)

        if n == 0:
            num_as_k = s[::-1]  # 不要だけど一応やっとく

            return len(num_as_k)

n, k = map(int, input().split())

print(actual(n, k))
# Judge status: Accepted
import math

H,A = map(int, input().split())
print(math.ceil(H/A))
# Judge status: Wrong Answer
# 1123311 = [[1,2],[2,1],[3,2],[1,2]]
S = input()
K = int(input())
Sd = [[int(S[0]), 1]]
n = 0

for i in range(len(S) - 1):
    if Sd[n][0] == S[i+1]:
        Sd[n][1] += 1
    else:
        Sd.append([int(S[i+1]), 1])
        n += 1

Sd = [[N, i] for N, i in Sd]

for n,i in Sd:
    if n==1:
        continue
    else:
        print(n)
        break
# Judge status: Accepted
A,B = [int(i) for i in input().split()]
if A > B:
  if B != 1:
  	print("Alice")
  else:
    print("Bob")
elif A < B:
  if A != 1:
  	print("Bob")
  else:
    print("Alice")
else:
  print("Draw")
# Judge status: Wrong Answer
a,*x=list(map(int,input()))
for i in range(8):
    k=a
    ans=str(a)
    for j in range(3):
        if i>>j&1:
            k+=x[j]
            ans+="+"+str(x[j])
        else:
            k-=x[j]
            ans+="-"+str(x[j])
    if k==7:
        print(ans+"=7")
# Judge status: Wrong Answer
N = input()
S = list(input())
print(S.count('D') + S.count('I'))
# Judge status: Wrong Answer
n = int(input())
a1 = list(map(int,input().split()))
a2 = list(map(int,input().split()))

ttl = 0
li1 = []
for i in range(n):
    ttl += a1[i]
    li1.append(ttl)

ttl = 0
li2 = []
for i in range(1,n+1):
    ttl += a2[i*(-1)]
    li2.append(ttl)

ans = 0
for i in range(n):
    print(li1[i]+li2[i])
    ans = max(ans,li1[i]+li2[(i+1)*(-1)])

print(ans)
# Judge status: Wrong Answer
#E - Payment
N = str(input())
count = 0
for i in range(len(N)):
    if int(N[i]) > 5:
        count += 1
    elif int(N[i]) == 5:
        count += 5
    else:
        count += int(N[i])+1

print(count)
# Judge status: Wrong Answer
n,m,x=map(int,input().split())
ca=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(2**n):
    check=[0]*m
    ans_=0
    for j in range(n):
        if ((i>>j)&1):
            ans_+=ca[j][0]#(✳︎)
            for k in range(m):
                check[k]+=ca[j][k+1]
    if all([l>=x for l in check]):
        ans=min(ans,ans_)
if ans==0:
    print(-1)
else:
    print(ans)
# Judge status: Wrong Answer
s = input()
t = s[::-1]

for i in range(len(s)):
  if s[i] == "A":
    break
for j in range(len(t)):
  if t[j] == "Z":
    break
print(len(s[i:-j]))
# Judge status: Accepted
import sys
input = sys.stdin.readline
import numpy as np

N = int(input())
hight_list = np.array([int(item) for item in input().split()])

dp = np.full(N, hight_list.sum(), dtype='int64')
dp[0] = 0
dp[1] = abs(hight_list[1] - hight_list[0])

for i in range(2, N):
    cost1 = abs(hight_list[i-1] - hight_list[i])
    cost2 = abs(hight_list[i-2] - hight_list[i])
    dp[i] = min(dp[i-1] + cost1, dp[i-2] + cost2)
    # print(dp)

print(dp[N-1])
# Judge status: Wrong Answer
S = input()
T = input()
def same(U):
    k = 0
    for i in range(len(U)):
        if U[i] == T[i]:
            k += 1
    return k
ans = 0
for i in range(len(S)-len(T)):
    ans = max(ans,same(S[i:i+len(T)]))
print(len(T)-ans)
# Judge status: Wrong Answer
import math
N = int(input())
li = [1 for i in range((10 ** 7) + 1)]
#print(li)
li[1] += 1
sq = int(math.sqrt((10 ** 7)+1))
for i in range(2, sq+1):
    #print(i)
    for j in range(i, (10 ** 7) // 2 + 1, i):
        li[j] += 1
        if j / i > sq:
            li[j] += 1
    li[i**2] -=1
count = 0
for i in range(1, N+1):
    count += li[i] * i
print(count)
# Judge status: Accepted
sl = list(input())

a = [0, 0]
for s in sl:
    a[int(s)] += 1

print(min(a) * 2)
# Judge status: Wrong Answer
import math
from fractions import Fraction as frac

MOD = 1e9 + 7

def solve(case_no):
    n = int(input())
    a = list(map(int, input().split()))
    ps = [a[0]]
    for i in range(1, n):
        ps.append(ps[i - 1] + a[i])
    ans = 0
    for i in range(n - 2, -1, -1):
        ans += a[i + 1] * ps[i]
        ans %= MOD
    print(int(ans))

t = 1
# t = int(input())
for i in range(1, t + 1):
    solve(i)
# Judge status: Accepted
n = int(input())
l = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
for _ in range(n):l[input()] += 1
for k in l.keys():print(k+' x '+str(l[k]))
# Judge status: Accepted
from math import sqrt, factorial
n = int(input())
x, y = [0] *  n, [0] * n

for i in range(n):
    x[i], y[i] = map(int, input().split())

total = 0
for i in range(n):
    for j in range(i + 1, n):
        #print(sqrt((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2))
        total += 2 * sqrt((x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2)

print(total / n)
# Judge status: Accepted
import math
N = int(input())
print(math.factorial(N) % (10 ** 9 + 7))
# Judge status: Wrong Answer
N=int(input())
M=list(map(int, input().split()))
ans=min(M)
for m in M:
  if m%ans!=0:
    ans=1
    break
print(ans)
# Judge status: Wrong Answer
a, b = map(int, input().split())

answer = 0
for i in range(a,b+1):
  checkNumber = str(i)
  count = 0
  for j in range(2): 
    if (checkNumber[j] == checkNumber[j+3]):
      count += 1

  if count == 2:
    answer += 1

print(answer)
# Judge status: Accepted
N, M = map(int, input().split())

print(int(N * (N - 1) / 2 + M * (M - 1) / 2))
# Judge status: Accepted
k,s=map(int,input().split())
cnt=0
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-(i+j)<=k:
      cnt+=1

print(cnt)
# Judge status: Accepted
def main(s):
    if len(s)%2 != 0 :
        return False
    for i in range(len(s)):
        res = True
        if i%2 == 1:
            continue
        else:
            if s[i]!="h" or s[i+1]!="i":
                return False
    return res

s = input()
print("Yes" if main(s) else "No")
# Judge status: Accepted
import itertools
def LI():return list(map(int,input().split()))
n,m,q=LI()
abcd=[]
for _ in range(q):
  a,b,c,d=LI()
  a-=1
  b-=1  
  abcd.append((a,b,c,d))
As=itertools.combinations_with_replacement(range(m),n)
ans=0
for A in As:
  cnt=0
  for a,b,c,d in abcd:
    if A[b]-A[a]==c:cnt+=d
  ans=max(ans,cnt)
print(ans)
# Judge status: Wrong Answer
X,Y=map(int,input().split())
a=(4*X-Y)/2
b=(Y-2*X)/2
ans=""
if a-int(a)==0 and b-int(b)==0:
    if a*b>=0 and a+b>=0:
        ans="Yes"
    else:
        ans="No"
else:
    ans=="No"
if a==0 and b==0:
    ans="No"
print(ans)
# Judge status: Accepted
S = input()

i = 0
h = 0
c = 0

while i < len(S):
  hx = 0
  while i < len(S) and S[i] == '<':
    i += 1
    hx += 1
  c += hx * (hx + 1) // 2
  h = hx
  #
  hx = 0
  while i < len(S) and S[i] == '>':
    i += 1
    hx += 1
  c += hx * (hx + 1) // 2
  c -= h if hx > h else hx
  h = hx

print(c)
# Judge status: Accepted
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
first = set()
second = set()
for i in range(m):
    a[i], b[i] = map(int, input().split())
    if a[i] == 1:
        first.add(b[i])
    if b[i] == n:
        second.add(a[i])


ans = 'IMPOSSIBLE'
if first & second:
    ans = 'POSSIBLE'
print(ans)
# Judge status: Wrong Answer
n = int(input())
if n == 0:
  print(n)
else:
  dano = 0
  frog = []
  a = input().split()
  for i in range(len(a)):
    frog.append(int(a[i]))
  a = len(frog)-1
  while a > 0:
    if a == 1:
      dano += abs(frog[1] - frog[0])
      a = 0
    else:
      if abs(frog[a] - frog[a-1]) < abs(frog[a] - frog[a-2]):
        dano += abs(frog[a] - frog[a-1])
        a -= 1
      else:
        dano += abs(frog[a] - frog[a-2])
        a -= 2
print(dano)
# Judge status: Accepted
a, b, c = map(int, input().split())
d = b//a
if d <= c:
    print(d)
else:
    print(c)
# Judge status: Wrong Answer
import math

a,b,c=map(int,input().split())
l=[a,b,c]
sorted(l)


print("Yes" if l[0]+l[1]==l[2] else "No")
# Judge status: Accepted
import math
n, m = map(int, input().split())
# 組み合わせの全通り
all_pattern = math.factorial(n+m) // (math.factorial(n+m - 2) * math.factorial(2))
print(all_pattern - n*m)
# Judge status: Wrong Answer
n,x = map(int,input().split())
al = list(map(int,input().split()))
al.sort()
c = 0
for a in al:
  if x >= a:
    c += 1
    x -= a
if x > 0 and c > 0:
  c -= 1
print(c)
# Judge status: Wrong Answer
a,b = map(int, input().split())
print(a+b%2)
# Judge status: Accepted
import numpy as np
import sys
input = sys.stdin.buffer.readline

N, M, K = map(int, input().split())
cumA = np.zeros(N+1, dtype=np.int64)
cumA[1:] = np.array(input().split(), dtype=np.int64).cumsum()
cumB = np.zeros(M+1, dtype=np.int64)
cumB[1:] = np.array(input().split(), dtype=np.int64).cumsum()
# print(cumA)
# print(cumB)

ans = 0
for i in range(N, -1, -1):
    if cumA[i] > K: continue
    j = np.searchsorted(cumB, K-cumA[i], side='right')
    ans = max(ans, i+j-1)
print(ans)
# Judge status: Wrong Answer
def gcd(a,b):
  while b:a,b=b,a%b
  return a
n=int(input())
a=list(map(int,input().split()))
if n==2:print(gcd(a[0],a[1]));exit()
left=[a[0]]
for i in range(1,n):left.append(gcd(left[-1],a[i]))
right=[a[n-1]]
for i in range(n-2,-1,-1):right.append(gcd(right[-1],a[i]))
right.reverse()
ans=max(right[1],left[n-2])
print(max(ans,max(gcd(left[i-1],right[i+1])for i in range(1,n-1))))
# Judge status: Accepted
n = int(input())
s = input()
w_count = s.count('W')
e_count = s.count('E')
w_count_cum = 0
e_count_cum = 0
ans = n

for i, s_i in enumerate(s):
  if s_i == 'W':
    w_count_cum += 1
    l_w = max(0, w_count_cum-1)
  elif s_i == 'E':
    e_count_cum += 1
    l_w = max(0, w_count_cum)
 
  r_e = max(0, e_count-e_count_cum)
  
  ans = min(ans, l_w+r_e)
    
print(ans)
# Judge status: Wrong Answer
x,a,b = map(int,input().split())

print('delicious') if b < a else print('safe') if b < a+b else print('dangerous')
# Judge status: Accepted
from collections import defaultdict as d

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

som = []
diff = []

dsom = d(int)
ddiff = d(int)
for i in range(n):
	som.append(i+1+arr[i])
	diff.append((i+1-arr[i]))
	
	dsom[som[-1]] += 1
	ddiff[diff[-1]] += 1

val = 0
for k, v in dsom.items():
	val += (v * ddiff[k])
	
print(val)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
b = []
num = 1
for x in a:
  if num%2 == 1:
    b.append(x)
  else:
    b.insert(0,x)
  num += 1
print(*b)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

real = 1000
unreal = 0

for i in range(n-1):
    print(i)

    if a[i] < a[i+1]:
        unreal, real = divmod(real, a[i])

    elif a[i] > a[i+1]:
        real += (unreal * a[i])
        unreal = 0

    else:
        continue

real += unreal * a[n-1]
print(real)
# Judge status: Accepted
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N,A,B = MI()

ans = 0
for i in range(1,N+1):
    if A <= sum(int(j) for j in list(str(i))) <= B:
        ans += i
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
a = list(map(int,input().split()))

for i in range(n - k):
    if a[i + k] > a[i]:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
N,Y = map(int,input().split())
A,B,C = 0,0,0
flag = False
for i in range(N):
    if flag:
        break
    for j in range(N):
        if i*10000 + j*5000 + (N-i-j)*1000 == Y and (N-i-j) >= 0:
            A,B,C = i,j,(N-i-j)
            flag = True
            break
        if A == B == C == 0:
            A,B,C = -1,-1,-1
print(A,B,C)
# Judge status: Accepted
import sys
from collections import deque
mapin = lambda: map(int, sys.stdin.readline().split())
listin = lambda: list(map(int, sys.stdin.readline().split()))
inp = lambda: sys.stdin.readline()

N,M,X,Y = mapin()
veca = listin()
vecb = listin()
max_x = -10000
min_y = 10000
for i in veca:
    if max_x < i:max_x = i
for i in vecb:
    if min_y > i:min_y = i
if max_x < min_y and max_x > X and min_y < Y:
    print("No War")
else:print("War")
# Judge status: Wrong Answer
# https://atcoder.jp/contests/abc079/tasks/abc079_c
import random
import sys

str = input()
print(str)


def retop():
    if(random.uniform(0, 1) > 0.5):
        return "+"
    return "-"


for i in range(100):
    formula = (str[0] + retop() + str[1] + retop() + str[2] + retop() + str[3])
    if eval(formula) == 7:
        print(formula)
        sys.exit()
# Judge status: Accepted
n,m = map(int, input().split())
if n == m:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
S = input()

Z = []
X = len(S)

i = 0
while i  < X :
    if S[i] == "0":
        Z.insert(0,0)
    elif S[i] == "1":
        Z.insert(0,1)
    elif S[i] == "B":
        if len(Z)<= 1:
            pass
        else:
            Z.pop(0)
    i += 1

i = 0
X = len(Z)
while i < X:
    print(Z[i] , end ="")
    i +=1
# Judge status: Accepted
c = [list(map(int, input().split())) for i in range(3)]

j = True
for i in range(2):
    if abs(c[i+1][0]-c[i][0]) == abs(c[i+1][1]-c[i][1]) == abs(c[i+1][2]-c[i][2]):
        pass
    else:
        j = False

for i in range(2):
    if abs(c[0][i+1]-c[0][i]) == abs(c[1][i+1]-c[1][i]) == abs(c[2][i+1]-c[2][i]):
        pass
    else:
        j = False

if j:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N,R = map(int,input().split())
if N >= 10:
    print(R)
else:
    print(R-(100*(10-N)))
# Judge status: Accepted
n=int(input())
print((n+n%2)//2)
# Judge status: Wrong Answer
n = int(input())
x = list(map(int, input().split()))

m = 100 * 100 * n
sumlist = []

for i in range(max(x)):
    s = 0
    for j in range(n):
        s += (x[j] - i) ** 2

    sumlist.append(s)

print(min(sumlist))
# Judge status: Wrong Answer
S = input()
A = []
A.append(0)

for i in range(len(S)):
    if S[i] == "<":
        A.append(A[i] + 1)
    else:
        A.append(0)

for i in range(len(S)):
    if S[len(S) - i - 1] == ">":
        A[len(S) - i - 1] = max(A[len(S) - i - 1], A[len(S) - i] + 1)
    else:
        continue

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

for i in range(n-k+1, n):
    if al[i-k] < al[i]:
        print('Yes')
    else:
        print('No')
# Judge status: Accepted
n, k = map(int, input().split())
a = [int(input()) for i in range(n)]

a.sort(reverse=True)
s = 10000000000
for i in range(k, n + 1):
    s = min(a[i - k] - a[i - 1], s)

print(s)
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=[[int(i) for i in input().split()]for i in range(m)]
print(a)
s=set()
for i in a:
    if i[1]==n:
        s.add(i[0])
for i in a:
    if i[0]==1 and i[1] in s:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')
# Judge status: Accepted
a, s, c = input().split()
print("A" + s[0] + "C")
# Judge status: Accepted
a, b, c = map(int, input().split())
if a + b >= c:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n,y=map(int, input().split())

for i in range(n + 1):
    for j in range(n - i + 1):
        if i *10000 + j * 5000 + (n-i-j) * 1000 == y:
            print(i, j, n-i-j)
            exit()
print("-1 -1 -1")
# Judge status: Accepted
L,R,d = map(int, input().split())

ans = 0
for i in range(L, R+1):
  if i % d == 0: ans +=1

print(ans)
# Judge status: Wrong Answer
n,p=int(input()),input().split();print(sum(1 for x in range(n-2)if p[x]<p[x+1]<p[x+2]or p[x]>p[x+1]>p[x+2]))
# Judge status: Wrong Answer
n,k=map(int,input().split())
if n<=k:
    print(n)
elif k==0:
    print(n)
elif n%k==0:
    print(n)
else:
    t=n//k
    s=(t+1)*k-n
    r=n-t*k
    print(min(r,s))