Problem:


Score : 200 points

Problem Statement

There are some animals in a garden. Each of them is a crane with two legs or a turtle with four legs.

Takahashi says: "there are X animals in total in the garden, and they have Y legs in total." Determine whether there is a combination of numbers of cranes and turtles in which this statement is correct.

Constraints

1 \leq X \leq 100

1 \leq Y \leq 100

All values in input are integers.

Input

Input is given from Standard Input in the following format:

X Y

Output

If there is a combination of numbers of cranes and turtles in which the statement is correct, print Yes; otherwise, print No.

Sample Input 1

3 8

Sample Output 1

Yes

The statement "there are 3 animals in total in the garden, and they have 8 legs in total" is correct if there are two cranes and one turtle. Thus, there is a combination of numbers of cranes and turtles in which the statement is correct.

Sample Input 2

2 100

Sample Output 2

No

There is no combination of numbers of cranes and turtles in which this statement is correct.

Sample Input 3

1 2

Sample Output 3

Yes

We also consider the case in which there are only cranes or only turtles.



Sample input:
3 8


Sample output:
Yes

Submission status: Time Limit Exceeded

Solution code:
x = input().split(' ')

def rcv(len, sum):
  if len == int(x[0]):
    return sum == int(x[1])
  elif sum-3 >= int(x[1]):
    return False
  else:
    return rcv(len+1, sum+2) or rcv(len+1, sum+4)

result=False
if int(x[1])-(int(x[0])*4) <= 0:
  result = rcv(0, 0)

if result:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

Solution code:
make=False
def check_possible(req,num,cur,count):
  if cur<num:
    check_possible(req,num,cur+2,count+1)
    check_possible(req,num,cur+4,count+1)
  if cur==num:
    if count==req:
      global make
      make=True
req,num=list(map(int,input().split()))
check_possible(req,num,0,0)
if make:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

Solution code:
x = input().split(' ')


def rcv(len, sum):
  if len == int(x[0]):
    return sum == int(x[1])
  elif sum-3 >= int(x[1]):
    return False
  else:
    return rcv(len+1, sum+2) or rcv(len+1, sum+4)

result = rcv(0, 0)

if result:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

Solution code:
from itertools import combinations 
x,y = map(int,input().split())
arr = []
c = '4'*x + '2'*x
comb1 = set(combinations([int(i) for i in c],x))
for i in comb1:
    arr.append(sum(i))
if y in set(arr):
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
x, y = map(int, input().split())

count = [2]*x
ans = []

for i in range(2**x):
    for j in range(x):
        if ((i>>j)&1):
            count[j]=4
    if sum(count) == y:
        ans = 'Yes'
        break
    else:
        ans = 'No'

print(ans)

Submission status: Time Limit Exceeded

Solution code:
from itertools import combinations 
x,y = map(int,input().split())
arr = []
c = '4'*x + '2'*x
comb1 = combinations(list(c),x)
for i in set(comb1):
    arr.append(sum(map(int,i)))
if y in set(arr):
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
from itertools import combinations
x,y = map(int,input().split())
arr = []
c = '4'*x + '2'*x
comb1 = combinations(list(c),x)
for i in list(comb1):
    arr.append(sum(map(int,i)))
if y in set(arr):
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
x, y = map(int, input().split())

count = [2]*x
ans = []

for i in range(2**x):
    for j in range(x):
        if ((i>>j)&1):
            count[j]=4
    ans.append(sum(count))

if ans.count(y):
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
x = input().split(' ')


def rcv(len, sum):
  if len == int(x[0]):
    result = sum == int(x[1])
  elif sum > int(x[1]):
    return False
  else:
    result = rcv(len+1, sum+2) or rcv(len+1, sum+4)
  return result


result = rcv(0, 0)
if result:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

Solution code:
x = input().split(' ')


def rcv(len, sum):
  if sum > int(x[1]):
    return False
  elif len == int(x[0]):
    result = sum == int(x[1])
  else:
    result = rcv(len+1, sum+2) or rcv(len+1, sum+4)
  return result


result = rcv(0, 0)
if result:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

Solution code:
from itertools import *
X,Y = map(int,input().split())
tmp = [2 for i in range(100)]+[4 for i in range(100)]
li = combinations(tmp,X)
for i in li:
    if sum(i) == Y:
        print("Yes")
        exit()
