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: Accepted

Solution code:
x, y = map(int, input().split())
a=y-2*x

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

Submission status: Accepted

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

Submission status: Accepted

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

crain = int((4 * x - y) / 2)
turtle = int((y - 2 * x) / 2)

if crain >= 0 and turtle >= 0:
    if x == crain + turtle:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

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

if 2*X > Y or 4*X < Y or Y%2 != 0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

x, y = map(int, input().split())
crane_foot = 2
turtle_foot = 4
for i in range(0, x+1):
    j = abs(x - i)
    if crane_foot * i + turtle_foot * j == y:
        print('Yes')
        sys.exit()
print('No')

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
c=y/2-x
d=2*x-y/2
if c>=0 and d>=0 and y%2==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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



D =[]

for A in range(X+1):
    if 2*A + (4 *(X-A)) == Y:
        D.append(A)
        
if len(D)>= 1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

x, y=int(x), int(y)

out=[]

if x==1:
    if y in [2, 4]:
        print("Yes")
    else:
        print("No")
else:
    for i in range(x+1):
        j=x-i
        if 2*i+4*j==y:
            out.append("succeeded")
            break
        else:
            continue

    if "succeeded" in out:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
X,Y = list(map(int,input().split()))
x = 2*X-Y/2
y = Y/2 - X
if x >= 0 and y >= 0 and (Y%2 == 0):
  print("Yes")
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

if Y % 2 == 1:
  print("No")
  
elif X*2>Y:
  print("No")
  
elif X*4<Y:
  print("No")
  
else:
  print("Yes")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# 整数の入力
num, x = map(int, input().split())
# loop
flag = 0
for i in range(num + 1):
  if((2*i + 4*(num - i)) == x): flag += 1
print("No") if flag == 0 else print("Yes")

Submission status: Accepted

Solution code:

if __name__ == "__main__":
  x, y = [int(a) for a in input().split()]
  t = 2
  k = 4
  cnt = 0
  ans = "No"
  for i in range(x+1):
    cnt += i * t
    cnt += (x - i) * k
    if cnt == y:
      ans = "Yes"
      break
    cnt = 0
  print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
"""AtCoder Beginner Contest 170: B - Crane and Turtle
https://atcoder.jp/contests/abc170/tasks/abc170_b
"""


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

    b = (Y - (2*X)) / 2
    a = X - b
    # print('a:{}, b:{}'.format(a, b))

    if int(b) != b:
        print('No')
    elif a < 0 or b < 0:
        print('No')
    elif a == 0 and b == 0:
        print('No')
    else:
        print('Yes')


if __name__ == '__main__':
    main()

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")
        exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num_input=input().split()   
x=int(num_input[0])
y=int(num_input[1])
ans="No"
n=-1
for i in range(x+1):
    n=n+1
    ans_num=n*2+(x-n)*4
    if ans_num==y:
        ans="Yes"
print(ans)

Submission status: Accepted

Solution code:
import sys

X,Y=(int(x) for x in input().split())
#print(X,Y)
if Y%2==1:
  print('No')
  sys.exit()
if Y<2*X:
  print('No')
  sys.exit()
  

check=int((Y-2*X)/2)
#print(check)
if check<=X:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

a = x
b = 0
ans = 'No'
if y%2 != 0:
    pass
else:
    while a >= 0:
        c = a*2 + b*4
        if c == y:
            ans = 'Yes'
        a -= 1
        b += 1
print(ans)

Submission status: Accepted

Solution code:
str1 = input()

A = str1.split(" ")

# 存在する動物が全員4本足ならば
all4 = int(A[0])*4
res = "No"

for i in range(0, int(A[0])+1):
    if all4 == int(A[1]):
        res = "Yes"
        break
    else:
        all4 = all4 - 2
        
print(res)

Submission status: Accepted

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

x = 0
T = 4 * X - Y
while True:
    if T == 2 * x and X - x >= 0:
        print('Yes')
        exit()
    if T < 2 * x:
        print('No')
        exit()
    x += 1

Submission status: Accepted

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

low = X * 2
high = X * 4

if  Y % 2 != 0:
    print('No')
    sys.exit()

if Y >= low and Y <= high:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

if y%2==0:
    a=2*x-(y/2)
    if a>=0  and x-a>=0:
        print('Yes')
    else:
        print('No')

