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:
line = list(map(int, input().split()))
if line[1] % 2 != 0:
    print("No")
elif line[0] * 4 >= line[1] and line[0] * 2 <= line[1]:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def II(): return int(input())
def MII(): return map(int, input().split())
def LII(): return list(map(int, input().split()))

def main():
    X, Y = MII()

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x, y = [int(i) for i in input().split(' ')]

foot_min = x * 2
foot_max = x * 4

if not y % 2:
    if foot_min <= y <= foot_max:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

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

    for a in range(X + 1):
        b = X - a
        if 2 * a + 4 * b != Y: continue
        print('Yes')
        return
    print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# 動物の数がX匹、　足の総数がY本
X,Y = map(int,input().split())
#print(X,Y)
turu = 2
kame = 4
flag = False
for i in range(0, X + 1): # 0, 1, 2, 3
    #print("亀が{0}匹の場合".format(i))
    turu_num = X - i
    #print("鶴は{0}匹".format(turu_num))
    leg_total = kame * i + turu_num * turu
    #print("足の総数は{0}".format(leg_total))
    if(leg_total == Y):
      flag = True
      break
#    for q in range(0, X - i + 1):
#        print("鶴は{0}匹".format(q))
#        if kame * i + turu * q == Y and (i + q) <= X:
#            flag += 1
if flag:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if Y % 2 == 1 :
  print("No")