print("No")

Submission status: Time Limit Exceeded

Solution code:
x,y = map(int,input().split())

def search(count, sum):
    #print(count, sum)
    if sum > y or count > x:
        return False
    elif sum == y and count == x:
        print("Yes")
        exit()

    if search(count+1, sum +4):
        return True
    if search(count+1, sum +2):
        return True

    return False

search(0, 0)

print("No")

Submission status: Time Limit Exceeded

Solution code:
x = input().split(' ')

def rcv(len, sum):
  if len == int(x[0]):
    result = sum == int(x[1])
  else:
    result = rcv(len+1, sum+2) or rcv(len+1,sum+4)
  return result

result = rcv(0,0) 
if result:
  print('Yes')
else:
  print('No')

Submission status: Time Limit Exceeded

Solution code:
x,y = map(int,input().split())

def search(count, sum):
    #print(count, sum)
    if sum > y or count > x:
        return False
    elif sum == y and count == x:
        print("Yes")
        exit()

    if search(count+1, sum +2):
        return True
    if search(count+1, sum +4):
        return True
    return False
    """
    count += 1
    #鶴
    sum += 2
    search(count, sum)
    #亀
    sum += 4
    search(count, sum)
    """
search(0, 0)

print("No")

Submission status: Time Limit Exceeded

Solution code:
X, Y = map(int, input().split())


def checkY(N, count, X):
    if count == X and N == 0:
        print("Yes")
        exit(0)
    elif count == X and N != 0:
        return False

    if checkY(N - 2, count + 1, X):
        return True

    if checkY(N - 4, count + 1, X):
        return True

    return False


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

Submission status: Time Limit Exceeded

Solution code:
from itertools import *
X,Y = map(int,input().split())
tmp = [2 for i in range(100)]+[4 for i in range(100)]
li = permutations(tmp,X)
for i in li:
    if sum(i) == Y:
        print("Yes")
        exit()
print("No")

Submission status: Time Limit Exceeded

Solution code:
X, Y = input().split()
X = int(X)
Y = int(Y)

if Y % 2 == 1:
    print('No')
elif X * 4 < Y:
    print('No')
else:
    count = 0
    while True:
        Y = Y / 2
        count += 1
        if Y == 1:
            break
    if 2 * X >= count:
        print('Yes')
    else:
        print('No')

Submission status: Time Limit Exceeded

Solution code:
import itertools
import numpy as np

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

if Y % 2 != 0:
  print('No')
elif Y > (X * 4):
  print('No')
elif X > (Y * 2):
  print('No')
else:
  lis=[2, 4] * X
  result = []
  for n in range(1,X + 1):
      for conb in itertools.combinations(lis, n):
          result.append(list(conb)) #タプルをリスト型に変換
  #print(result)
  #print(np.sum(result, axis=0))
  ans = 'No';
  for num in result:
    if sum(num) == Y:
      ans = 'Yes'
      break
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
X, Y = map(int, input().split())


def checkY(N, count, X):
    if count == X and N == 0:
        print("Yes")
        exit(0)
    elif count == X and N != 0:
        return False

    if checkY(N - 2, count + 1, X):
        return True

    if checkY(N - 4, count + 1, X):
        return True

    return False


if checkY(Y, 0, X):
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
from numba import jit


@jit
def solve(X, Y, Z):
    while X >= 0:
        if 2 * X + 4 * Z == Y:
            return True
        elif 2 * X + 4 * Z < Y:
            X -= 1
            Z += 1
    return False


def main():
    X, Y = map(int, input().split())
    Z = 0

    if solve(X, Y, Z):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
X, Y = map(int, input().split())
count = 0
flag = 0


def checkY(N, count, X):
    if count == X and N == 0:
        return True
    elif count == X and N != 0:
        return False

    if checkY(N - 2, count + 1, X):
        return True

    if checkY(N - 4, count + 1, X):
        return True

    return False


if checkY(Y, 0, X):
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
def main():
    X, Y = map(int, input().split())
    Z = 0

    while X >= 0:
        if 2 * X + 4 * Z == Y:
            print("Yes")
            return
        elif 2 * X + 4 * Z < Y:
            X -= 1
            Z += 1
    print("No")


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys
X, Y = map(int, input().split())