else:
    print('No')

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
count = a[0] + 1
flag = ""

for i in range(count):
  if a[1] == 2*i + 4*(a[0]-i):
    flag = "OK"

print("Yes" if flag == "OK" else "No")

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')
            exit()
    
print('No')

Submission status: Accepted

Solution code:
num_ani, num_legs = [int(i) for i in input().split(" ")]

if num_legs % 2 == 0 and num_legs >= 2*num_ani and num_legs <= 4*num_ani:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
x, y = list(map(int, 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())
a = (4 * x - y) / 2
b = (y - 2 * x) / 2
if ((a >= 0) & (b >= 0) & (a.is_integer() == True) & (b.is_integer() == True)):
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

    turu = 2
    kame = 4

    k_num = int(Y / kame)

    while True:
        t_num = X - k_num

        asi = kame * k_num + turu * t_num

        if t_num >= 0 and k_num >= 0:       
            if asi > Y:
                k_num -= 1
            elif asi == Y:
                return 'Yes'
            elif asi < Y:
                return 'No'
        else:
            return 'No'

print(Crane_and_Turtle())

Submission status: Accepted

Solution code:
def main():
    x, y = [int(v) for v in input().split(' ')]
    if y % 2 == 0 and y >= 2 * x and y <= 4 * x:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

a = 4*x -y
b = y - 2*x
if a < 0 or b < 0 or y%2 == 1:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
import sys
import itertools

input = sys.stdin.readline
x, y = map(int, input().split())
p = [2, 4]
for i in itertools.combinations_with_replacement(p, x):
    if sum(i) == y:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

r = -1 ;
for a in range ( 0, X + 1 ) :
	b = X -a ;
	if a * 2 + b * 4 == Y :
		r = 1 ;
		break ;
if r == -1 : 
	print ( "No") ;
else :
	print ("Yes" ) ;

Submission status: Accepted

Solution code:
def main():
    import sys
    read = sys.stdin.buffer.read
    readline = sys.stdin.buffer.readline
    readlines = sys.stdin.buffer.readlines
    sys.setrecursionlimit(10 ** 7)

    x, y = map(int, readline().split())
    if 2 * x <= y <= 4 * x and y % 2 == 0:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
X =a[0]
Y =a[1]
for n in range(X+1):
    if 4*X-2*n ==Y :
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque, Counter
import math
import pprint
from functools import reduce
# stdin = open("sample.txt")

MOD = 1000000007

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def combination(m,n):
    
    if n > m:
        return 'すまん'
    return math.factorial(m) // (math.factorial(m-n) * math.factorial(n))

def pow_k(x,n):  # (x**n)の計算の高速化
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K *= x
        x *= x
        n //= 2
    return K * x
    
def main():
    x,y = [int(x) for x in stdin.readline().rstrip().split()]
    if y % 2 == 0 and y >= 2*x and y <= 4*x:
        print("Yes")
    else:
        print("No")
main()

Submission status: Accepted

Solution code:
import sys
x,y = map(int,input().split())
if (y == 0):
  print('No')
  sys.exit()
for turu in range(x + 1):
  f = ( 4 * x - y ) / 2 
  if( int(f) == int(turu) and f.is_integer()):
    print('Yes')
    sys.exit()
print('No')

Submission status: Accepted

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

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

if judge == 0:print("No")
else:print("Yes")

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())
 
a=X*2
b=X*4
 
if Y<a or Y>b:
  print("No")
elif Y%2==1:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
x, y = map(int,input().split())
for i in range(101):
    for j in range(101):
        if i == j == 0:
            continue
        if (2*i + 4*j == y) and (i+j == x):
            print('Yes')
            exit()
print('No')

Submission status: Accepted

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


##########
if __name__ == "__main__":
    b()

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(lambda x:int(x),input().split(" "))
if y%2==0 and y>=2*x and y<=4*x:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def main():
  X, Y = map(int, input().split()) # スペース区切り入力
  if Y % 2 == 1:
    print('No')
  else:
    if Y <= X * 4 and Y >= X * 2:
      print('Yes')
    else:
      print('No')
    
if __name__ == '__main__':
  main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

out = "No"
for i in range(x+1):
  if y == 2*i + 4*(x-i):
    out = "Yes"
    break

