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())
flags=False
for i in range(x+1):
  if 2*(x-i) + 4*(i) == y:
    flags=True
if flags:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

b = (Y - 2 * X) // 2
a = X - b

if 0 <= a <= X and 0 <= b <= X and a + b == X and 2 * a + 4 * b == Y:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
flags = False
for i in range(0,x+1):
    for j in range(0,x+1):
        #print("i:{},j:{}".format(i,j))
        if i + j == x and i*2 + j*4 == y:
            flags = True

if flags == True:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

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
X, Y = map(int, input().split())
for i in range(0, X+1):
    x = i
    y = X - i
    if x * 4 + y * 2 == Y:
        print("Yes")
        sys.exit()
print("No")

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(2147483647)
input=sys.stdin.readline

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

if __name__=='__main__':
  main()

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import time
import math
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

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

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

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'

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:
def main():
    x, y = map(int, input().split())
    b = (y - 2*x) / 2
    a = (4*x - y) / 2
    b1 = (y - 2*x) % 2
    a1 = (4*x - y) % 2
    if a1 == 0 and b1 == 0 and a >= 0 and b >= 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

z = 0
for a in range(X + 1):
    if Y == 4 * a + 2 * (X - a):
        z += 1

if z > 0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin, stdout
from time import time
read = stdin.readline
write = stdout.write
flush = stdout.flush
xr = xrange

def main():
	animals, legs = map(int,read().split())
	if legs >= 2 * animals and legs <= 4 * animals and legs % 2 == 0:
		print 'Yes'
	else:
		print 'No'

if __name__ == "__main__":
	main()

Submission status: Accepted

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

a=2*X-(1/2)*Y
b=(-1)*X+(1/2)*Y
if a>=0 and b>=0 and Y%2==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

'''
a + b = x -> b = x - a
2*a + 4*b = y
-> 2*a + 4*(x - a) = y
(4*x - y)/2 = a  これが整数か？
'''

a = (4*x - y)/2
b = x - a
def is_integer_num(n):
    if isinstance(n, int):
        return True
    if isinstance(n, float):
        return n.is_integer()
    return False

if (is_integer_num(a) == True) & (a >= 0) & (b >= 0):
    ans = 'Yes'
else:
    ans = 'No'
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x,y=list(map(int,input().split()))
a = (y-2*x)/2
print('Yes' if a == int(a) and 0<=a<=x else 'No')

Submission status: Accepted

Solution code:

def q2():
    x, y = [int(i) for i in input().split(" ")]
    if y % 2 != 0:
        print("No")
        return
    if (2 * x) <= y and y <= (4 * x):
        print("Yes")
        return
    print("No")


q2()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
x, y = [int(n) for n in stdin.readline().rstrip().split()]
if 2 * x <= y and y <= 4 * x and y % 2 ==0:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
n,m = map(int,input().split())

amari = m - n*2
if amari%2 == 0 and amari <= n*2 and amari >= 0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

if y%2 != 0:
    print('No')
elif 2*x <= y and 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(X):
    j = X - i 
    if i * 2 + j * 4 == Y:
        ans = 'Yes'
    elif j * 2 + i * 4 == Y:
        ans = 'Yes'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random,resource

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    x,y = LI()
    if y % 2 == 1 or x*2 > y or x*4 < y:
        return 'No'

    return 'Yes'


print(main())

Submission status: Accepted

Solution code:
def main():
    na, nl = (int(i) for i in input().split())
    nc = (4*na - nl) / 2

    pos = (nc == int(nc) and nc >= 0 and nc <= na)

    if pos:
        print('Yes')
    else:
        print('No')
      
main()

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
k=[]
j=a
for i in range(a+1):
    k.append(2*j)
    j=j+1
#print(k)
if(b in k):
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

a = (4 * X - Y) / 2
b = (-2 * X + Y) / 2

if a % 1 == 0 and a >= 0 and b % 1 == 0 and b >= 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())
for i in range(x+1):
    if 2*(i)+4*(x-i)==y:
        print('Yes')
        break
    else:
        if i==x:
            print('No')
            break

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
x,y=map(int,input().split())
s=0
#鶴を基準に考える
for i in range(x+1):
  kame=x-i
  asi=i*2+kame*4
  if asi==y:
    s+=1
    print("Yes")
    break
if s==0:
  print("No")

Submission status: Accepted

