peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import math
a,b=map(int,input().split())
gcd=math.gcd(a,b)

def prime_factorization(n):
  i=2
  prime=[]
  if n%i==0:
    n//=i
    prime.append(2)
    while n%i==0:
      n//=i
  i+=1
  k=int(n**0.5)+1
  for j in range(i,k+1,2):
    if n%j==0:
      n//=j
      prime.append(j)
      while n%j==0:
        n//=j
  if n>1:
    prime.append(n)
  return prime

print(len(prime_factorization(gcd))+1)
# Judge status: Accepted
import math
n,m = map(int,input().split())
if abs(n-m) > 1:
    print(0)
else:
    if n == m:
        print((2*math.factorial(n)*math.factorial(m))%(10**9+7))
    else:
        print((math.factorial(n)*math.factorial(m))%(10**9+7))
# Judge status: Wrong Answer
d = int(input())
c = list(map(int, input().split()))
prev = [0] * 26
for i in range(d):
  s = list(map(int, input().split()))
  happy = - (10 ** 5)
  ans = -1
  for j in range(26):
    tmp = s[j]
    cost = 0
    for k in range(26):
      if j == k:
        continue
      cost += c[k] * (i - prev[k])
    tmp -= cost
    if tmp > happy:
      happy = tmp
      ans = j+1
  print(ans)
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]

ans = 0
rest = 0
for i, a in enumerate(A):
    if rest == 0:
        ans += a // 2
        rest = a % 2
    else:
        if (a + rest) % 2 == 0:
            ans += (a + rest) // 2
            rest = 0
        else:
            ans += (rest + a) // 2
            rest = 1 if a != 0 else 0