print(out)

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
if(2*x<=y<=4*x 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):
    for j in range(x+1):
        if i*2 + j*4 == y and i + j == x:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

Solution code:
X, Y = [int(x) for x in input().split()]
flag = True

if not 2*X <= Y <= 4*X:
  flag = False
if not 0 <= (Y-2*X)/2 <= X:
  flag = False
if (Y-2*X)/2.0 != int((Y-2*X)/2):
  flag = False
  
if flag:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
# B - Crane and Turtle

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

a = 2*x - y/2
b = (y-2*x)/2

#print(a,b)

if a>=0 and b>=0 and a%1!=0.5 and b%1!=0.5:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
def solve():
    X, Y = map(int,input().split())
    
    for crane in range(X+1):
        for turtle in range(X+1):
            if crane + turtle != X:
                continue

            if crane * 2 + turtle * 4 == Y:
                print('Yes')
                return
    else:
        print('No')

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1, x+1):
    f = 2 * i + 4 * (x - i)
    f1 = 4 * i + 2 * (x-i)
    if f == y or f1 == y:
        print("Yes")
        break
else:
        print("No")

Submission status: Accepted

Solution code:
def judge(num, legs):
  if legs % 2 != 0:
    return "No"
  elif legs // 4 > num:
    return "No"
  elif legs // 2 < num:
    return "No"
  elif (legs // 4) == num and (legs % 4) != 0:
    return "No"
  else:
    return "Yes"


list1 = input().split()
num = int(list1[0])
legs = int(list1[1])

print(judge(num, legs))

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def LI(): return list(map(int, input().split()))
def LIR(row,col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return map(list, zip(*read_all))

#################

X,Y = LI()

for i in range(X+1):
    temp = 2*i+4*(X-i)
    if temp == Y:
        print('Yes')
        exit()

print('No')

Submission status: Accepted

Solution code:
import sys

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

turtle = x
for bird in range(x+1):
    if 4 * turtle + 2 * bird == y:
        print("Yes")
        sys.exit(0)
    turtle -= 1

print("No")

Submission status: Accepted

Solution code:
from collections import Counter 
from collections import defaultdict
from collections import deque
from functools import reduce
import math
import itertools
import heapq
import numpy as np
import bisect
import sys
#import sympy
sys.setrecursionlimit(10**6)


def bfs(s,n,node):
    #頂点が探索済みかどうかのチェック配列
    check=[False for _ in range(n)]
    check[s]=True
    #次見る頂点を格納するキュー
    queue=deque([s])
    visited_num=1

    #問題固有の配列
    #color_check=[[True for _ in range(l)] for _ in range(n)]
    color=[-1 for _ in range(n)]
    color[s]=0
    
    while visited_num<n:
        #グラフが全連結ではない場合
        if len(queue)==0:
            #空配列を返す
            #現状までの計算済み配列を返してもいいと思う
            return color

        now_vertex=queue.popleft()
        #インデックスがない場合は
        for next_vertex in node[now_vertex]:


            if check[next_vertex]==True:
                continue

            queue.append(next_vertex)
            check[next_vertex]=True

            #問題固有の計算
            color[next_vertex]=color[now_vertex]+1
            visited_num+=1

    return color

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))



#n=int(input())
n,m=list(map(int,input().split()))
a=(m-2*n)/2
b=(4*n-m)/2

if a<0 or b<0 or int(a)!=a or int(b)!=b:
    print("No")
    exit()

else:
    print("Yes")

Submission status: Accepted

Solution code:
n,leg = map(int,input().split())
 
if leg%2==1:
    print('No')
elif 4*n < leg:
    print('No')
elif 2*n > leg:
    print('No')
else:
    print('Yes')

Submission status: Accepted

Solution code:
x, y = map(int, input(). split())
k = 0.5*y-x 
t = x - k
if y%2 == 0 and 0 <= k <= 100 and 0 <= t <= 100:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
x,y=(map(int,input().split()))
s=(4*x-y)/2.0
if s >= 0 and (s*10%10==0) and s <= x:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

ans = "No"
crane = 0
while crane <= x:
  turtle = x - crane
  if 2 * crane + 4 * turtle == y:
    ans = "Yes"
  crane += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, os, math, bisect, itertools, collections, heapq, queue
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    X, Y = il()
    for k in range(X + 1):
        if 2 * k + 4 * (X - k) == Y:
            print('Yes')
            exit()
    else:
        print('No')