Solution code:
def main():
    X, Y = map(int, input().split())
    if Y % 2 == 1:
        print("No")
        exit()
    crane = Y / 2 - X
    turtle = X - crane
    if crane >= 0 and turtle >= 0:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# B Crane and Turtle

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

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

Submission status: Accepted

Solution code:
inp = list(map(int,input().split()))
x=inp[0]
y=inp[1]
flag=1
if (4*x-y)<0 or (4*x-y)%2==1:
  print ('No')
  flag=0
if (2*x>y or (y-2*x)%2==1) and flag==1:
  print ('No')
  flag=0
if flag==1:
  print ('Yes')

Submission status: Accepted

Solution code:
S = input( ).split( )
x = int(S[0])
y = int(S[1])
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 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())
if y % 2:
    print("No")
else:
    c = 2 * x - y // 2
    t = x - c
    if 0 <= c and 0 <= t:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

Solution code:
#入力:N,M(int:整数)
def input2():
	return map(int,input().split())
  
x,y=input2()
MAX=y/2
MIN=y/4

if y%2!=0:
	print("No")
elif x>MAX or x<MIN:
	print("No")
else:
	print("Yes")

Submission status: Accepted

Solution code:
TSURU = 2
KAME = 4

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

if TSURU*x <= y <= KAME*x and ((y-TSURU*x) % (KAME-TSURU) == 0):
    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 4 * i + 2 * (X - i) == Y:
        ans = 'Yes'
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x,y = input().split()
import math
a = math.floor((2 * int(x)) - (int(y)/2))
b = math.floor((int(y)/2) - int(x))

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

Submission status: Accepted

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

Submission status: Accepted

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

if kame%2 == 0:
    kame = kame//2
    turu = X-kame
    if X == kame+turu and kame>=0 and turu>=0:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

print(state)

Submission status: Accepted

Solution code:
X, Y = map(int, input().split())
a = False
for i in range(0, X+1):
    if 2*i + 4*(X-i) == Y:
        a = True

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

Submission status: Accepted

Solution code:
import sys

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:
X,Y=map(int,input().split())
cnt=0

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

if cnt>=1:
    print('Yes')