if X > 50 or Y%2 == 1 or 2*X>Y or 4*X<Y:
    print('No')
    sys.exit()


for i in range(2 ** X):
    food = 0
    for j in range(X):  
        if ((i >> j) & 1):  
            food +=2
            if food > Y:
                break
        else:
            food+=4
            if food > Y:
                break
    if food == Y:
        print('Yes')
        sys.exit()
print("No")

Submission status: Time Limit Exceeded

Solution code:
X,Y = map(int,input().split())

while True:
    if Y % 2 == 1:
        print('No')
        break
    elif 2*X >= Y:
        print('No')
    elif 4*X >= Y:
        print('Yes')
        break
    
    else:
        print('No')
        break

Submission status: Time Limit Exceeded

Solution code:
import itertools


x, y = map(int, input().split())

if x * 4 < y or y % 2 != 0:
    print('No')
    exit()

l = [2, 4]
for c in itertools.product(l, repeat=x):
    if sum(c) == y:
        print('Yes')
        exit()

print('No')

Submission status: Time Limit Exceeded

Solution code:
import sys
X, Y = map(int, input().split())

if X > 50 or Y%2 == 1 or 2*X>Y or 4*X<Y:
    print('No')
    sys.exit()


for i in range(2 ** X):
    food = 0
    for j in range(X):  
        if ((i >> j) & 1):  
            food +=2
        else:
            food+=4
    if food == Y:
        print('Yes')
        sys.exit()
print("No")

Submission status: Time Limit Exceeded

Solution code:
from itertools import combinations
x,y=map(int,input().split())
z=[4]*x
l=[2]*x
for i in z:
	l.append(i)
c=combinations(l,x)
v=0
for i in c:
	if sum(i)==y:
		print("Yes")
		v=1
		break
if v==0:
	print("No")

Submission status: Time Limit Exceeded

Solution code:
import itertools
import numpy as np


x, y = map(int, input().split())

if x * 4 < y or y % 2 != 0:
    print('No')
    exit()


for c in itertools.product([2, 4], repeat=x):
    tmp = np.sum(c, axis=0)
    if tmp == y:
        print('Yes')
        exit()

print('No')

Submission status: Time Limit Exceeded

Solution code:
import sys
X, Y = map(int, input().split())

if X > 50:
    print('No')
    sys.exit()

for i in range(2 ** X):
    food = 0
    for j in range(X):  
        if ((i >> j) & 1):  
            food +=2
        else:
            food+=4
    if food == Y:
        print('Yes')
        sys.exit()
print("No")

Submission status: Time Limit Exceeded

Solution code:
import numpy as np
from itertools import product

X, Y = map(int, input().split())
flag = 0

for x in product('24', repeat=X):
    a = np.array(list(map(int, x)))
    if a.sum() == Y:
        flag = 1
        break
if flag == 1:
    print('Yes')
else:
    print('No')

Submission status: Time Limit Exceeded

Solution code:
import sys 
from collections import deque
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def LS(): return list(sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def main():
    x,y = IL()
    bit = 2**x
    if 4*x<y:
        print('No')
        exit()
    for i in range(bit):
        tmp = 0
        for j in range(x):
            if (i>>j)&1:
                tmp += 2
            else:
                tmp += 4
            if y<tmp:
                continue
        if tmp == y:
            print('Yes')
            exit()
    print('No')
    return

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys 
from collections import deque
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def LS(): return list(sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def main():
    x,y = IL()
    bit = 2**x
    for i in range(bit):
        tmp = 0
        for j in range(x):
            if (i>>j)&1:
                tmp += 2
            else:
                tmp += 4
            if y<tmp:
                continue
        if tmp == y:
            print('Yes')
            exit()
    print('No')
    return

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
x,y = map(int,input().split())
for i in range(2**x):
    li = []
    cnt = 0
    for j in range(x):
        if ((i>>j) & 1):
            li.append(1)
        else:
            li.append(0)
    for k in range(x):
        if li[k] == 1:
            cnt += 2
        else:
            cnt += 4
    if cnt == y:
        print("Yes")
        exit()
print("No")

Submission status: Time Limit Exceeded

Solution code:
import sys 
from collections import deque
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())
def LS(): return list(sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))

