peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
flag = False
for a in range(n//4 + 4):
    for b in range(n//7 + 7):
        if a*4 + b*7 == n:
            flag = True
            break
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n, legs= map(int, input().split(" "))

x = (legs - 2*n)/2
y = (4*n - legs)/2

if x%1==0 and y%1==0 and x>0 and y>0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N, K = [int(x) for x in input().split()]

result = {}
for _ in range(N):
    a, b = [int(x) for x in input().split()]
    if a in result:
        result[a] += b
    else:
        result[a] = b

result = sorted(result.items())

now = 0
for key, value in result:
    now += value

    if now >= K:
        print(key)
        exit()
# Judge status: Wrong Answer
import collections
que_a = collections.deque(input())
que_b = collections.deque(input())
que_c = collections.deque(input())

card = "a"

while que_a and que_b and que_c:
    if card == "a":
        card = que_a.popleft()
        
    if card == "b":
        card = que_b.popleft()
        
    if card == "c":
        card = que_c.popleft()
        
    ans = card
        
print(ans.upper())
# Judge status: Wrong Answer
N = int(input())
S = input()
print(len(S))
new_S = ''
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

for s in range (len(S)):
    for i in range(26):
        if (S[s] == alphabet[i]):
            new_S += alphabet[i+N]
            break
print(new_S)
# Judge status: Accepted
X=int(input())


a=X//500
b=(X%500)//5
print(1000*a+5*b)
# Judge status: Wrong Answer
s =input()
t = input()
s = sorted(s, key=str.lower)
t = sorted(s, key=str.lower, reverse=True)
s = ''.join(s)
t = ''.join(t)
l = [s,t]
l.sort()
print(l)
if l[0] == s and s != t:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
ans = 0
for i in range(1,N+1):
    if i > K:
        ans += Y
    else:
        ans += X
print(ans)
# Judge status: Accepted
n,q=map(int,input().split())
s=input()
t=[0]*(n+1)
for i in range(n):
  t[i+1] = t[i] + (1 if s[i:i+2]=='AC' else 0)
for _ in range(q):
  l,r=map(int,input().split())
  print(t[r-1]-t[l-1])
# Judge status: Accepted

N, M = map(int, input().split())
graph = [0]*N
for _ in range(M):
  a, b = map(lambda x:int(x)-1, input().split())
  graph[a] += 1
  graph[b] += 1
for i in range(N):
  print(graph[i])
# Judge status: Accepted
n,m = map(int,input().split())
ab = [[] for _ in range(10**5)]
for i in range(n):
	a,b = map(int,input().split())
	a -= 1
	ab[a].append(b)

import heapq

q = []
heapq.heapify(q)

ans = 0
for i in range(m):
	if len(ab[i]) != 0:
		for j in range(len(ab[i])):
			heapq.heappush(q,-1*ab[i][j])
	if len(q) != 0:
		ans += -1 * heapq.heappop(q)

print(ans)
# Judge status: Wrong Answer
N,M=map(int,input().split())
sa=set()
sb=set()
for i in range(M):
    a,b=map(int,input().split())
    if a==1:sb.add(b)
    if b==N:sa.add(a)
print("IMPOSSIBLE" if len(sa&sa)==0 else "POSSIBLE")
# Judge status: Accepted
a = int(input())
l = list(map(int, input().split()))
length = len(l)
l = sorted(l)
 
if length%2==1:
	print(0)
else:
	print(l[a//2]-l[a//2-1])
# Judge status: Accepted
from collections import Counter
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
c = Counter(readline().decode().rstrip())
for i in range(1, n):
    c2 = Counter(readline().decode().rstrip())
    for k, v in c.items():
        c[k] = min(c[k], c2[k])
l = sorted(c.items())
ans = ''
for k, v in l:
    ans += k * v
print(ans)
# Judge status: Wrong Answer
import math


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


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

if a > b:
    print(0)
    exit()
if a == b:
    print(1)
    exit()

sum = 0
for i in range(b//a):
    sum += 1
print(sum+1)
# Judge status: Accepted
N,K=map(int,input().split())
l=list()
for i in range(N):
  l.append(int(input()))
l.sort()
ans=int(l[K-1])-int(l[0])
for i in range(1,N-K+1):
  key=int(l[i+K-1])-int(l[i])
  if ans>key:
    ans=key
print(ans)
# Judge status: Wrong Answer
import collections
def solve(n, a_list):

    count = collections.Counter()
    for i in a_list:
        count[i // 400] += 1

    max_value = len([i for i in count.keys() if i != 8]) + count[8]
    min_value =  1 if max_value - count[8] == 0 else max_value - count[8]
    return "{0} {1}".format(min_value, max_value)

if __name__ == "__main__":
    n = int(input())
    a_list = [int(i) for i in input().split()]
    print(solve(n, a_list))
# Judge status: Accepted
arb='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N = int(input())
S = input()
ans =''
for i in range(len(S)):
    if arb.index(S[i]) + N +1 <= len(arb):
        ans += arb[arb.index(S[i])+N]
    else:
        ans += arb[-len(arb) + arb.index(S[i]) + N]
print(ans)
# Judge status: Wrong Answer
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


n = int(input())
li = list(map(int, input().split()))
li.sort()
r = 10000000000
for i in range(n - 2):
    if r > gcd(li[i], li[i + 1]):
        r = gcd(li[i], li[i + 1])
print(r)
# Judge status: Accepted
abcd = list(input())
a, b, c, d = (int(abcd[i]) for i in range(4))

dict = {1: "+", -1: "-"}

for k in [1, -1]:
    for l in [1, -1]:
        for m in [1, -1]:
            if a + (k * b) + (l * c) + (m * d) == 7:
                print("{}{}{}{}{}{}{}=7".format(a, dict[k], b, dict[l], c, dict[m], d))
                exit()
# Judge status: Accepted
n,d = map(int,input().split())
l = []
for i in range(n):
    l.append([int(x) for x in input().split()])

import math
def calc(x1,x2):
    
    l1 = l[x1]
    l2 = l[x2]
    s = 0
    for i in range(d):
        s += (l1[i]-l2[i])**2
    s = math.sqrt(s)
    if(s.is_integer()):
        return 1
    return 0


ans = 0
for i in range(n):
    for j in range(i,n):
        if(i==j):
            continue
        ans += calc(i,j)
print(ans)
# Judge status: Wrong Answer
D,N = map(int,input().split())
if D == 0:
  print(N)
else:
  print(100**D*N)
# Judge status: Accepted
def main():
  p=10**9+7
  def modpfac(n):
    ret=1
    for i in range(1,n+1):
      ret=ret*i % p
    return ret
  n,m=map(int,input().split())
  if abs(m-n)>1:
    return print(0)
  elif abs(m-n)==1:
    return print(modpfac(n)*modpfac(m)%p)
  else:
    return print(2*modpfac(n)*modpfac(m)%p)
 
main()
# Judge status: Accepted
N=int(input())
ans=100000000000
for A in range(1,N):
    B=N-A
    sa=0
    sb=0
    for i in range(len(str(A))):
        sa+=A%10
        A=(A-A%10)//10
    for j in range(len(str(B))):
        sb+=B%10
        B=(B-B%10)//10
    if sa+sb<ans:
        ans=sa+sb

print(ans)
# Judge status: Accepted
N,M=map(int,input().split())
if N>=2 and M>=2:
  print((N-2)*(M-2))
elif N==1 and M==1:
  print(1)
else:
  print(max(N,M)-2)
# Judge status: Accepted
n = int(input())
results = [list(map(int, input().split())) for _ in range(n)]
ans = 0

for i in range(n):
    if ans >= 3:
        break
    if results[i][0] == results[i][1]:
        ans += 1
    else:
        ans = 0
if ans >= 3:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,a,b = map(int, input().split())

if abs(a-b)%2 == 0: print((b-a)//2)
else: print(min(a-1, n-b) + 1 + (b-a-1)//2)
# Judge status: Accepted
a,b,c=map(int,input().split())
if c-a-b<0:
    print("No")
else:
    
    if (c-a-b)**2>4*a*b:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
n,k=map(int,input().split());print(n%k)
# Judge status: Accepted
N = int(input())

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

if N % 2 == 0:
    Amed = A[N//2-1]+A[N//2]
    Bmed = B[N//2-1]+B[N//2]
    print(Bmed-Amed+1)
else:
    Amed = A[N//2]
    Bmed = B[N//2]
    print(Bmed-Amed+1)
# Judge status: Accepted
n = int(input())
if n % 2 == 1:
    print(0)
else:
    p = 1
    t = 5
    n //= 2
    while t <= n:
        p += 1
        t *= 5
    s = 0
    
    for i in range(1,p):
        s += n // (5 ** i)
    print(s)
# Judge status: Accepted
N,A,B = map(int,input().split())
s = input()
a = 0
b = 0
for i in s:
  if i == 'a' and a+b < A+B:
    print('Yes')
    a += 1
  elif i == 'b' and a+b < A+B and b  < B:
    print('Yes')
    b += 1
  else:
    print('No')
# Judge status: Accepted
patterns = [[5, "dream"], [7, "dreamer"], [5, "erase"], [6, "eraser"]]

s = input()

idx = len(s)
while idx > 0:
    for sub, pat in patterns:
        n_idx = idx - sub
        if pat == s[n_idx:idx]:
            idx = n_idx
            break
        else:
            continue
    if idx != n_idx:
        break

print("YES" if idx == 0 else "NO")
# Judge status: Wrong Answer
N, Y = map(int, input().split())
res = False
for i in range(N + 1):
    for q in range(N + 1):
        c = N - i - q
        total = 10000*i + 5000*q + 1000*c
        if total == Y:
            res = True
            a = i
            b = q
            d = c
if res:
    print('{} {} {}'.format(a, b, d))
else:
    print('-1 -1 -1')
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    n = sum(B) - sum(A)
    if n < 0:
        print("No")
        exit()

    n_need = 0
    for a, b in zip(A, B):
        if a > b:
            n_need += (a - b)
        elif a < b:
            n_need += (b - a) % 2

    ans = "Yes" if n_need <= n else "No"
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
def main():
  x = int(input())
  sosu = []
  tgt = 2
  is_sosu = True
  while(1):
    for i in sosu:
      if tgt % i == 0:
        is_sosu = False
        break
    if is_sosu:
      sosu.append(tgt)
    if tgt >= x and is_sosu:
      print(tgt)
      break
    else:
      tgt += 1
      is_sosu = True

if __name__ == "__main__":
  main()
# Judge status: Accepted
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
even, odd = map(int, input().split())

even_r = 0
odd_r = 0

for i in range(even):
  for j in range(even - i - 1):
    even_r += 1
  
for i in range(odd):
  for j in range(odd - i - 1):
  	odd_r += 1

total = even_r + odd_r

print(total)
# Judge status: Accepted
n = str(input())
if n[0]=='9' or n[1]=='9':
  print("Yes")
else:
  print("No")
# Judge status: Accepted
k = int(input())
nums = []

def rec(d, val, nums):
    nums.append(val)
    if d == 10:
        return
    for i in range(-1, 2):
        add = val%10 + i
        if (0<= add <= 9):
            rec(d+1, val*10+add, nums)
for j in range(1,10):
    rec(1,j,nums)

nums.sort()
print(nums[k-1])
# Judge status: Accepted
a,b = map(int,input().split())
print(sum(range(b-a+1))-b)
# Judge status: Wrong Answer
n = int(input())
h_list = list(map(int, input().split()))

ans, cnt = 0, 0
tmp = 0
for h in h_list:
    if h > tmp:
        ans = max(cnt, ans)
        cnt = 0
    else: cnt += 1
print(max(cnt, ans))
# Judge status: Accepted
import bisect
N,M,K = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
A = [0]*(N+1)
B = [0]*(M+1)
for i in range(N):
    A[i+1] = A[i] + a[i] 
for i in range(M):
    B[i+1] = B[i] + b[i] 

possible = [0]
for i in range(N+1):
    ans = i
    nokori = K - A[i]
    if nokori < 0:
        break
    else:
        j = bisect.bisect_right(B,nokori)
        ans += j-1
        possible.append(ans)

print(max(possible))
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))
ans = 'Yes'
A.sort(reverse=True)
for i in range(M):
    if A[i] < sum(A)/(4*M):
        ans = 'No'
        break
print(ans)
# Judge status: Wrong Answer
def resolve():
    '''
    code here
    '''
    A, B, C, K = [int(item) for item in input().split()]

    if K > 0:
        if K % 2 == 0:
            res = B - A
        else:
            res = A -B
    else:
        res = A -B

    print(A-B)
if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
from sys import stdin
def main():
  readline = stdin.readline
  N = int(readline())
  L = [list(map(int, readline().split())) for _ in range(N)]
  cnt = 0
  for l in L[::-1]:
    a = l[0] + cnt
    b = l[1]
    if a <= b:
      cnt += b - a
    else:
      cnt += (b - a % b) % b
  print(cnt)
if __name__ == "__main__":
  main()
# Judge status: Wrong Answer
s=input()
a=0
b=0
c=0
for i in range(1,4):
  if ord(s[0])==ord(s[i]):
    a=i
    b+=1
if b==1:
  if a==1:
    if ord(s[2])==ord(s[3]):
      print('Yes')
  elif a==2:
    if ord(s[1])==ord(s[3]):
      print('Yes')
  elif a==3:
    if ord(s[1])==ord(s[2]):
      print('Yes')
  else:
    print('No')
else:
    print('No')
# Judge status: Accepted
A,B,C = map(int, input().split())
result = 0

if A % 2 == 1 or B % 2 == 1 or C % 2 == 1:
  result = 0
elif A == B == C:
  result = -1
else:
  while A % 2 == 0 and B % 2 == 0 and C % 2 == 0:
    result += 1
    a = A/2
    b = B/2
    c = C/2
    A = b + c
    B = a + c
    C = b + a
   
print(result)
# Judge status: Wrong Answer
import math
s=input()
n=len(s)
count=0
a=[0 for i in range(2019)]
a[0]=1
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if n<4:
    print(0)
else:
    for i in range(0,n):
        a[int(s[i:])%2019]+=1
    for i in range(2019):
        if a[i]>=2:
            count+=comb(a[i],2)
print(count)
# Judge status: Accepted
x,y=map(int,input().split())
ans=abs(abs(x)-abs(y))
 
if (x<0 and y<0) or (x>0 and y>0):
    if x>y :
        ans+=2
elif x!=0 and y!=0:
    ans+=1
else:
    if y<=0 and x>y:
        ans+=1
 
print(ans)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
d =[]
if a != b != c:
    print(3)
elif a == b == c:
    print(1)
else:
    print(2)
# Judge status: Accepted
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N = input_number()
    for i in range(50000):
        t = i * 1.08 // 1
        if t == N:
            print(i)
            break
    else:
        print(':(')

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
c = 0
s = str(input())
t = str(input())

d = {}
if s==t:
	print(0)
elif sorted(s) == sorted(t):
	print(len(s))
else:
	for i in s:
		if i not in d:
			d[i] = 1
		else:
			d[i] +=1

	for i in d:
		if i in t:
			d[i]-=1
		else:
			c+=d[i]
	print(c)
# Judge status: Accepted
n,m=map(int,input().split())
x=list(map(int,input().split()))
x=sorted(x)
a=[]
ans=0
if m==1:
    print(0)
else:
    for i in range(m-1):
        a.append(x[i+1]-x[i])
    a=sorted(a)
    for i in range(m-n):
        ans+=a[i]
    print(ans)
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))

flag = True
for i in l:
  if (i%3 != 0 and i%2 == 0) and (i%5 != 0 and i%2 == 0):
    flag = False
    break
    
if flag:
  print("APPROVED")
  
else:
  print("DENIED")
# Judge status: Accepted
import sys
input = sys.stdin.readline
S = list(input())[: -1]
K = int(input())
a = ord("a")
N = len(S)
for i in range(N):
  x = ord(S[i])
  if K >= (a - x) % 26:
    K -= (a - x) % 26
    S[i] = "a"
S[-1] = chr((ord(S[i]) - a + K % 26) % 26 + a)
print("".join(S))
# Judge status: Accepted
def readinput():
    a,b,k=list(map(int,input().split()))
    return a,b,k

def main(a,b,k):
    ans=0
    count=0
    for i in range(min(a,b),0,-1):
        if a%i==0 and b%i==0:
            count+=1
            if count==k:
                return i


if __name__=='__main__':
    a,b,k=readinput()
    ans=main(a,b,k)
    print(ans)
# Judge status: Accepted
k, x = map(int, input().split())
k -= 1
for i in range(x-k, x+k+1):
    print(i,end = " ")
# Judge status: Accepted
def main():
  S = input()
  week = {'SUN':7, 'MON':6, 'TUE':5, 'WED':4, 'THU':3, 'FRI':2, 'SAT':1}
  
  print(week[S])
  
  
  
main()
# Judge status: Accepted
a,b,c,d=map(int, input().split())
count = 0
ablist = []
cdlist = []
for i in range(a, b+1):
    ablist.append(i)
for i in range(c, d+1):
    cdlist.append(i)
# print(ablist)
# print(cdlist)
for i in ablist:
    # print(i)
    if i in cdlist:
        count += 1

if count == 0:
    print(0)
else:
    print(count-1)
# Judge status: Accepted
#C
#入力
N,K,Q=map(int,input().split())
A=[int(input())-1 for i in range(Q)]

#処理
B=[0 for i in range(N)]

for i in A:
    B[i]+=1

for i in B:
    if Q-i<K:
        print("Yes")
    else:
        print("No")
# Judge status: Wrong Answer
a=int(input())
b=int(input())
s=[1,2,3]
s.remove(a)
s.remove(b)
print(s)
# Judge status: Wrong Answer
import numpy as np
N=int(input())
A=list(map(int,input().split()))

mod=10**9+7

B=np.zeros(N+1)
for i in range(1,N+1):
    B[i]=A[i-1]+B[i-1]

ans=0
for i in range(N-1):
    ans+=A[i]*(B[N]-B[i+1])
    ans%=mod

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

amari = 0
made = 0
cnt = 0
for i in range(1, n+1):
    cnt += i
    if cnt >= n:
        made = i
        amari = cnt - n
        break

ans = []
for i in range(1, made+1):
    if i == amari:
        continue
    ans.append(str(i))
print("\n".join(ans))
# Judge status: Accepted
s=list(input())
print("yes" if len(s)==len(set(s)) else "no")
# Judge status: Wrong Answer
n=int(input())
x=[10000]*(n+1)
x[0]=1
a=[6**i for i in range(1,7)]
b=[9**i for i in range(1,6)]
c=[1]
c=a+b+c
c.sort()
for i in range(1,n+1):
    for j in c:
        if i-j>=0:
            x[i]=min(x[i],x[i-j]+1)
        else:
            break
print(x[n-1])
# Judge status: Wrong Answer
a,b=map(int,input().split())
if 1<= a and b <= 9:
    print(a*b)
else:
    print(-1)
# Judge status: Accepted
N, M = map(int, input().split())

for m in range(M):
    L, R = map(int, input().split())
    if m==0:
        l = L
        r = R
    else:
        if l<L:
            l = L
        if R<r:
            r = R

print(len(list(range(l,r+1))))
# Judge status: Accepted
n=int(input())
d=[(0,0,0)]
for i in range(n):
    a,b,c=map(int,input().split())
    d.append((a,b,c))

dp=[[0,0,0] for _ in range(n+1)]

for i in range(1,n+1):
    a,b,c=d[i]
    dp_a,dp_b,dp_c=dp[i-1]
    dp[i]=[max(dp_b+a,dp_c+a),max(dp_c+b,dp_a+b),max(dp_a+c,dp_b+c)]

dp_a,dp_b,dp_c=dp[n]
print(max(dp_a,dp_b,dp_c))
# Judge status: Wrong Answer
import collections

N = int(input())
S = input()

m = 0
index = 0
for i in range(1, int(N*0.5)+1):
    a = set(S[:i])
    b = set(S[i:])
    #print(a)
    #print(b)
    d = 0
    for c in a:
        if c in b:
            d += 1
    if d > m:
        m = d
        index = i
print(index - 1)
# Judge status: Accepted
s=int(input())

bun=[]
bun.append([0,0]+[1]*(s-2))
for j in range(1,s//3):
    bun.append([0]*(3*(j+1)-1)+[1])
    for i in range(3*(j+1),s):
        bun[j].append((bun[j][i-1]+bun[j-1][i-3])%(10**9+7))

ans=0
for i in range(s//3):
    ans = (ans+bun[i][s-1])%(10**9+7)

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

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

d=1
flag=False

cnt=0

for i in range(n):
  if a[i]==d:
    flag=True
    cnt+=1
    d+=1

if not flag:
  print("-1")
else:
  print(n-cnt)
# Judge status: Wrong Answer
N, M = map(int, input().split())
a_n = list(map(int, input().split()))
a_n = [int(a_n[i]*1/2) for i in range(len(a_n))]
 
def lcm(lis):
    from fractions import gcd
    x = lis[0]
    for i in range(1, len(lis)):
        x = (x * lis[i]) // gcd(x, lis[i])
    return x
res = lcm(a_n)
 
count = 0
for i in range(M):
  count += 1
  if res * (2 * i + 1) > M:
    break
print(count)
# Judge status: Accepted
N=int(input())
*A,=map(int,input().split())
T=[0]*N
for i in range(N):
 T[~-A[i]]=i+1
print(*T)
# Judge status: Accepted
N = int(input())

robo = []
for _ in range(N):
    X, L = map(int, input().split())
    robo.append([X-L, X+L])

robo = sorted(robo, key=lambda x:x[1])

last = robo[0][1]
cnt = 1
for r in robo[1:]:
    if r[0] >= last:
        cnt += 1
        last = r[1]

print(cnt)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
A += [0]

money = 1000
k = 0
for i in range(N):
    if A[i] <= A[i+1]:
        tmp = money // A[i]
        money -= tmp * A[i]
        k += tmp
    else:
        money += k * A[i]
        k = 0

print(money)
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
ans = 0
if A == B == C or A%2 != 0 or B%2 != 0 or C%2 != 0:
  ans = -1
else:
  while A%2 == 0 and B%2 == 0 and C%2 == 0:
    A,B,C = B/2+C/2,A/2+C/2,B/2+C/2
    ans += 1
print(ans)
# Judge status: Accepted
X = [int(e) for e in input().split()]
ans = 0
for i in range(0,X[0]+1):
    for k in range(0,X[0]+1):
        if(X[1] - (i+k))<=X[0] and X[1] - i - k >= 0:
            ans += 1
print(ans)
# Judge status: Wrong Answer
# AtCoder
A, B = map(int, input().split())
if A % 3 == 0 or B % 3 == 0 or A*B % 3 == 0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
import collections
n=int(input())
a=list(map(int,input().split()))
c=collections.Counter(a)
ans=0
for i in c:
  if i < c[i]:
    ans+=c[i]-i
  elif i > c[i]:
    ans+=c[i]
print(ans)
# Judge status: Accepted
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
b = inpl()
res = 0
for i in range(n):
    if a[i] > b[i]:
        res += b[i] - a[i]
    elif b[i] - a[i]:
        res += (b[i] - a[i])//2
print('Yes' if res >= 0 else 'No')
# Judge status: Accepted
a, b, c = map(int, input().split())
d = c-a+b
if d <= 0:
  print(0)
else:
  print(d)
# Judge status: Wrong Answer
X, N = map(int, input().split())
if N:
  P = list(map(int, input().split()))
  distance = 10000
  ans = 0
  for cadi in range(100, 0, -1):
    if not cadi in P :
      if distance >= ( cadi - X ) * ( cadi - X ):
        distance = ( cadi - X ) * ( cadi - X )
        ans = cadi
  print(ans)
else:
  print(X)
# Judge status: Wrong Answer
N = int(input())
S = input()
w, e = S.count('W'),S.count('E')
change = []
half = int(N / 2)
if w >= e:
  for n in range(half + 1):
    _ = S[0:n].count('W') + S[n + 1:].count('E')
    change.append(_)
else:
  for n in range(half,N):
    _ = S[0:n].count('W') + S[n + 1:].count('E')
    change.append(_)
print(min(change))
# Judge status: Wrong Answer
from collections import Counter

# input
N = int(input())
S = {}
for n in range(N):
    s = input()
    counter = Counter(s)
    S[n] = counter

matched = []
cnt = 0
m_append = matched.append
for k in S.keys():
    if S[k] in matched:
        continue
    add = len(
        [
            1
            for i in S.keys()
            if k != i
            and S[k] == S[i]
        ]
    )
    if add > 0:
        m_append(S[k])
    cnt += add

print(cnt)
# Judge status: Wrong Answer
from collections import defaultdict

data = defaultdict()
for i in range(3):
    s = input()
    data[chr(ord("a") + i)] = s

cnt = [0] * 3
turn = "a"
while 1:
    turn = data[chr(ord(turn))][cnt[ord(turn) - ord("a")]]
    cnt[ord(turn) - ord("a")] += 1
    if cnt[ord(turn) - ord("a")] == len(data[chr(ord(turn))]):
        ans = ord(turn) - (ord("a") - ord("A"))
        break

print(chr(ans))
# Judge status: Wrong Answer
from itertools import accumulate
N = int(input())
S = input()
SS = [1 if S[i]=='(' else -1 for i in range(N)]
SSS = list(accumulate(SS))
m = -min(SSS)
print('('*m+S+')'*(SSS[-1]+m))
# Judge status: Accepted
if __name__ == '__main__':
    l_c = int(input())
    trips = []
    for i in range(l_c):
        trips.append([int(v) for v in input().split(' ')])
    pos = [0, 0, 0]
    for t in trips:
        time = t[0] - pos[0]
        dist = abs(pos[1] - t[1]) + abs(pos[2] - t[2])
        e_or_o = [time % 2, dist % 2]
        if time < dist or e_or_o[0] != e_or_o[1]:
            print('No')
            exit(0)
        pos = t
    print('Yes')
# Judge status: Wrong Answer
from math import log

x, y = map(int, input().split())
print(1 + int(log(y / x, 2)))
# Judge status: Wrong Answer
N = int(input())
Xl = list(map(int, input().split()))
Xl.sort()
minx = Xl[0]
maxx = Xl[-1]
minsum = 1000000
for i in range(minx, maxx):
    sumd = 0
    for x in Xl:
        sumd += (x - i)**2
    if sumd < minsum:
        minsum = sumd
print(minsum)