else :
  if Y//2 -X < 0 :
    print("No")
  else :
    if X - (Y//2 -X) < 0 :
      print("No")
    else :
      print("Yes")

Submission status: Accepted

Solution code:
import sys

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

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

if Y % 2 == 1:
    print('No')
    exit()
if 2*X <= Y <= 4*X:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

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

if ashi != Y:
    print("No")

Submission status: Accepted

Solution code:
import sys
X, Y = map(int, input().split()) 
 
a = 2 * X
 
if a == Y:
  print('Yes')
  sys.exit()
 
for i in range(X):
  a = a + 2
  if a == Y:
    print('Yes')
    sys.exit()
    
print('No')

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
for c in range(X + 1):
    t_leg = Y - 2 * c
    if t_leg >= 0 and (X - c) * 4 == t_leg:
        print("Yes")
        exit()
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
else:
    print('No')

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
# import time
# import math
# import numpy as np
# import scipy.sparse.csgraph as cs            # csgraph_from_dense(ndarray, null_value=inf), bellman_ford(G, return_predecessors=True), dijkstra, floyd_warshall
# import random                                # random, uniform, randint, randrange, shuffle, sample
# import string                                # ascii_lowercase, ascii_uppercase, ascii_letters, digits, hexdigits
# import re                                    # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from bisect import bisect_left, bisect_right # bisect_left(a, x, lo=0, hi=len(a)) returns i such that all(val<x for val in a[lo:i]) and all(val>-=x for val in a[i:hi]).
# from collections import deque                # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popleft(), dq.rotate()
# from collections import defaultdict          # subclass of dict. defaultdict(facroty)
# from collections import Counter              # subclass of dict. Counter(iter): c.elements(), c.most_common(n), c.subtract(iter)
# from datetime import date, datetime          # date.today(), date(year,month,day) => date obj; datetime.now(), datetime(year,month,day,hour,second,microsecond) => datetime obj; subtraction => timedelta obj
# from datetime.datetime import strptime       # strptime('2019/01/01 10:05:20', '%Y/%m/%d/ %H:%M:%S') returns datetime obj
# from datetime import timedelta               # td.days, td.seconds, td.microseconds, td.total_seconds(). abs function is also available.
# from copy import copy, deepcopy              # use deepcopy to copy multi-dimentional matrix without reference
# from functools import reduce                 # reduce(f, iter[, init])
# from functools import lru_cache              # @lrucache ...arguments of functions should be able to be keys of dict (e.g. list is not allowed)
# from heapq import heapify, heappush, heappop # built-in list. heapify(L) changes list in-place to min-heap in O(n), heappush(heapL, x) and heappop(heapL) in O(lgn).
# from heapq import nlargest, nsmallest        # nlargest(n, iter[, key]) returns k-largest-list in O(n+klgn).
# from itertools import count, cycle, repeat   # count(start[,step]), cycle(iter), repeat(elm[,n])
# from itertools import groupby                # [(k, list(g)) for k, g in groupby('000112')] returns [('0',['0','0','0']), ('1',['1','1']), ('2',['2'])]
# from itertools import starmap                # starmap(pow, [[2,5], [3,2]]) returns [32, 9]
# from itertools import product, permutations  # product(iter, repeat=n), permutations(iter[,r])
# from itertools import combinations, combinations_with_replacement
# from itertools import accumulate             # accumulate(iter[, f])
# from operator import itemgetter              # itemgetter(1), itemgetter('key')
# from fractions import Fraction               # Fraction(a, b) => a / b ∈ Q. note: Fraction(0.1) do not returns Fraciton(1, 10). Fraction('0.1') returns Fraction(1, 10)
# from fractions import gcd                    # for Python 3.4 (previous contest @AtCoder)



def main():
    mod = 1000000007                # 10^9+7
    inf = float('inf')              # sys.float_info.max = 1.79e+308
    # inf = 2 ** 63 - 1             # (for fast JIT compile in PyPy) 9.22e+18
    sys.setrecursionlimit(10**6)    # 1000 -> 1000000
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def isp():   return input().split()
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    x, y = mi()
    if y % 2 == 1:
        print('No')
    else:
        print('Yes') if x * 2 <= y <= x * 4 else print('No')


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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:
import sys
sys.setrecursionlimit(10**9)

INF = 10**20
def main():
    X,Y = map(int,input().split())
    print("Yes" if 2*X <= Y <= 4*X and Y % 2 == 0 else "No")


if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
a = 0
ans = ''
while a <= x:
  b = x - a
  if 2 * a + 4 * b == y:
    ans = 'Yes'
    break
  a += 1
if ans == '':
  ans = 'No'
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
#, setrecursionlimit, stdout
#setrecursionlimit(1000000)
#from collections import deque
#from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin
def ii(): return int(stdin.readline())
def fi(): return float(stdin.readline())
def mi(): return map(int, stdin.readline().split())
def fmi(): return map(float, stdin.readline().split())
def li(): return list(mi())
def si(): return stdin.readline().rstrip()
def lsi(): return list(si())
#mod=1000000007
res=['Yes', 'No']
############# CODE STARTS HERE #############

test_case=1
while test_case:
    test_case-=1

    x, y=mi()
    f=1
    while y>0:
        if x*2==y:
            f=0
            break
        x-=1
        y-=4
    if not x and not y:
        f=0
    print(res[f])

Submission status: Accepted

Solution code:
from collections import deque
import math

def Next(): return input()
def NextInt(): return int(Next())
def NextInts(): return map(int,input().split())
def Nexts(): return map(str,input().split())
def NextIntList(): return list(map(int,input().split()))
def RowInts(n): return [input() for i in range(n)]

x, y = NextInts()

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 a in range(0,x+1):
    b=x-a
    if 2*a+4*b==y:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
 
n = (X*4 - Y) / 2

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

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())
ans = 'No'
for t in range(0, x+1):
    c = x - t
    if 4*t + 2*c == y:
        ans = 'Yes'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def resolve():
    x, y = map(int, input().split())
    if y % 2 == 1:
        print("No")
        exit()
    if 0<= (4*x-y) / 2 <= x:
        print("Yes")
    else:
        print("No")
resolve()

Submission status: Accepted

Solution code:
x, y = list(map(int,input().split()))
ans = y / 2 - x 
if y % 2 == 1:
    print("No")
elif 0 <= ans <= x:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

ans = "No"
for i in range(101):
    for j in range(101):
        if (i * 2) + (j * 4) == y and (i + j) == x:
            ans = "Yes"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ans = 'No'

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(X+1):
  for j in range(X+1):
    if i+j==X and 2*i+4*j==Y:
      f = True

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
a,b = [int(i) for i in input().split()]
ans='No'