def main():
    x,y = IL()
    bit = 2**x
    for i in range(bit):
        tmp = 0
        for j in range(x):
            if (i>>j)&1:
                tmp += 2
            else:
                tmp += 4
        if tmp == y:
            print('Yes')
            exit()
    print('No')
    return

if __name__=='__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import itertools
x,y = map(int, input().split())
for v in itertools.product([2,4], repeat=x):
    if sum(v) == y:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
print(['No','Yes'][y%2==0 and 2*x <= y <= 4*x])

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
ans = 'No'
for i in range(x + 1):
    j = x - i
    if i * 2 + j * 4 == y:
        ans = 'Yes'
        break

print(ans)

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
bool = False
for i in range(x+1):
    if 2*i + 4*(x - i) == y:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

Solution code:
x,y = map(int,input().split())

for i in range(x+1):
    if 2*i+4*(x-i) == y:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
X, Y = list(map(int, input().split()))

flag = True
for kame in range(X + 1):
    tsuru = X - kame
    if (4 * kame + 2 * tsuru == Y):
        print('Yes')
        flag = False
        break

if(flag):
    print('No')

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import breadth_first_order, depth_first_order, shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

X, Y = na()
ans = 'No'
for turu in range(X+1):
    kame = X - turu
    if turu * 2 + kame * 4 == Y:
        ans = 'Yes'
        break
print(ans)

Submission status: Accepted

Solution code:
x,y = map(int,input().split())

ans = 'No'
for a in range(x+1):
    b = x - a
    if 2 * a + 4 * b == y:
        ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())

flag = False
for i in range(100):
  for j in range(100):
    if i+j == X and 2*i+4*j == Y:
      flag = True

if flag:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
flag=0
for i in range(x+1):
    if i*2+(x-i)*4==y:
        print("Yes")
        flag=1
        break
if flag==0:
    print("No")

Submission status: Accepted

Solution code:

x,y = map(int,input().split())

l = []
flag = False

for i in range(x+1):
    l.append((i,x-i))

for xx,yy in l:
    if y == (xx*2+yy*4):
        flag = True
        break
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
ans=0
for i in range(x+1):
    j=x-i
    if 2*i+4*j==y:
        ans=1
