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:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math
from collections import deque
import itertools
import heapq
#import bisect
from fractions import Fraction
import copy
from functools import lru_cache
from collections import defaultdict
import pprint


def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)

def soinsubunkai(n):
    a = []
    i = 1
    while i*i <= n:
        if n % i == 0 and i!=1:
            a.append(i)
            n=n//i

        if n% i !=0 or i==1:
            i += 1
    nokori=[n]
    return a + nokori

def main():
    x,y=map(int,input().split())
    ans="No"
    if y%2==0:
        if x>=-(y//-4):
            if x<=y//2:
                ans="Yes"
    print(ans)






if __name__ == "__main__":

    main()

Submission status: Accepted

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

    print("No")

resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

c = 0

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


if c != 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 and 4*x-y>=0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

min_leg = X*2
max_leg = X*4

if min_leg <= Y <= max_leg and Y % 2 == 0:
  print('Yes')
else:
  print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
import math
from copy import deepcopy
import queue
import numpy as np
# sympy as syp(素因数分解とか)
Mod = 1000000007
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1] 
for i in range(2, 10**5 + 1):
    fact.append((fact[-1] * i) % Mod)
    inv.append((-inv[Mod % i] * (Mod // i)) % Mod)
    factinv.append((factinv[-1] * inv[-1]) % Mod)
    
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p
    
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[y] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main():  #startline-------------------------------------------
    x, y = map(int, input().split())
    ans = 0
    for i in range(101):
        for j in range(101):
            if 2 * i + 4 * j == y and i + j == x:
                ans = 1
    print("Yes" if ans else "No")
                
if __name__ == "__main__":
    main() #endline===============================================

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")
        exit(0)
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+4*j == Y:
        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 = [int(v) for v in input().split()]

flag = False
for i in range(X+1):
    kame = i
    turu = X - i

    if kame * 4 + turu * 2 == Y:
        flag = True

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

Submission status: Accepted

Solution code:
a,b=[int(i) for i in input().split(" ")]
x=2*a-b/2
y=b/2-a

if int(x)==x and int(y)==y and x>=0 and y>=0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

Solution code:
from sys import stdin

def main():

    input = stdin.readline

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

    max_ashi = X * 4
    min_ashi = X * 2

    if (Y <= max_ashi) & (min_ashi <= Y) & (Y % 2 == 0):
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    a,b=INTM()
    t=max(0,(a*4-b)//2)
    k=max(a-t,0)
    if k*4+t*2==b:
        print('Yes')
    else:
        print('No')
    
if __name__ == '__main__':
    do()

Submission status: Accepted

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

for k in range(100):
    for t in range(100):
        if k + t == x and 2*t + 4*k == y:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

Solution code:
X, Y = map(int, input().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:

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:
import itertools
import copy
from collections import deque
import heapq
x,y = map(int,input().split())
mi = 2*x
ma = 4*x
if y % 2 == 0:
    if mi <= y and ma >= y:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Accepted

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

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

if counter :
    print("Yes")

else:
    print("No")

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def main():

    X, Y = in_nn()

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

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

    for t in range(x+1):
        k = x - t
        t_l = t * 2
        k_l = k * 4
        if y == t_l+k_l:
            print('Yes')
            return
    print('No')
if __name__=='__main__':
    main()

Submission status: Accepted

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from collections import *
from math import *

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

a = 0
b = X

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

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

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

print('Yes' if ck else 'No')

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

Solution code:
import sys

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

k=0
t=0

for i in range(x+1):
  k=i
  t=x-i

  a=(k*4)+(t*2)

  if a==y:
    print("Yes")
    sys.exit()

print("No")

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:
def main():
    x,y = map(int,input().split())
    if 2*x > y:
        print('No')
        return 0
    if 4*x < y:
        print('No')
        return 0
    if (4*x-y)%2 == 0:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
MOD = 10**9+7

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def main():
    X, Y = list(mi())
    if 4*X-Y >= 0 and (4*X-Y)%2 == 0 and (4*X-Y)//2<= X:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(X: int, Y: int):
    for i in range(X+1):
        if 2 * i + 4 * (X - i) == Y:
            return YES
    return NO


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    Y = int(next(tokens))  # type: int
    print(solve(X, Y))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

Submission status: Accepted

Solution code:
X, Y = map(int, input().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:
import sys
input = sys.stdin.readline

x,y=map(int,input().split())
if y<=x*4 and 2*x<=y 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):
    j = x - i
    if 2*i + 4*j == y:
        print('Yes')
        break
else:
    print('No')

Submission status: Accepted

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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
'''
#Pythonを用いる場合
#numpy 1.18.0, scipy 1.4.1, scikit-learn 0.22, numba 0.47.0, networkx 2.4
 
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
'''
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？


x,y=mii()

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

if Y % 2 == 1:
    print('No')
    exit(0)

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

Submission status: Accepted

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

isYes = True

if y % 2 != 0:
    isYes = False

if x * 2 > y:
    isYes = False

if x * 4 < y:
    isYes = False

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

Submission status: Accepted

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

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

    for kame in range(0, X+1):
        turu = X - kame

        if kame*4 + turu*2 == Y:
            print("Yes")
            return
    print("No")


if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    answer = "No"
    head,leg = map(int,input().split())
    for tsuru in range(0,head+1):
        kame = head - tsuru
        if tsuru * 2 + kame * 4 == leg:
            answer = "Yes"
            break

    print(answer)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x,y=map(int,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')

Submission status: Accepted

Solution code:
import sys

X, Y = map(int, input().split())
for a in range(101):
    for b in range(101):
        if a + b == X and 2 * a + 4 * b == Y:
            print("Yes")
            sys.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:

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

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

  print("No")


main()

Submission status: Accepted

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

Submission status: Accepted

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

Turu = 0
Kame = X

while 'true':
    if Turu * 2 + Kame * 4 == Y:
        print('Yes')
        break
    else:
        Turu += 1
        Kame -= 1
    
    if Kame < 0:
        print('No')
        break

Submission status: Accepted

Solution code:
# coding: utf-8
#import numpy as np
import re
import math
from collections import defaultdict
from collections import deque
import collections
from fractions import Fraction
import bisect
from queue import PriorityQueue
import itertools
from itertools import accumulate
from copy import deepcopy
import random
import time
import os
import sys
import datetime
from functools import lru_cache
from functools import reduce
readline=sys.stdin.readline
sys.setrecursionlimit(2000000)
alphabet="abcdefghijklmnopqrstuvwxyz"
numbers="0123456789"
mod=int(10**9+7)
inf=int(10**19)
class Edge():
    def __init__(self,x,y,val=1):
        self.x=x
        self.y=y
        self.val=val
class unionfind():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(n)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):
            self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def yn(b):
    if b:print("yes")
    else:print("no")
def Yn(b):
    if b:print("Yes")
    else:print("No")
def YN(b):
    if b:print("YES")
    else:print("NO")
def ispow(a,b):
    now=b
    while now<a:
        now*=b
    return now==a
def getbin(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def getfacs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def nextcomb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def getprimes(n):
    if n==0:return []
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    ret=[]
    for a in range(n+1):
        if(A[a]):ret.append(a)
    return ret
def isprime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(bbool,ret1,ret2):
    if bbool:return ret1
    else:return  ret2
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    return c.join(A)
def factorize(n):
    b = 2
    ret=defaultdict(int)
    while b * b <= n:
        while n % b == 0:
            n //= b
            ret[b]+=1
        b+=1
    if n > 1:ret[n]+=1
    return ret
def pm(x):
    return x//abs(x)
def inputintlist(): 
    return list(map(int,input().split()))
def inputfloatlist(): 
    return list(map(float,input().split()))
def tozero(A):
    ret=[None]*len(A)
    for a in range(len(A)):
        ret[a]=A[a]-1
    return ret
def istanchouzouka(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>=a:
            f=False
        prev=a
    return f
def istanchouhigensyou(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>a:
            f=False
        prev=a
    return f
def getallsum(A):
    s=sum(A)
    dp=defaultdict(int)
    dp[0]=1
    for a in range(0,len(A)):
        for b in range(s,-1,-1):
            if b-A[a]>=0:
                dp[b]+=dp[b-A[a]]
    return dp
def yuukoutomukou(edges):
    ret=deepcopy(edges)
    for edge in edges:
        if not edge.x==edge.y:
            ret.append(Edge(edge.y,edge.x,edge.val))
    return ret
def dijkstra(edges,V,start):
    mincost=[inf]*V
    G=[[] for a in range(V)]
    for edge in edges:
        G[edge.x].append([edge.val,edge.y])
    Q=PriorityQueue()
    Q.put([0,start])#[cost,x]
    while not Q.empty():
        nowcost,nowx=Q.get()
        if mincost[nowx]==inf:
            mincost[nowx]=nowcost
            for cost,y in G[nowx]:
                newcost=nowcost+cost
                Q.put([newcost,y])
    return mincost
def warshallfloyd(edges,V):
    mincost=[[inf for b in range(V)] for a in range(V)]
    for a in range(V):mincost[a][a]=0
    for edge in edges:
        mincost[edge.x][edge.y]=min(mincost[edge.x][edge.y],edge.val)#x→yが複数ある場合のためにmin()する
    for k in range(V):
        for s in range(V):
            for t in range(V):
                if mincost[s][k]==inf or mincost[k][t]==inf:continue
                mincost[s][t]=min(mincost[s][t],mincost[s][k]+mincost[k][t])
    return mincost
def bellemanford(edges,V,start):
    mincost=[inf]*V
    mincost[start]=0
    for _ in range(V):
        for edge in edges:
            if mincost[edge.x]==inf:continue
            mincost[edge.y]=min(mincost[edge.y],mincost[edge.x]+edge.val)
    return mincost
def getmd(x1,y1,x2,y2):
    return abs(x1-x2)+abs(y1-y2)
def geted(x1,y1,x2,y2):
    return math.sqrt((x1-x2)**2+(y1-y2)**2)
class fordfulkerson():
    def __init__(self,edges,V,s,t):
        self.V=V
        self.used=[False]*V
        self.G=[[] for a in range(V)]
        self.s=s
        self.t=t
        for edge in edges:
            self.G[edge.x].append({"x":edge.x,"y":edge.y,"cap":edge.val,"rev":len(self.G[edge.y])})
            self.G[edge.y].append({"x":edge.y,"y":edge.x,"cap":0,"rev":len(self.G[edge.x])-1})
    def dfs(self,v,t,f=inf):
        if v==t:return f
        self.used[v]=True
        for a in range(len(self.G[v])):
            x=self.G[v][a]["x"]
            y=self.G[v][a]["y"]
            cap=self.G[v][a]["cap"]
            rev=self.G[y][self.G[x][a]["rev"]]
            if self.used[y] or cap==0:continue
            f2=self.dfs(y,t,min(f,cap))
            if f2>0:
                self.G[v][a]["cap"]-=f2
                rev["cap"]+=f2
                return f2
        return 0
    def maxflow(self):
        flow=0
        while True:
            self.used=[False]*V
            zouka=self.dfs(self.s,self.t)
            if zouka==0:break
            flow+=zouka
        return flow
def heron(a,b,c):
    s=(a+b+c)/2
    S=s(s-a)(s-b)(a-c)
    S=math.sqrt(S)
    return S
def getAreaOfTriangle(x1,y1,x2,y2,x3,y3):
    a=geted(x1,y1,x2,y2)
    b=geted(x2,y2,x3,y3)
    c=geted(x3,y3,x1,y1)
    return heron(a,b,c)






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

X,Y=inputintlist()
f=False
for a in range(0,200):
    for b in range(0,200):
        if a+b==X:
            if a*2+b*4==Y:
                f=True
Yn(f)

Submission status: Accepted

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

Submission status: Accepted

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

    print(ans)

if __name__ == '__main__':
    main()

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+j == X and i*2+j*4==Y):
            ans = "Yes"
            break
print(ans)

Submission status: Accepted

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

    print("No")

    
    
    




    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys, math
#import io, os
#data = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
#from bisect import bisect_left as bl, bisect_right as br, insort
#from heapq import heapify, heappush, heappop
from collections import defaultdict as dd, deque, Counter
#from itertools import permutations,combinations
def data(): return sys.stdin.buffer.readline().strip()
def mdata(): return list(map(int, data().split()))
def outl(var) : sys.stdout.write(' '.join(map(str, var))+'\n')
def out(var) : sys.stdout.write(str(var)+'\n')
#sys.setrecursionlimit(100000)
INF = float('inf')
mod = 998244353
#from decimal import Decimal

x,y=mdata()
if 4*x<y or y<2*x or y%2!=0:
    out("No")
else:
    out("Yes")

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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

flag = False

for x in range(X+1):
  y = X - x
  ashi = 2*x + 4*y
  if ashi == Y:
    flag = True

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

Submission status: Accepted

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