y = b/2-a #animal de 4 patas
x = -b/2 + 2*a

if x>=0 and y>=0 and b%2==0:
    if x==int(x) and y==int(y):
        ans='Yes'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int, input().split()) 

for i in range(a+1):
    if (a-i)*2+(i)*4 == b:
        print('Yes')
        break
    if i==a:
        print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

if(Y%2==1):
    q=1
    print("No")

if q==0:
    print(X*2<=Y and Y<=X*4 and "Yes" or "No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os
import sys
from io import BytesIO, IOBase
import math


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


def inputArray():
    return input().rstrip().split()


def inputVars():
    return map(int, input().rstrip().split())


def inputNum():
    return int(input())


def main():
    totalAnimals, noOfLegs = inputVars()
    ans = 'No'
    for num in range(totalAnimals+1):
        rest = totalAnimals-num
        if 2*num+4*rest==noOfLegs:
            ans = 'Yes'
            break
    print(ans)



#.........................................FAST INPUT OUTPUT.......................................
BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

#....................................END OF FAST I/O............................................

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
b,a=map(int,input().split())
if a%2==0 and a>=2*b and a<=4*b:
    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().strip().split())
if x*4<y or x*2>y:
  print("No")
elif y%2!=0:
  print("No")
else:
  print("Yes")

Submission status: Accepted