print('Yes'if ans else'No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

for i in range(x+1):
    for j in range(x+1):
        if i+j == x:
            if 2*i + 4*j == y:
                print('Yes')
                exit()
                
print('No')

Submission status: Accepted

Solution code:
import sys
from collections import deque, defaultdict, Counter
from itertools import accumulate, product, permutations, combinations
from operator import itemgetter
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush
from math import ceil, floor, sqrt, gcd, inf
from copy import deepcopy
import numpy as np
import scipy as sp

INF = inf
MOD = 1000000007

x, y = [int(i) for i in input().split()]

tmp = 0
res = "No"

for i in range(x + 1):
    j = x - i
    if 2 * i + 4 * j == y:
        res = "Yes"

print(res)

Submission status: Accepted

Solution code:
x,y=map(int ,input().split())
if x*2<=y<=x*4 and y%2==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
ans = 'No'
if y % 2 == 0 and y >= x*2 and y <= x*4:
    ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
ans = 'No'
for a in range(X + 1):
	b = X - a
	if Y == 2 * a + 4 * b:
		ans = 'Yes'
		break
print(ans)

Submission status: Accepted

Solution code:
X, Y = list(map(int, input().split()))

for x in range(X + 1):
    if x * 2 + (X - x) * 4 == Y:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
K = 0

if Y % 2 == 0:
    K = Y//2 - X
    if K >= 0:
        if X - K >= 0:
            print("Yes")
            exit()

print("No")

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

if y % 2 != 0:
    print('No')
    exit()
if x*2 <= y <= x*4:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

if y % 2 == 0 and x*2 <= y <= x*4:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
for i in range(x+1):
  if 2*i+4*(x-i)==y:
    print('Yes')
    break
else:
  print('No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
for i in range(0,x+1):
    if(2*i+4*(x-i)==y):
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:

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

key1 = Y - 2*X
key2 = 4*X - Y



if key1 % 2 != 0:
    print('No')
elif key2 % 2 != 0:
    print('No')
elif key1 < 0:
    print('No')
elif key2 < 0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
leg  = 0
for i in range(0,a+1):
    if 2*i +4*(a-i) == b:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
for i in range(0,x+1):
  if 2*i+4*(x-i)==y:
    print("Yes")
    break
else:
  print("No")

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
if y%2==0 and 2*x<=y<=4*x:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
numline = input().split(" ")
a=int(numline[0])
b=int(numline[1])

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

Submission status: Accepted

Solution code:
X, Y = map(int,input().split())
# 合計X匹、足Y本

if Y % 2 == 1:
  print('No')
else:
 for num_turu in range(X+1):
   num_kame = X - num_turu
   if Y == 4 * num_kame + 2 * num_turu:
     print('Yes')
     break
 else:
  print('No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
for i in range(1, x+1):
  if (4*i + 2*(x - i) == y) or (2*i + 4*(x - i) == y):
    print("Yes")
    exit()
print("No")

Submission status: Accepted

Solution code:
def main():
  X,Y = map(int,input().split())
  for x in range(101):
    for y in range(101):
      if x+y==X and 2*x+4*y==Y:
        return True
  return False

if __name__ == '__main__':
  print("Yes" if main() else "No")

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
for i in range(x+1):
    if(2*i+4*(x-i) == y):
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
for i in range(Y // 4 + 1):
  if i * 4 + (X - i) * 2 == Y:
    print('Yes')
    break
else:
  print('No')

Submission status: Accepted

Solution code:
X,Y = (int(x) for x in input().split())
a = 4*X-Y
b = Y-2*X
if a>=0 and b>=0 and a%2==0 and b%2==0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
from sys import stdin
readline = stdin.readline
def i_input(): return int(readline().rstrip())
def i_map(): return map(int, readline().rstrip().split())
def i_list(): return list(i_map())


def main():
    X, Y = i_map()
    ans = False
    z = Y - (X * 2)
    if z < 0:
        pass
    elif z == 0 or (z % 2 == 0 and (z // 2) <= X):
        ans = True
    print("Yes" if ans else "No")

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x,y = map(int,input().split())

a = 2*x - y/2
b = -x + y/2

if int(a)+int(b)==x and a>=0 and b>=0 :
    print("Yes")
else :
    print("No")

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
if y%2==0 and 2*x<=y<=4*x:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
X,Y = map(int,input().split())

ans='No'
for i in range(0,X+1):
   #print(i)
   if i * 2 + (X - i) * 4 == Y and X>=i:
       ans = 'Yes'
       break

print(ans)

Submission status: Accepted

Solution code:
X,Y = (int(x) for x in input().split())
Flag = False
for A in range(0,X+1):
    B = X-A
    if 2*A+4*B==Y:
        Flag = True
        break
print(['No','Yes'][Flag])

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
cnt = 0
for b in range(x+1) :
    for t in range(x+1) :
        if x == b+t and y == 2*b+4*t :
            print('Yes')
            exit()
        else :
            continue
print('No')

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
count = 0

r = range(2*X, 4*X+2, 2)

for i in r:

  if i == Y:
    count += 1

print('Yes' if count > 0 else 'No')

Submission status: Accepted

Solution code:
x,y = list(map(int,input().split()))
for crane in range(x+1):
    turtle = x - crane
    if y == crane*2 + turtle*4:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

Solution code:
X,Y = map(int,input().split())
turu = 2
kame = 4
for i in range(X+1):
    ans = turu * i + kame*(X-i)
    if ans == Y:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())

ans = 0

if Y/2 == X: ans = 1

for i in range(X+1):
    j = X - i
    if Y == 2 * i + 4 * j:
        ans = 1

if ans == 1: print('Yes')
else: print('No')

Submission status: Accepted

Solution code:
#B問題

#x匹　y本

x, y = map(int, input().split())
counter = 0
# iは鶴　jは亀
for i in range(0,x+1):
    j = x - i
    if (2*i + 4*j == y):
        counter += 1
        break
if counter >= 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
X,Y = map(int,input().split())
for i in range(X+1):
    a = i*2 + (X-i)*4
    if a == Y:
        print("Yes")
        break
if a != Y:
    print("No")

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
if y%2==0 and 4*x >= y and 2*x<=y:
    print("Yes")
    exit()
print("No")

Submission status: Accepted

Solution code:
[X, Y] = [int(i) for i in input().split()]
if 2*X <= Y and Y <= 4*X and Y % 2 == 0:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
ans = 0
for i in range(x+1):
    if 2 * i + 4*(x-i) == y:
        ans = 1

print('Yes' if ans == 1 else 'No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
flag = True
for animal in range(1, x + 1):
    if y == animal * 4 + (x - animal) * 2 or y == animal * 2 + (x - animal) * 4:
        print ("Yes")
        flag = False
        break
if flag:
    print("No")

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())

ans = 'No'

for i in range(0, X + 1):
    if i * 2 + (X - i) * 4 == Y:
        ans = 'Yes'
        break

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
import math
 
def INT(): return int(input())
def MAPINT(): return map(int, input().split())
def LMAPINT(): return list(map(int, input().split()))
def STR(): return input()
def MAPSTR(): return map(str, input().split())
def LMAPSTR(): return list(map(str, input().split()))
 
f_inf = float('inf')
 
x, y = LMAPINT()
for i in range(x+1):
  for j in range(x+1):
    if i + j == x and i*2 + j*4 == y:
      print('Yes')
      exit()
print('No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
msg = 'No'
for a in range(1, x+1):
    if 2*a + 4*(x-a) == y or 4*a + 2*(x-a) == y:
        msg = 'Yes'
print(msg)

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
n="No"
for i in range(51):
    for j in range(26):
        if 2*i+4*j==y:
            if i+j==x:
                n="Yes"
print(n)

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
n="No"
for i in range(51):
    for j in range(26):
        if 2*i+4*j==y:
            if i+j==x and i+j!=0:
                n="Yes"
print(n)

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())
for i in range(100):
    for j in range(100):
        if i+j==X and 2*i+4*j==Y:
            print("Yes")
            break
    else:
        continue
    break
else:
    print("No")

Submission status: Accepted

Solution code:
x,y = map(int,input().split())

if x*2 <= y <= x*4 and y%2 == 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
for i in range(x + 1):
    if 2 * (x - i) + 4 * i == y:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())

for i in range(X+1):
    if i*2+(X-i)*4==Y:
        print("Yes")
        break
    elif i==X:print("No")

Submission status: Accepted

Solution code:
animals_and_legs=input()
list=animals_and_legs.split()
animals=int(list[0])
legs=int(list[1])
j=animals
i=0
something=True
while i<=animals:
    if i*4+j*2==legs:
        print("Yes")
        something=False
        break
    i=i+1
    j=j-1
if something is True:
    print("No")

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
ans = 'No'
for i in range(X+1):
    if i*2+(X-i)*4 == Y:
        ans = 'Yes'
        break

print(ans)

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())

for cnt in range(X+1):
  if 2*cnt + 4*(X-cnt) == Y:
    print('Yes')
    break
else:
  print('No')

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
ans = 'No'
for crane in range(x + 1):
    turtle = x - crane
    if 2 * crane + 4 * turtle == y:
        ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
s,t = map(int,input().split())
print('Yes' if s*2 <= t <= s*4 and t%2 == 0 else 'No')

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())

flag1 = (Y - 2 * X >= 0) and ((Y - 2 * X) % 2 == 0)
flag2 = (4 * X - Y >= 0) and ((4 * X - Y) % 2 == 0)

print("Yes" if flag1 and flag2 else "No")

Submission status: Accepted

Solution code:
X, Y =map(int,input().split())
a = 0
for i in range(X+1):
  if 2*i+4*(X-i)==Y:
    print('Yes')
  else:
    a +=1
  
    
if a ==X+1:
  print('No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())

if y % 2 == 0 and 2 * x <= y <= 4 * x:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
def main():
    x, y = map(int, input().split())

    for i in range(x+1):
        if i*4 + (x - i)*2 == y:
            print('Yes')
            return

    print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    X,Y=MI()
    if(Y-2*X>=0 and (Y-2*X)%2==0 and (Y-2*X)/2<=X):
        print("Yes")
    else:
        print("No")
if __name__ == '__main__':
    main()