if __name__ == '__main__':
    main()

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())

a = (Y - 2 * X ) / 2
yMod = Y % 2
b = X - a
if yMod == 0:
  if a >= 0 and b >= 0 and (a != 0 or b != 0):
    print('Yes')
  else:
    print('No')
else:
  print('No')

Submission status: Accepted

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

if Y < 2 *X:
    print('No')
elif Y%2 != 0:
    print('No')
else:
    if (4*X-Y)%2 == 0 and (4*X-Y) >= 0:
        print('Yes')
    else:
        print('No')

Submission status: Accepted

Solution code:
A = [int(x) for x in input().split()]

x = A[0]
y = A[1]
check=0
 
for i in range(x+1):
  z = i*2+(x-i)*4
  if z==y:
    print("Yes")
    check+=1
if check==0:
  print("No")

Submission status: Accepted

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

if y<2*x or y >4*x:
    print("No")
    sys.exit()
else:
    for i in range(x+1):
        if y==4*x-2*i:
            print("Yes")
            sys.exit()
            
print("No")

Submission status: Accepted

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

count = 0

kame = 4
tsuru = 2

X = int(X)
Y = int(Y)

for i in range(0,X+1):
    if kame *i + tsuru*(X-i)==Y:
        count = 1
        
if count ==1:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys
x,y=map(int,input().split())
num=2*x

for i in range(x+1):
  if num==y:
    print("Yes")
    sys.exit()
    
  num+=2
  
print("No")

Submission status: Accepted

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

from collections import defaultdict, deque, Counter
from sys import exit
import math
import copy
from bisect import bisect_right

import sys
sys.setrecursionlimit(1000000)
import heapq
INF = 10**10

def dijkstra(graph, start, n):
    h = []
    heapq.heappush(h, (0, start))
    costs = [INF for _ in range(n)]
    while h:
     cost, cur = heapq.heappop(h)
     if costs[cur] != INF:
         continue
     costs[cur] = cost
     for edge in graph[cur]:
         ecost, tgt = edge
         if costs[tgt] == INF:
             heapq.heappush(h, (cost + ecost, tgt))

    return costs

def main():
    a, b = getList()
    if b >= 2 * a and b <= 4 * a and b % 2 == 0:
        print("Yes")
    else:
        print("No")
if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
X,Y = list(map(int,input().split()))
if (Y-2*X)%2 == 0 and Y-2*X >= 0 and Y-4*X <= 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
import sys

X, Y = (int(item) for item in sys.stdin.readline().split())
print("Yes" if Y % 2 == 0 and X*2 <= Y and Y <= 4*X else "No")

Submission status: Accepted

Solution code:
totalNum, totalFoot = map(int, input().split())

if totalFoot <= totalNum * 4:
    flg = False
    for i in range(totalNum + 1):
        craneNum = i
        turtleNum = totalNum - i
        foot = (craneNum * 2) + (turtleNum * 4)

        if foot == totalFoot:
            flg = True
            print("Yes")
            break
    
    if not flg:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
k = (y - 2*x)/2
t = (4 * x - y)/2
ans = "No"
if(k >= 0):
  if(k % 1 == 0):
    if(t >= 0):
      if(t % 1 == 0):
        ans = "Yes"
print(ans)

Submission status: Accepted

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

c = (4*x-y)/2
t = (y-2*x)/2

if  c>= 0 and  t>= 0:
	if c >= 1 or t >= 1:
		if c.is_integer() == 1 and t.is_integer() == 1:
			print('Yes')
		else:
			print('No')
	else:
		print('No')
else:
	print('No')

Submission status: Accepted

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

a = (4*x - y) / 2

if a >=0 and a <= x and a.is_integer():
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
li = input().split()
num = int(li[0])
foot = int(li[1])
a = 0
for i in range(num+1):
  j = num-i
  n = 2*i + 4*j
  if n == foot:
    a += 1
    if a == 1:
      print("Yes")

if a == 0:
  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())
z = y - 2*x
if z%2 == 1:
    print("No")
