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:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(X, Y):
    for i in range(X+1):
        j = X - i
        if 2*i + 4*j == Y:
            return 'Yes'
    return 'No'


def main():
    X, Y = read_int_n()
    print(slv(X, Y))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
from decimal import Decimal
INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)

# UnionFind
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

# ダイクストラ
def dijkstra_heap(s, edge, n):
    #始点sから各頂点への最短距離
    d = [10**20] * n
    used = [True] * n #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

# 素因数分解
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

# 2数の最小公倍数
def lcm(x, y):
    return (x * y) // gcd(x, y)

# リストの要素の最小公倍数
def lcm_list(numbers):
    return reduce(lcm, numbers, 1)

# リストの要素の最大公約数
def gcd_list(numbers):
    return reduce(gcd, numbers)

# 素数判定
def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True


# limit以下の素数を列挙
def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P

# 同じものを含む順列
def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        # set（集合）型で重複を削除、ソート
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret


# ここから書き始める
x, y = map(int, input().split())
for i in range(x + 1):
    if 2 * i + 4 * (x - i) == y:
        print("Yes")
        break
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(0,X+1):
    if 2*i + 4*(X-i) == Y:
        print("Yes")
        break
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:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    X, Y = map(int, readline().split())
    
    for i in range(X+1):
        j = X - i
        if 2 * i + 4 * j == Y:
            print('Yes')
            return
            
    print('No')
    return


if __name__ == '__main__':
    main()

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

    print('No')



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

x, y = map(int, input().split())
for tsuru in range(200):
    for kame in range(200):
        num = tsuru + kame
        ashi = tsuru * 2 + kame * 4 
        if x == num and ashi == y:
            print("Yes")
            exit()
print("No")

Submission status: Accepted

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce, lru_cache  # @lru_cache(None)
from fractions import gcd
import sys
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**6)
# ----------------------------------------------------------- #

x, y = (int(x) for x in 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())
t = 0
k = x
for t in range(x + 1):
    k = x - t
    if t * 2 + k * 4 == y:
        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')
        exit()

print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    import sys
    X,Y=list(map(int,sys.stdin.readline().split()))
    if Y%2==0 and 2*X<=Y and Y<=4*X:
        print('Yes')
    else:
        print('No')

main()

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    x,y = LI()
    s = y-2*x
    if s < 0 or s&1:
        print("No")
        return
    b = s >> 1
    a = x-b
    if a < 0:
        print("No")
    else:
        print("Yes")
    return

#Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    X, Y = [int(x) for x in input().split()]

    for i in range(101):
        for j in range(101):
            if i + j == X and (i * 2 + j * 4 == Y or i * 4 + j * 2 == Y):
                print("Yes")
                return

    print("No")


if __name__ == '__main__':
    main()

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:
import sys
x, y = map(int, input().split())

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

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
flag = 0
for i in range(0, 1000):
    for j in range(0, 1000):
        if 2 * i + 4 * j == y and i + j == x:
            flag = 1
            break

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

Submission status: Accepted

Solution code:
# N = int(input())
X, Y = [int(i) for i in input().split()]
for i in range(0, 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())
if y%2==0 and x*2 <= y <= x*4:
    print('Yes')
else:
    print('No')

Submission status: Accepted

Solution code:
x, y = map(int, input().split())
for i in range(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:
import sys

# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    x, y = ns()

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

    print("No")


if __name__ == '__main__':
    main()

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

ok = False
for i in range(100):
    for j in range(100):
        if i+j == X and 4*i+2*j == Y:
            ok = True
            break
print("Yes" if ok else "No")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(x + 1):
    z = i * 2 + 4 * (x - i)
    if z == 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):
    a = i*2
    b = (X-i)*4
    if (a+b) == Y:
        ans = "Yes"
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

INF = 999999999999999999999999
MOD = 10**9+7

x,y = get_nums_l()

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

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    x,y=map(int,readline().split())

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

if __name__=="__main__":
    main()

Submission status: Accepted

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

flag=False
for i in range(x+1):
    ashi=i*2+(x-i)*4
    if ashi==y:
        flag=True
print('Yes' if flag else 'No')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy


if __name__ == "__main__":
    x,y = map(int,input().split())
    for a in range(100):
        for b in range(100):
            if 2*a + 4*b == y and a+b == x:
                print("Yes")
                sys.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:
def examA():
    X = LI()
    for i in range(len(X)):
        if X[i]==0:
            ans = i+1
    print(ans)
    return

def examB():
    X, Y = LI()
    ans = "No"
    for i in range(X+1):
        if i*2+(X-i)*4==Y:
            ans = "Yes"
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examB()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
x, y = map(int, input().split())
print(["No", "Yes"][y % 2 == 0 and 2 * x <= y <= 4 * x])

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

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

x, y = na()
# a+b = x
# 2a+4b = y
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:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

judge = False

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

if judge:
    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:
import sys
input = lambda: sys.stdin.readline().rstrip()

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

Submission status: Accepted

Solution code:
X,Y = map(int,input().split())
judge = False
for i in range(X+1):
    if i * 2 + (X - i) * 4 == Y:
        judge=True
if judge:
    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')
    exit()
print('No')

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys

def solve():
    input = sys.stdin.readline
    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")

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    x, y = map(int, input().split())
    for i in range(200):
        for j in range(200):
            if i + j == x and i * 2 + j * 4 == y:
                print("Yes")
                exit()
    else:
        print("No")


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
#from fractions import gcd
#from itertools import combinations # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
x,y = readInts()
for i in range(0,y//2 + 1):
    for j in range(0,y//4 + 1):
        if i + j == x and i * 2 + j * 4 == y:
            print('Yes')
            exit()
print('No')

Submission status: Accepted

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

for i in range(x+1):
    j = x - i
    if j < 0:
        continue
    if 2 * i + 4 * j == y:
        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==i*2+j*4:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    X,Y=mis()
    for a in range(1000):
        for b in range(1000):
            if a+b==X and 2*a+4*b==Y:
                print(Yes)
                return
    print(No)

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

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

Submission status: Accepted

Solution code:
x,y = map(int,input().split())
"""
1zi houteisiki
2a+2b = 2x
2a+4b = y
2b = y-2x
2a = 4x-y
"""
if (y-2*x) % 2 == 0 and (4*x-y) % 2 == 0 and y-2*x >= 0 and 4*x-y >= 0:
	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")


main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import math
#import numpy as np
import queue
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

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

    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(rs())
def rs_(): return [_ for _ in rs().split()]
def ri_(): return [int(_) for _ in rs().split()]

X, Y = ri_()
print('Yes' if X * 2 <= Y <= X * 4 and Y % 2 == 0 else 'No')

Submission status: Accepted

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

for k in range(X+1):
    t = X-k 
    if 2*k + 4*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(2*i+4*(X-i)==Y):
    print("Yes")
    exit()
print("No")