if cnt==0:
    print('No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
b = y / 2 - x
a = x - b
print("Yes" if a >= 0 and b >= 0 and a == int(a) and b == int(b) else "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())

no_flag = -1

if y - (4 * x) == 0:
    print("Yes")
elif y - (2 * x) == 0:
    print("Yes")
else:
    for cnt in range(x):
        if y >= 4 and y - (2 * (x-(cnt))) != 0:
            y -= 4
        elif y >= 2:
            y -= 2

        if y == 0 and cnt == x-1:
            no_flag = 0
        elif y == 0 and cnt != x-1:
            no_flag = 1
            break
        else:
            no_flag = 1

    if no_flag == 0:
        print("Yes")
    elif no_flag == 1:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

num_turtles = (num_legs / 2) - num_animals
num_cranes = num_animals - num_turtles

ans = 'Yes'

if num_turtles < 0 or num_animals < num_turtles:
    ans = 'No'

if num_cranes < 0 or num_animals < num_cranes:
    ans = 'No'

if (num_legs % 2) != 0:
    ans = 'No'

print(ans)

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()
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 (i * 2 + j * 4) == Y:
        ans = 'Yes'

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

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

answer = "No"

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

print(answer)

Submission status: Accepted

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

leg = XY[0] * 2
ans = 'No'
if leg == XY[1]:
    ans = 'Yes'
for i in range(XY[0]):
    leg += 2
    if leg == XY[1]:
        ans = 'Yes'

print(ans)

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())
ans="No"
for x in range(0,101):
  for y in range(0,101):
    if (x+y)==X and (2*x+4*y)==Y:
      ans="Yes"
      break
  if ans=="Yes":
    break
print(ans)

Submission status: Accepted

Solution code:
number = input().split(" ")
X = int(number[0])
Y = int(number[1])

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

import itertools

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

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

Submission status: Accepted

Solution code:
from sys import stdin


def readline_from_stdin() -> str:
    return stdin.readline().rstrip


if __name__ == '__main__':
    pass
    # N = input()
    # X, Y, Z = input().split()
    # A = [int(i) for i in input().split()]
    X, Y = input().split()
    X = int(X)
    Y = int(Y)

    b = (X*2-Y)/(-2)
    a = X-b
    # print(a, b)
    if not a.is_integer() or not b.is_integer() or a < 0 or b < 0:
        print("No")
        exit(0)
    print("Yes")

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 = input().split()
X = int(X)
Y = int(Y)
ans = 0
for i in range(51):
  if 2*i+4*(X-i)==Y:
    ans+=1
if ans>=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 2*i + 4*j == Y and i + j == X:
            print('Yes')
            exit()
print('No')

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:
L, R = map(int,input().split())
for a in range(L+1):
    L1=L-a
    if R==a*2+L1*4:
        han="Yes"
        break
    else:
        han="No"
print(han)

Submission status: Accepted

Solution code:
#Take the value of X
#Take the value of Y
#Do double equation

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

C = (Y-4*X)/-2

T = X - ((Y-4*X)/-2)

total = int(T + C)

if (T<0) or (C<0):
    print("No")
elif (T%1 != 0) or (C%1 != 0):
    print("No")
elif (T+C) == X and (4*T + 2*C) == Y:
    print("Yes")
else:
    print("No")

Submission status: Accepted

Solution code:
#getting input from user
#cranes and turtle already give the information
#condition yes or no 
X,Y= map(int,input().split())
cranes= 2 # assign 2 to cranes
turtles= 4 # assign 4 to turtle
ans="No"
for i in range(X+1): 
    b=X-i
    if cranes*i + turtles*b == Y:
        ans = "Yes"
print(ans)

# Time complixity O(X)

Submission status: Accepted

Solution code:
X,Y = map(int,input().split()) #input number of animals and legs

crane_legs = 2
turtle_legs = 4

answer = "No"

for i in range(X+1): #X+1 because it will only consider 0,1,2
    remaining = X-i
    if crane_legs*i + turtle_legs*remaining == Y:
        answer = "Yes"
#Loop to check combinations of animals is correct

print(answer)

Submission status: Accepted

Solution code:
#getting input from user
#cranes and turtle already give the information
#condition yes or no 
X,Y= map(int,input().split())
cranes= 2
turtles= 4
ans="No"
for i in range(X+1):
    b=X-i
    if cranes*i + turtles*b == Y:
        ans = "Yes"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# we input the number of animals(A)
# we then input the number of legs(B)
# we set the number of crane = 2 and turtle = 4
# we then compute (crane * i + turtle * j) to see if it's = B
A, B = map(int, input().split())

crane = 2
turtle = 4
ans = 'No'

for i in range(A + 1):
    j = A - i
    if crane * i + turtle * j == B:
        ans = 'Yes'
print(ans)

Submission status: Accepted

Solution code:
x,y= map(int,input().split()) # read No of Animals and total of legs 
crane= 2 # declare no of legs of crane
turtle= 4 # declare no of legs of turtles 
ans="No" # pre define the answer to No
for i in range(x+1): # for loop and we put the range until x+1
    b=x-i 
    if crane*i + turtle*b == y: # check the total of legs and compare to the result
        ans = "Yes"
print(ans) # Then print the result either yes or no

Submission status: Accepted

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

# the for loop is to check for any combinations of numbers of cranes and turtles in which the statement is correct.

Submission status: Accepted

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

Submission status: Accepted

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

crane = 2
turtle = 4
ans = 'No'

for i in range(x+1):
    j = x-i
    if crane*i+turtle*j == y:
        ans = 'Yes'
print(ans)

Submission status: Accepted

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

if y%2 != 0:
  print('No')
  exit()

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

Submission status: Accepted

Solution code:
X,Y=map(int,input().split())
crane=0
turtle=X
while crane<=X:
    if 2*crane+4*turtle==Y:
        print("Yes")
        break
    else:
        crane+=1
        turtle-=1
if crane==X+1:
    print("No")

Submission status: Accepted

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

chk = False

for a in range(x+1):
    b = x-a
    d = 2*a + 4*b
    if d == y:
        chk = True
        break
    
if chk:
    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 2*i + 4*j == y:
        ans = "Yes"
print(ans)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

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

kame = x
tsuru = 0

while tsuru <= x:
    if tsuru * 2 + kame * 4 == y:
        print('Yes')
        break
    else:
        kame -= 1
        tsuru += 1
else:
    print('No')

Submission status: Accepted

Solution code:
import collections
import itertools
import math
import statistics
import datetime
from bisect import bisect_left
import heapq

__author__ = 'sudoplox // Sudhanshu'
__contact__ = "sudoplox[at]gmail.com"


def BinarySearch(a, x):
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    else:
        return -1


def fibonacci(n):
    a = 0
    b = 1
    if n < 0:
        print("Incorrect input")
    elif n == 0:
        return a
    elif n == 1:
        return b
    else:
        for i in range(2, n):
            c = a + b
            a = b
            b = c
        return b


def ngreatestelem(lis, n):
    return heapq.nlargest(n, lis)


def nsmallestelem(lis, n):
    return heapq.nsmallest(n, lis)


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def sieve():
    # Complexity: O(n * log2(log2(n)))
    primes[1] = 1
    primes[2] = 2
    j = 4
    while j < 1000000:
        primes[j] = 2
        j += 2
    j = 3
    while j < 1000000:
        if primes[j] == 0:
            primes[j] = j
            i = j * j
            k = j << 1
            while i < 1000000:
                primes[i] = j
                i += k
        j += 2


def possiblepermutations(lis):
    return itertools.permutations(lis)


sieve = False
if sieve:
    primes = [0] * 1000000

# for _ in range(int(input())):
#     n = int(input())
#     s = input()
#     arr = list(map(int, input().split(" ")))

def solve(n,k):
    for i in range(0, n + 1):
        if i * 2 + 4 * (n - i) == k:
            return("Yes")
    return ("No")

n,k=map(int, input().split(" "))
print(solve(n,k))

Submission status: Accepted

Solution code:
a,b = map(int, input().split())
if (b%2 != 0):
  print("No")
  exit()
max = 4*a
if (b <= max):
  for _ in range(a+1):
    if(max==b):
      print("Yes")
      exit()
    max-=2
  print("No")
else:
  print("No")

Submission status: Accepted

Solution code:
def resolve():
    x, y = [int(i) for i in input().split()]
    a = y - 2 * x
    b = 4 * x - y
    if a % 2 == 0 and b % 2 == 0 and a >= 0 and b >= 0:
        print('Yes')
    else:
        print('No')
resolve()

Submission status: Accepted

Solution code:
n,l = list(map(int, input().split()))
if 2*n <= l <= 4*n and (4*n - l) % 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 i*2+(x-i)*4==y:
        print("Yes")
        exit()
print("No")

Submission status: Accepted

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

ans = "Yes"

if y % 2 != 0:
    ans = "No"
elif y < x*2:
    ans = "No"
elif y > x*4:
    ans = "No"

print(ans)

Submission status: Accepted

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

if y % 2 != 0:
    print("No")
elif y > 4 * x:
    print("No")
else:
  t_4 = 0
  c_2 = x

  while True:
      if c_2 < 0:
          print("No")
          break
      elif (4 * t_4 + 2 * c_2) == y:
          print("Yes")
          break

      t_4 += 1
      c_2 -= 1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import exit
X, Y = [int(x) for x in input().split()]

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

print('No')

Submission status: Accepted

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

a = Y/2 - X
b = -Y/2 + 2*X

a = round(a)
b = round(b)

flag = False
if(a >= 0 and b >=0):
    if(a + b == X and 4*a + 2*b == Y):
        flag = True

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

"""
カメ a匹，鶴b羽とすると

a + b = X

4a + 2b = Y

↓

2a = y - 2X

-2b = Y - 4X

↓

a = y/2 - X

b = -y/2 + 2X
"""

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n, l = list(map(int, input().split()))
minl, maxl = n * 2, n * 4
def fn(): return 'No' if l & 1 == 1 or l not in [i for i in range(minl, maxl+1, 2)] else 'Yes'
print(fn())

Submission status: Accepted

Solution code:
X,Y = map(int,input().split())
if Y%2 == 0:
  y = Y//2
else:
  print('No')
  exit(0)

if X <= y <=2*X:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

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

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())
if y <= x * 4 and y >= x * 2 and y % 2 == 0:
    ans ="Yes"
else :
    ans ="No"
print(ans)

Submission status: Accepted

Solution code:
def solve(x, y):
	for a in range(x + 1):
		b = x - a
		if 2*a + 4*b == y:
			return "Yes"
	return "No"

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

Submission status: Accepted

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

if y % 2 != 0:
    print('No')
    exit()

min_y = x * 2
max_y = x * 4

if min_y <= y <= max_y:
    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 2 * i + 4 * (X - i) == Y:
        flag = 1
        break
if flag == 1:
    print('Yes')
else:
    print('No')

Submission status: Accepted

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

for i in range(0, x+1, 1):

	val = i*2 + (x-i)*4

	if(val == y):
		print("Yes")
		exit()
print("No")

Submission status: Accepted

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