else:
    b = z // 2
    a = (y - 4*b) // 2
    if (y - 4*b) % 2==1:
        print("No")
    elif a + b == x and a>=0 and b>=0:
        print("Yes")

    else:
        print("No")

Submission status: Accepted

Solution code:
from numpy.linalg import solve

X, Y = map(lambda x: int(x), input().split(" "))

left = [[1,1],
        [2, 4]]

right = [X, Y]

answer = solve(left, right)

if answer[0].is_integer() and answer[0] >= 0 and answer[1].is_integer() and answer[1] >= 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

if  (y - x*2)%2 == 0:
    a = (y-x*2)//2
    b = x - a
    if a < 0 or b < 0:
        print("No")
        exit(0)
    elif y == b * 2 + a * 4:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

Solution code:
import copy

def solve():
    x, y = map(int, input().split())
    i = copy.copy(x)
    while i >= 0:
        tmp = 2 * i + 4 * (x - i)
        if tmp == y:
            print('Yes')
            exit()
        if tmp > y:
            print('No')
            exit()
        i -= 1
    print('No')


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

Submission status: Accepted

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


for i in range(x+1):
    zzz = y - i * 4
    if x - i != 0:
        if zzz / (x - i) == 2.0:
            print('Yes')
            quit()
    else:
        if zzz == 0:
            print('Yes')
            quit()

print('No')

Submission status: Accepted

Solution code:
x, y = map(int,input().split(' '))
c = x * 2
le = y - c
t = le // 2
c = x - t
r = 'Yes'
if c < 0 or t < 0 or le % 2 > 0:
    r = 'No'
print(r)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

a = (X*4) - Y

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

Submission status: Accepted

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

if Y%2!=0 :
    print('No')
    flg=True
else:
    for i in range(0,X+1):
        j=X-i
        if i*2+j*4 == Y or j*2+i*4 == Y:
            print("Yes")
            flg=True
            break

if flg==False:
    print('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')
        a = 1
        break

if a == 0:
    print('No')

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
turu_kame = []
if Y%2 == 0: 
    for i in range(Y//4+1):
        turu_kame.append(int(i+(Y-i*4)/2))
print("Yes" if X in turu_kame else "No")

Submission status: Accepted

Solution code:
X, Y = list(map(int, input().split())) # 匹数, 足の本数
kame = 4
turu = 2

def flag():
    if Y % 2 != 0:
        return False
    
    for i in range(X + 1): #単調増加
        kame_num = i
        turu_num = X - i
        temp_sum = turu_num * turu + kame_num * kame
        if temp_sum == Y:
            return True
        elif temp_sum > Y:
            break
    return False

flag = flag()
print('Yes') if flag else print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/python3

#標準出力からの読み込み

x, y = input().split(" ")
#a+b=x,2a+4b=y <=> 
#a=2x-y, b=y/2-x
x = int(x)
y = int(y)
a = 2*x - y/2
b = y/2 - x
if y%2 == 1:
    print('No')
elif a<0 or b<0:
    print('No')
else:
    print('Yes')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

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

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

a = np.array([[1, 1], [2, 4]])
b = np.array([x, y])
c = np.linalg.solve(a, b)[0]
d = np.linalg.solve(a, b)[1]

def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

if c < 0 or d < 0:
    print('No')
else:
    if is_integer_num(c) and is_integer_num(d):
        print('Yes')
    else:
        print('No')

Submission status: Accepted

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

ans = 'No'

for a in range(0,51):
    for b in range(0,26):
        if (a+b == X ) and (2*a +4*b == Y):
            ans ='Yes'
            break
    else:
        continue
    break
print(ans)

Submission status: Accepted

Solution code:
import math

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

kaa = math.ceil(Y/2)

for i in range(0,kaa+1):
    t_asi = i*2
    k_asi = Y- t_asi
    
    if (i+k_asi/4 == X):
        print('Yes')
        sw += 1
        break


if (sw == 0):
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

if y % 2 == 0 and y // 2 - x >= 0 and 2 * x - y // 2 >= 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
a=input().split()

x=int(a[0])
y=int(a[1])

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

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]


def test():
    x, y = map(int, input().split())
    # x = input().split()
    a = y / 2 - x
    b = x - a
    if a >= 0 and b >= 0 and a.is_integer():
        print("Yes")
    else:
        print("No")

test()