Solution code:
x,y=map(int,input().split());print('YNeos'[y%2 or x*4<y or y<x*2::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
if y % 2 == 1:
  print("No")
elif 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 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 and 2*x<=y<=4*x:
  print('Yes')
else:
  print('No')

Submission status: Accepted

Solution code:
x, y = (int(i) for i in input().split())

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

Submission status: Accepted

Solution code:
def solve(X, Y):
    from numpy.linalg import solve
    left = [[1, 1], [2, 4]]
    right = [X, Y]
    res = solve(left, right)
    x = res[0]
    y = res[1]

    if x == float(int(x)) and y == float(int(y)) and x >= 0 and y >= 0:
        print('Yes')
    else:
        print('No')
 
X, Y = map(int, open(0).read().split())
solve(X, Y)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys

X,Y = list(map(int, input().rstrip().split()))
#-----

for crane in range(X+1):
    tortoise = X - crane
    
    if Y == crane*2 + tortoise*4:
        print("Yes")
        sys.exit()

print("No")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

Submission status: Accepted

Solution code:
N, M = map(int,input().split())
for i in range(0, N+1):
    # 足の数
    f = 2 * i + 4 * (N - i)
    if f == M:
        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:
FAST_IO = 0
if FAST_IO:
    import io, sys, atexit
    read = iter(sys.stdin.read().splitlines()).next
    sys.stdout = _OUTPUT_BUFFER = io.BytesIO()
    @atexit.register
    def write():
        sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())
else:
    read = raw_input
readint = lambda: int(rr())
readlist = lambda: map(int, read().split())

####
def solve(X, Y):
    # a+b = X
    # 2a+4b = Y
    # a+2b = Y/2
    if Y & 1: return False
    Y //= 2
    b = Y - X
    if b < 0: return False
    a = X - b
    return a >= 0

print "Yes" if solve(*readlist()) 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 i*2+j*4==y:
            print('Yes')
            exit()

print('No')



# a = 2
# b = 4

# lista=[]
# listb=[]

# for i in range(101):
#     if i %2 == 0:
#         lista.append(i)

# for j in range(101):
#     if j % 4 == 0:
#         listb.append(j)


# if y == b*x:
#     print('Yes')
# elif y == a*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*2+(x-i)*4==y:
            print("Yes")
            return
    print('No')
if __name__ == "__main__":
    main()
#12 31

Submission status: Accepted

Solution code:
a,b=map(int,input().split())

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
print('YNeos'[y%2 or x*2<y//2 or y//2<x::2])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

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

    X, Y = input_number_list()
    print(['No', 'Yes'][2 * X <= Y <= 4 * X and Y % 2 == 0])


if __name__ == '__main__':
    main()

Submission status: Accepted

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

for i in range(x+1):
  j=x-i
  if j<0:continue
  if 2*i+4*j==y or 4*i+2*j==y:
    print("Yes")
    exit(0)
print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
print('YNeos'[y%2 or x*2-y//2<0 or y//2-x<0::2])

Submission status: Accepted

Solution code:
X,Y = map(int,input().split())
#X総数Y足

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

Submission status: Accepted

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

if Y % 2 != 0:
    print("No")
elif not 2 * X <= Y <= 4 * X:
    print("No")
else:
    print("Yes")

Submission status: Accepted

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

 
if z==1:
    print("Yes")
else:
    print("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 i * 2 + j * 4 == y:
            print('Yes')
            exit()

print('No')

Submission status: Accepted

Solution code:
from sys import stdin,stdout
import math
from collections import deque,defaultdict
from math import ceil,floor,inf,sqrt,factorial,gcd,log2
from copy import deepcopy
ii1=lambda:int(stdin.readline().strip())
is1=lambda:stdin.readline().strip()
iia=lambda:list(map(int,stdin.readline().strip().split()))
isa=lambda:stdin.readline().strip().split()
mod=1000000007
ani,total = iia()
if total>4*ani:
    print('No')
elif total % 2==0:
    crane=(4*ani - total)
    tor = total-2*ani
    if crane%2==0 or tor%2==0:
        if 0<=crane//2<=ani and 0<=tor//2<=ani:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y=map(int,input().split())
x2=y//2-x
x1=x-x2
if(y==0 and x>0):
    print("No")
if(y%2!=0):
    print("No")
elif(x1==0 and x2==0):
    print("No")
elif(x1>=0 and x2>=0):
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

X = D[0]
Y = D[1]

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
Z = 0
ANS = 'No'
if Y % 2 == 0:
    while X >= 0:
        i = X*2 + Z*4
        if i == Y:
            ANS = 'Yes'
        X -= 1
        Z += 1
print(ANS)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

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

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
if y%2:
    print('No')
else:
    if (y//2-x)<0 or (2*x-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):
    p = i * 2 + (x-i) * 4
    if p == y:
        print("Yes")
        exit(0)
print("No")

Submission status: Accepted

Solution code:
X,Y = (map(int, input().split()))
X2= X*2
num = 0
for i in range(X+1):
    if X2+num == Y:
        print("Yes")
        quit()
    num +=2
print("No")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

p = list(range(X*2,X*4+1,2))
b = Y

if b in p:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
z=[]
a=[]
b=[]
x, y= map(int,input().split())
for i in range(x):
    a.append(i)


for i in a:
    b.append(i+1)
    
b.append(0)


for i in b:
    if (4*x)-(2*i)==y:
        z.append('1')

    
        
if len(z)>0:
    print('Yes')

if len(z)<=0:
    print('No')

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))


def calc(x,y):
    z = -(2*x - y)
    if z%2 != 0:
        print('No')
        return
    else:
        a = z//2

    if a < 0:
        print('No')
        return
    
    b = x - a
    if b < 0:
        print('No')
        return
    
    print('Yes')
    return

x,y = mi()

calc(x,y)

Submission status: Accepted

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

if Y < X*2 :
  print("No")
  exit()

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

Submission status: Accepted

Solution code:
x,y = map(int, input().split())
a = 2 * x - 0.5 * y
b = (-1) * x + 0.5 * y
c = round(a)
d = round(b)
if c == a and d == b and c >= 0 and d >= 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

for i in range(1, h[0]+1):
    if 2 * i + 4 * (h[0]-i) == h[1]:
        print('Yes')
        exit()
for i in range(1, h[0]+1):
    if 4 * i + 2 * (h[0]-i) == h[1]:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())
if Y<=4*X and Y>=2*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 y%2 == 0 and a >=0 and b>=0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

a = 0

for i in range(x+1):
    if (x - i)*4 + (i * 2) == y:
        a += 1
        break

if a == 1:
    print("Yes")
else:
    print("No")