print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if a < c < b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
"""
author : halo2halo
date : 8, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

A, B = map(int, readline().decode('utf8').split())

print(A * B if A <= 9 and B <= 9 else -1)
# Judge status: Wrong Answer
a,b=input().split()
c=int(a+b)
x=c**0.5
if a==b==100:
  print("No")
elif x**2==c:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
from numpy import *
print(lcm.reduce([int(input()) for n in range(int(input()))]))
# Judge status: Accepted
n = int(input())
a = n // 500
n %= 500
b = n // 5
print(a * 1000 + b * 5)
# Judge status: Wrong Answer
def resolve():
    nclo=range(int(input()))
    from fractions import gcd
    def lcm(a,b):
        return (a*b)//gcd(a,b)
    next=0
    temp=1
    for i in nclo:
        next=int(input())
        temp=lcm(temp,next)
    print(temp)
        
#%%submit!
#resolve()
# Judge status: Wrong Answer
s = input()
t = input()
if len(t) == len(s) + 1 and 1 <= len(s) <= 10:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
s = input()
ans = []
for i in range(int(len(s))):
    if s[i] == "0":
        ans.append(0)
    elif s[i] == "1":
        ans.append(1)
    elif s[i] == "B":
        if not ans:
            continue
        del ans[int(len(ans))-1]
for i in ans:
    print(i,end="")
# Judge status: Accepted
time = list(map(int,input().split()))
time.sort()
print(time[0]+time[1])
# Judge status: Accepted
N, K = map(int, input().split())
P = list(map(int, input().split()))
for i in range(N):
    P[i] -= 1
M = 60
step = [[0]*(M+1) for _ in range(N)]

for i in range(N):
    step[i][0] = P[i]

for i in range(1, M+1):
    for j in range(N):
        c = step[j][i-1]
        c = step[c][i-1]
        step[j][i] = c

c = 0
for j in range(M+1):
    if K % 2:
        c = step[c][j]
    K //= 2
print(c+1)
# Judge status: Accepted
N = int(input())
A = []
B = []

for _ in range(N):
    a,b = map(int, input().split())
    A.append(a)
    B.append(b)

C = list(zip(A,B))
C = sorted(C, key=lambda x:x[1])

time = 0
for a,b in C:
    time = time + a
    if time<=b:
        continue
    print("No")
    exit()
print("Yes")
# Judge status: Wrong Answer
s=input().replace('\n', '')
t=input().replace('\n', '')
begin, end = len(s) - len(t), len(s)
ans=''
while begin>=0:
    origin = s[begin:end]
    if origin!=t:
        ans = s[:begin]+t+s[end:]
        break
    begin-=1
    end-=1
print("UNRESTORABLE" if not len(ans) else ans.replace('?', 'a'))
# Judge status: Wrong Answer
K, X = map(int, input().split())
result = K*500
if result >= X:
    print("yes")
elif result < X:
    print("no")
# Judge status: Accepted
n, a, b = map(int, input().split())
if (a - b) % 2 == 0:
  print(abs((a - b) // 2))
else:
  ans = min(a - 1, n - b) + 1 + ((b - a - 1) // 2)
  print(ans)
# Judge status: Accepted
import collections
n = int(input())
a = collections.Counter([int(x) for x in input().split()])
res = 0
for key in a.keys():
    k_int = int(key)
    val = a[key]
    if k_int == val:
        continue
    elif k_int < val:
        res += val - k_int
    else:
        res += val
print(res)
# Judge status: Wrong Answer
n,q = map(int,input().split())
s = str(input())
ls = [list(map(int,input().split())) for _ in range(q)]
c = 0
a = [0]*10**5
for i in range(n-1):
    if s[i] == "A":
        if s[i+1] == "C":
            a[i] = i
a = list(set(a))
for j in range(q):
    (u,t) = (ls[j][0],ls[j][1])
    for k in a:
        if (k >= u-1) and (k <= t-2):
            c += 1
    print(c)
    c = 0
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if c<a+b*2:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
h,n = map(int, input().split())
a = list(map(int, input().split()))

if sum(a) >= h:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N = set(input())
print('Yes' if len(N) < 3 else 'No')
# Judge status: Accepted
n = int(input())
x = 10 ** n
x -= 2*(9**n)
x += 8**n
x %= 1000000007
print(x)
# Judge status: Accepted
import itertools

N,M,Q = map(int, input().split())
series = list()

for i in range(Q):
	series.append(list(map(int,input().split())))

A = [x for x in range(1,M+1)]

max_score = 0
for a in itertools.combinations_with_replacement(A,N):
	score = 0
	for s in series:
		if (a[s[1]-1] - a[s[0]-1]) == s[2]:
			score += s[3]

	if score > max_score: max_score = score

print(max_score)
# Judge status: Accepted
a, b,c = map(int, raw_input() .split())
if b - a == c - b:
    print "YES"
else:
    print "NO"
# Judge status: Accepted
n=int(input())
t=[0]*(n+1)
x=[0]*(n+1)
y=[0]*(n+1)
for i in range(n):
  t[i+1],x[i+1],y[i+1]=map(int,input().split())
  
  lim_t=t[i+1]-t[i]
  lim_x=x[i+1]-x[i]
  lim_y=y[i+1]-y[i]
  
  if abs(lim_x)+abs(lim_y)>lim_t or (lim_t-lim_x-lim_y)%2==1:
    print('No')
    exit()
    
print('Yes')
# Judge status: Wrong Answer
a,b,t = map(int,input().split())

for i in range(1,20):
  if a*i*(i+1)/2 >t+0.5:
    if i==1:
      print(0)
      break
    else:
      print(b*i)
      break
# Judge status: Accepted
S = list((input()))
print(min(S.count('0'),S.count('1')) * 2)
# Judge status: Accepted
n = int(input())
ans = "No"
for i in range(1, 10):
    for j in range(1, 10):
        if i * j == n:
            ans = "Yes"
print(ans)
# Judge status: Accepted
W, a, b = map(int, input().split())
if a > b:
    a, b = b, a

ans = max(0, b - (a + W))
print(ans)
# Judge status: Accepted
import math

A, B, H, M = map(int, input().split())

h = math.pi*2/(12*60)
m = math.pi*2/60

angle_M = M * m
angle_H = (H * 60 + M) * h

angle = math.fabs(angle_M - angle_H)

length = math.sqrt(A * A + B * B - 2 * A * B * math.cos(angle))

print(length)
# Judge status: Accepted
from fractions import gcd

A,B = map(int,input().split())
C = gcd(A,B)
nse = set()

for i in range(1,int(C**0.5+1)):
  if C%i == 0:
    nse.add(i)
    nse.add(C//i)
    
nli = list(nse)
nli.sort()
size = len(nli)

for i in range(1,size):
  n = nli[i]
  for j in range(i+1,size):
    if nli[j]%n == 0 :
      nse.add(nli[j])
      nse.remove(nli[j])

print(len(nse))
# Judge status: Accepted
N = int(input())
P_ls = list(map(int, input().split(' ')))
rst, min_val = 0, 10 ** 6
for i in P_ls:
    if min_val >= i:
        rst += 1
        min_val = i
print(rst)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
dif = 1000000000
best = a[0] // 2
ans = 0
for i in range(1, n):
    new_dif = abs(best - a[i])
    if dif <= new_dif:
        ans = a[i - 1]
        break
    dif = new_dif
else:
    print(a[0], a[1])
    exit()
print(a[0], ans)
# Judge status: Wrong Answer
N = int(input())
A = [int(i) for i in input().split()]
a = 0
b = []

for i in range(N):
    c=0
    for j in range(N):
        if A[i] == A[j]:
            c+=1
    c-=1
    b.append(c)
    a+=c
a/2
for i in range(N):
    print(a-b[i])
# Judge status: Wrong Answer
n=int(input())
p=[int(j) for j in input().split()]
s=range(n)
x=0
  
c=0

for a in range(n):
  if p[a]!=s[a]:
    c=c+1
  

if c>2:
  print('NO')
  
if c<=2:
  print('YES')
# Judge status: Accepted
n,m,k=map(int,input().split())
cnt=0
flag =0
for i in range(n+1):
    for j in range(m+1):
        cnt = (m*i) - (i*j) + (j*(n-i))
        if cnt == k:
            flag=1
if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from collections import deque
s = input()
n = int(input())
d = deque(s)

now_reverse = False

for _ in range(n):
  query = input()

  if query == '1':
    now_reverse = not now_reverse
    continue

  
  _,f,c = query.split()
  if f == '1' and now_reverse:
    d.append(c)
  elif f == '1' and not now_reverse:
    d.appendleft(c)
  elif f == '2' and now_reverse:
    d.appendleft(c)
  else:
    d.append(c)
  
if now_reverse:
  d = reversed(list(d))
else:
  d =list(d)

for c in d:
  print(c,end='')
print()
# Judge status: Wrong Answer
N = input()
if len(N)==1:
    print(int(N))
else:
    print(int(N[0])-1 + 9*(len(N)-1))
# Judge status: Accepted
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n-1):
    if x >= a[i]:
        x -= a[i]
        ans += 1
if x == a[-1]:
    ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

ans = [0] * n
for i in range(n - 1, -1, -1):
    sum = 0
    for j in range(i + i + 1, n, i + 1):
        sum += ans[j]

    ans[i] = a[i] - sum
    ans[i] %= 2

print(ans.count(1))

for i in range(n):
    if ans[i] == 1:
        print(i + 1, end=" ")
# Judge status: Accepted
n = int(input())
data = list(map(int,input().split()))
data = sorted(data, reverse=True)
alice = 0
bob = 0
for i,var in enumerate(data):
    if i%2 == 0:    
        alice += var
    else:    
        bob += var
print(alice-bob)
# Judge status: Accepted
x = int(input())

for i in range(360):
    if x*(i+1) % 360 == 0:
        print(i+1)
        exit()
# Judge status: Accepted
N,D = map(int,input().split())
w = D*2+1
ans = 0--N//w
print(ans)
# Judge status: Wrong Answer
h,n=map(int,input().split())
a_=0
magic=[]
for i in range(n):
  a,b=map(int,input().split())
  a_=max(a,a_)
  c=[a,b]
  magic.append(c)
dp=[10**7+1]*(h+a_+1)
dp[0]=0
for i in range(n):
  a,b=magic[i]
  for j in range(len(dp)):
    if j+a<=h+a_:
      dp[j+a]=min(dp[j+a],dp[j]+b)
print(min(dp[h:]))
# Judge status: Accepted
nums = list(map(int, input().split()))

if nums.count(nums[0]) == 2 or nums.count(nums[1]) == 2 or nums.count(nums[2]) == 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
b=s=0
for a in[*open(0)][1].split():a=int(a);b=max(b,a);s+=b-a
print(s)
# Judge status: Accepted
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    s = input()
    cnt = 0
    m = 0
    for i in range(n):
        if s[i] == '(':
            cnt += 1
        else:
            cnt -= 1
        m = min(m, cnt)
    ans = '('*(-m)+s+')'*(cnt-m)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
sa = sum(a)
sb = sum(b)
counta = 0
countb = 0
for i,j in zip(a,b):
    if j > i:
        if (j-i)%2:
            countb += 1
        counta += (j-i+1)//2
    elif i > j:
        countb += i-j
if counta <= sb-sa and countb <= sb-sa:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
# E - Payment

N = input().strip()

s = 0
carry = 0
prev = None
for c in reversed(N):
    x = int(c) + carry
    if x > 5 or x == prev == 5:
        if prev == 5:
            x += 1
        s += 10 - x
        carry = 1
    else:
        s += x
        carry = 0
    prev = x
s += carry

print(s)
# Judge status: Wrong Answer
N, M = map(int, input().split())
ABs = [input().split() for i in range(M)]
 
 
MPs = {}
for a, b in ABs:
    if a not in MPs:
        MPs[a] = 1
    else:
        MPs[a] += 1
    if b not in MPs:
        MPs[b] = 1
    else:
        MPs[b] += 1
 
for mp in range(1, N+1):
    if str(mp) not in MPs:
        MPs[str(mp)] = '0'
 
for y in MPs.values():
    print(y)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
AA = []
for i in range(N):
    if i == 0:
        AA.append(A[i])
    else:
        AA.append(A[i])
        AA.append(A[i])
AA.sort(reverse=True)
ans = 0
for i in range(N-1):
    ans += AA[i]
print(ans)
# Judge status: Accepted
n = int(input())

def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

print(num2alpha(n).lower())
# Judge status: Wrong Answer
N, K = map(int, input().split())
h = list(map(int, input().split()))
for j in range(K):
    h.append(0)
INF = float('inf')
dp = [INF] * (N+K)
dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        dp[i+j] = min(dp[i+j], dp[i] + abs(h[i]-h[i+j]))
print(dp, h)
# Judge status: Wrong Answer
from decimal import *
a, b, x = map(Decimal, input().split())
dif = b - a
ans = dif // x
if a % x == 0:
    ans += 1
elif b % x == 0:
    ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
ans = 1
for x in set(s):
    ans *= s.count(x)+1
print((ans-1)%(10**9+7))
# Judge status: Wrong Answer
n, c, k = map(int, input().split())
arr = sorted([int(input()) for _ in range(n)])

ans = 0
cnt = 0
tmp_t = 0
for t in arr:
    cnt += 1
    if cnt >= c:
        ans += 1
        cnt = 0
    elif t - tmp_t > k:
        ans += 1
        cnt = 0
        tmp_t = t

print(ans)
# Judge status: Accepted
import math

S = input()
len_S = len(S)
half = math.floor(len_S/2)

counter = 0
for i in range(half):
    if S[i] != S[len_S-i-1]:
        counter += 1

print(counter)
# Judge status: Accepted
n, k = map(int, input().split())
c = 0
m = 10**9 +7
for i in range(k, n+2):
  c += (n*(n+1)//2 - (n-i)*(n-i+1)//2) - (i-1)*i//2 + 1
print(c%m)
# Judge status: Wrong Answer
n,x = map(int,input().split())
x_list = list(map(int,input().split()))
x_list.append(x)
x_list = sorted(x_list)

if len(x_list) >= 3:
  c = [x_list[2] - x_list[1],x_list[1] - x_list[0]]
  while c[0]%c[1] != 0:
    c.append(c[0]%c[1])
    c.pop(0)
  else:
    print(c[1])
else:
  print(x_list[1]-x_list[0])
# Judge status: Accepted
N, M = map(int, input().split())

L = []
R = []
for i in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

ans = 0
l = max(L)
r = min(R)
for i in range(N):
    if i+1 >= l and i+1 <= r:
        ans += 1

print(ans)
# Judge status: Accepted
N = int(input())
S = list(input())
ans = 0
for i in range(N):
    l = set(S[:i])
    r = set(S[i:])
    S_intersection = l & r
    ans = max(len(S_intersection), ans)
print(ans)
# Judge status: Accepted
n,m,k=map(int,input().split())
for x in range(n+m+1):
    for a in range(min(n+1,x+1)):
        if 0<=x-a<=m:
            num=a*m+(x-a)*(n-2*a)
            if k==num:
                print("Yes")
                exit()
print("No")
# Judge status: Accepted
def dfs(N, s, maxc):
    if len(s) == N:
        print(s)
    else:
        for i in range(ord(maxc)-ord('a') + 2):
            ord_c = ord('a')+i
            dfs(N, s+chr(ord_c), chr(max(ord_c, ord(maxc))))

N = int(input())
dfs(N, 'a', 'a')
# Judge status: Accepted
from sys import stdin, setrecursionlimit
from bisect import bisect_right


def main():
    input = stdin.buffer.readline
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()

    idx = bisect_right(a, 0)

    if idx % 2 == 0:
        print(sum(a[idx:]) - sum(a[:idx]))
    elif idx == n:
        print(a[idx - 1] - sum(a[:idx - 1]))
    else:
        print(sum(a[idx:]) - sum(a[:idx]) - 2 * min(-a[idx - 1], a[idx]))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
# Judge status: Wrong Answer
def main():
    x=input()
    if x=='30':
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
# Judge status: Accepted
N=int(input())
d={}
for i in range(1,10):
  for j in range(1,10):
    d[i*10+j]=0
for i in range(1,min(10,N+1)):
  d[i*10+i]=1
for i in range(11,N+1):
  i=str(i)
  h,t=int(i[0])*10,int(i[-1])
  if t!=0:
    d[h+t]+=1
ans=0
for i in range(1,9):
  for j in range(i+1,10):
    ans+=(d[i*10+j]*d[j*10+i])*2
for i in range(1,10):
  ans+=d[i*10+i]**2
print(ans)
# Judge status: Accepted
import sys
from collections import defaultdict
n,m=map(int,sys.stdin.readline().split())
l=list(map(int,sys.stdin.readline().split()))
l.sort()
l.reverse()
limit=(sum(l)/(4*m))
i=0
#print(l,'l')
while i<n and l[i]>=limit:
    i+=1
if i>=m:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
k,s=map(int,input().split())
ans=0
if s%3==0:
  ans+=1
for i in range(k):
  if 2*k<=s<3*k:
    ans+=3
for i in range(k-1):
  for j in range(i+1,k):
    for k in range(j+1,k+1):
      if i+j+k==s:
        ans+=6


print(ans)
# Judge status: Accepted
N, M, X, Y = map(int, input().split())
xs = list(map(int, input().split()))+[X]
ys = list(map(int, input().split()))+[Y]
print(("No " if max(xs) < min(ys) else "")+"War")
# Judge status: Accepted
import fractions
A,B,C=map(int,input().split())
lcm = A*B#//fractions.gcd(A,B)
#A*(i+j)%B=C
#A*(i+j)=BX+C
i=A
while i<=lcm:
  #print(i,lcm)
  if i%B==C:
    print("YES")
    exit()
  i+=A
print("NO")
# Judge status: Accepted
n = int(input())
AC = 0
WA = 0
TLE = 0
RE  = 0
for i in range(n):
    s = input()
    if s == "AC":
        AC += 1
    elif s == "WA":
        WA += 1
    elif s == "TLE":
        TLE += 1
    else:
        RE += 1
    
print("AC x",AC)
print("WA x",WA)
print("TLE x",TLE)
print("RE x",RE)
# Judge status: Accepted
N = int(input())
A1, A2 = [list(map(int, input().split())) for _ in range(2)]
print(max([sum(A1[:i + 1] + A2[i:]) for i in range(N)]))
# Judge status: Accepted
import sys
import fractions
from functools import reduce
input = sys.stdin.readline
n, m = [int(x) for x in input().rstrip().split()]
a = [int(x)//2 for x in input().rstrip().split()]
a = list(set(a))

def lcm_base(x, y): return x * y // fractions.gcd(x, y)
lcm = reduce(lcm_base, a, 1)


for x in a:
    if (lcm // x) % 2 == 0:
        print(0)
        break
else:
    print((m // lcm + 1) // 2)
# Judge status: Accepted
def f(n):
    if n%2==0:
        return n/2
    else:
        return 3*n+1
def has_duplicates(seq):
    return len(seq) != len(set(seq))
s=int(input())
a=list()
a.append(s)
i=0
while True:
    a.append(f(a[i]))
    double=has_duplicates(a)
    if double==True:
        print(i+2)
        break
    i+=1
# Judge status: Wrong Answer
n = int(input())
s = list(input())
ans = 0
c = 0
fh = []
lh = s
for i in range(n):
  tmp = lh.pop(0)
  if tmp not in fh:
    if tmp in lh:
      c += 1
    else:
      c -= 1
    fh.append(tmp)
  ans = max(ans, c)
print(ans)
# Judge status: Accepted
aAndb = list(map(int, input().split()))
ab = aAndb[0] * aAndb[1]
if ab%2==0:
    print("Even")
else:
    print("Odd")
# Judge status: Wrong Answer
c = [input() for _ in range(2)]

if c[0][1] == c[1][1] and sorted(c[0]) == sorted(c[1]):
	print("Yes")
else:
	print("No")
# Judge status: Accepted
from bisect import bisect_left

n = int(input())
a = list(map(int, input().split()))
a.sort()
ma = a[-1]
mid = ma / 2 # ma/2に最も近いものをとってくればよい

idx = bisect_left(a, mid)

if abs(a[idx] - mid) < abs(a[idx-1] - mid):
	ans_idx = idx
else:
	ans_idx = idx - 1

print(ma, a[ans_idx])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

color = [0] * 8
free = 0
for i in a:
    if i < 3200:
        c = i // 400
        color[c] = 1
    else:
        free += 1

ans = sum(color)
print(max(1, ans), ans + free)
# Judge status: Accepted
n, m = map(int, input().split())
deg = [0] * n
for i in range(m):
    u, v = map(int, input().split())
    deg[u - 1] += 1
    deg[v - 1] += 1
for i in range(n):
    print(deg[i])
# Judge status: Accepted
a, b, c = map(int, input().split())
print("Yes" if a+b>=c else "No")
# Judge status: Accepted
K,S=map(int,input().split())
num=0
for i in range(K+1):
    for j in range(K+1):
        k=S-i-j
        if 0<=k<=K:
            num+=1
print(num)
# Judge status: Accepted
N, M = map(int, input().split())
list = []

for i in range(M):
	a, b = map(int, input().split())
	list.append(a)
	list.append(b)

for i in range(1,N+1):
	print(list.count(i))
# Judge status: Accepted
def main():
  n,k=map(int,input().split())
  s=input()
  
  A=(('L','R'),('R','L'))
  B=[]
  Bappend=B.append
  cnt=0
  for i in range(n-1):
    tmp=(s[i],s[i+1])
    cnt+=1
    if tmp==A[0]:
      Bappend(cnt)
      cnt=0
    elif tmp==A[1]:
      Bappend(cnt)
      cnt=0
  cnt+=1
  Bappend(cnt)
  print(n-max(1,len(B)-2*k))
  
if __name__=='__main__':
  main()
# Judge status: Wrong Answer
S = input()

if S[-1] == 'e':
    print(S+'s')
else:
    print(S+'es')
# Judge status: Wrong Answer
a = input()
next = (chr(ord(a)+1))

print("'"+a+"'"+"の次は"+"'"+next+"'"+"です")
# Judge status: Accepted
n,x,t = map(int,input().split())
x = n/x
if x%1 == 0:
    print(int(x)*t)
else:
    print((int(x)+1)*t)
# Judge status: Accepted
#142_A
n = int(input())
print(0.5 if n % 2 == 0 else (n + 1) / (2 * n))
# Judge status: Accepted
w,h,n=map(int,input().split())
p,q=[0,w],[0,h]
for _ in range(n):
  x,y,a=map(int,input().split())
  if a==1:
    p[0]=max(p[0],x)
  elif a==2:
    p[1]=min(p[1],x)
  elif a==3:
    q[0]=max(q[0],y)
  else:
    q[1]=min(q[1],y)
s=(p[1]-p[0])*(q[1]-q[0])
print(s if p[0]<=p[1] and q[0]<=q[1] else 0)
# Judge status: Accepted
n=int(input())
l=[int(x) for x in input().split()]
cnt=0
x=0
y=0
b=0
for i in range(n):
    if(i+1!=l[i]):
        cnt+=1
if(cnt>2):
    print("NO")
else:
    print("YES")
# Judge status: Wrong Answer
a = int(input())
b = int(input())

c = a-b

if c == 3:
  print(3)
elif c == 4:
  print(2)
else:
  print(1)
# Judge status: Accepted
n = int(input())
print("YES" if n == 3 or n == 5 or n == 7 else "NO")
# Judge status: Accepted
def main():
  n, *S = map(int, open(0).read().split())
  S.sort()
  ans = sum(S)
  if ans % 10 == 0:
    for s in S:
      if s % 10 != 0:
        return ans - s
    return 0
  else:
    return ans

print(main())
# Judge status: Accepted
s = input()

X = ''

for i in range(len(s)):
    X = X + 'x'

print(X)
# Judge status: Accepted
import itertools

N, M, Q = map(int, input().split())
ABCD = [[int(x) for x in input().split()] for i in range(Q)]

ans=0
t=[m for m in range(1,M+1)]
for A in itertools.combinations_with_replacement(t, N):
  ans2=0
  for (a,b,c,d) in ABCD:
    if A[b-1]-A[a-1]==c:
      ans2+=d
  ans=max(ans, ans2)
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
print((a+b-1)//2+1)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

n = int(input())
a_u = list(map(int, input().split()))
a_d = list(map(int, input().split()))

num = 0

for i in range(n):
    num += a_u[0]
    a_u.pop(0)
    if sum(a_u) <= sum(a_d[:-1]):
        num += sum(a_d[:-1])
        break
    a_d.pop(0)

print(num+a_d[-1])
# Judge status: Wrong Answer
N = int(input())

nums = 1
while(N >= 0):
  if N < 2:
    nums*=1
  else:
    nums*=N
  N-=2
  
counter = 0
div = 10
 
while(True):
  if nums % div != 0:
    break
  counter+=1
  div*=10
  
print(counter)
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())
cnt = 0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      total = 500*i + 100*j + 50*k
      if total == x:
        cnt += 1
print(cnt)
# Judge status: Accepted
hn = list(map(int,input().split()))
h,n = hn
a = list(map(int,input().split()))
h -= sum(a)
if h > 0:
    print ("No")
else:
    print ("Yes")