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 math
import heapq,bisect
import sys
from collections import deque
from fractions import Fraction
mod=10**9+7
mod1=998244353
# ------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

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

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

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

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


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


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
# -------------------game starts now----------------------------------------------------import math
class SegmentTree1:
    def __init__(self, data, default=9999999, func=lambda a, b: min(a , b)):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)

# -------------------game starts now----------------------------------------------------import math
class SegmentTree:
    def __init__(self, data, default=0, func=lambda a, b: a + b):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)
#-------------------------------iye ha chutiya zindegi-------------------------------------
class Factorial:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorials = [1, 1]
        self.invModulos = [0, 1]
        self.invFactorial_ = [1, 1]

    def calc(self, n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0] * (n + 1 - len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = prev * i % m
        self.factorials += nextArr
        return self.factorials[n]

    def inv(self, n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        p = self.MOD
        pi = n % p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0] * (n + 1 - len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI, min(p, n + 1)):
            next = -self.invModulos[p % i] * (p // i) % p
            self.invModulos.append(next)
        return self.invModulos[pi]

    def invFactorial(self, n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n)  # To make sure already calculated n^-1
        nextArr = [0] * (n + 1 - len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = (prev * self.invModulos[i % p]) % p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n]


class Combination:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)

    def ncr(self, n, k):
        if k < 0 or n < k:
            return 0
        k = min(k, n - k)
        f = self.factorial
        return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
#--------------------------------------iye ha combinations ka zindegi---------------------------------
def powm(a, n, m):
    if a == 1 or n == 0:
        return 1
    if n % 2 == 0:
        s = powm(a, n // 2, m)
        return s * s % m
    else:
        return a * powm(a, n - 1, m) % m
#--------------------------------------iye ha power ka zindegi---------------------------------
def sort_list(list1, list2):
    zipped_pairs = zip(list2, list1)

    z = [x for _, x in sorted(zipped_pairs)]

    return z
#--------------------------------------------------product----------------------------------------
def product(l):
    por=1
    for i in range(len(l)):
        por*=l[i]
    return por
#--------------------------------------------------binary----------------------------------------
def binarySearchCount(arr, n, key):
    left = 0
    right = n - 1

    count = 0

    while (left <= right):
        mid = int((right + left) / 2)

        # Check if middle element is
        # less than or equal to key
        if (arr[mid] <= key):

            # At least (mid + 1) elements are there
            # whose values are less than
            # or equal to key
            count = mid + 1
            left = mid + 1

        # If key is smaller, ignore right half
        else:
            right = mid - 1

    return count
#--------------------------------------------------binary----------------------------------------
def countdig(n):
    c=0
    while(n>0):
        n//=10
        c+=1
    return c
def countGreater(arr, n, k):
    l = 0
    r = n - 1

    # Stores the index of the left most element
    # from the array which is greater than k
    leftGreater = n

    # Finds number of elements greater than k
    while (l <= r):
        m = int(l + (r - l) / 2)

        # If mid element is greater than
        # k update leftGreater and r
        if (arr[m] > k):
            leftGreater = m
            r = m - 1

        # If mid element is less than
        # or equal to k update l
        else:
            l = m + 1

    # Return the count of elements
    # greater than k
    return (n - leftGreater)
#--------------------------------------------------binary----------------------------------------
x,y=map(int,input().split())
b=y//2-x
if 0<=b<=x and y%2==0:
    print("Yes")
else:
    print("No")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import math
#import numpy as np
#import torch
#import torch.nn as nn
#import matplotlib.pyplot as plt
#from decimal import Decimal

#N=int(input())
N,K = map(int,input().split())
#B,W = map(int,input().split())
#T=int(input())
#A = list(map(int,input().split()))
#S=str(input())


for k in range(N+1):
    x=k*2 + (N-k)*4
    if x==K:
        print('Yes')
        exit()
print('No')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    from sys import setrecursionlimit, stdin, stderr
    from os import environ
    from collections import defaultdict, deque, Counter
    from math import ceil, floor
    from itertools import accumulate, combinations, combinations_with_replacement
    setrecursionlimit(10**6)
    dbg = (lambda *something: stderr.write("\033[92m{}\033[0m".format(str(something)+'\n'))) if 'TERM_PROGRAM' in environ else lambda *x: 0
    input = lambda: stdin.readline().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    P = 10**9+7
    INF = 10**18+10

    X,Y = LMIIS()
    if Y % 2 == 1:
        print('No')
        return
    if X*4 >= Y >= X*2:
        print('Yes')
        return
    else:
        print('No')
    
main()

Submission status: Accepted

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

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

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

# a + b = X
# 2a + 4b = Y

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

print(ans)

Submission status: Accepted

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

for t in range(101):
    for k in range(101):
        ashi = 2*t + 4*k
        if t+k == X and ashi == Y:
            print("Yes")
            quit()
print("No")

Submission status: Accepted

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

if 2*x <= y <= 4*x:
    ans = 1
if y%2 == 1:
    ans = 0
print(["No","Yes"][ans])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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())

flg = False
for a in range(101):
    for b in range(101):
        if a+b == x and 2*a + 4*b == y:
            flg = True


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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

f=0
for tsu in range(500):
    for ka in range(500):
        if tsu*2+ka*4==y and tsu+ka==x:
            f=1
            break

print(['No','Yes'][f])

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

if B % 2 == 1:
    print("No")
else:
    if 2*A <= B and B <= 4*A:
        print("Yes")
    else:
        print("No")

Submission status: Accepted

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

Submission status: Accepted

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

import sys
from collections import defaultdict, deque
from heapq import heappush, heappop
import math
import bisect
input = sys.stdin.readline

# 再起回数上限変更
# sys.setrecursionlimit(1000000)

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

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X, Y = MAP()

y = (Y-2*X)/2
x = X-y

if 0 <= x and x.is_integer() and 0 <= y and y.is_integer():
	print("Yes")
else:
	print("No")

Submission status: Accepted

Solution code:
x, y = [int(_) for _ in input().split()]
#x=a+b
#y=2a+4b
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

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

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

print("No")

Submission status: Accepted

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

Submission status: Accepted

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

print("No")

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

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

#処理内容
def main():
	X, Y = getlist()
	for i in range(101):
		for j in range(101):
			if i + j == X and (2 * i + 4 * j) == Y:
				print("Yes")
				return

	print("No")

if __name__ == '__main__':
	main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


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

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

    print("No")


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


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

    if 2 * X <= Y <= 4 * X and Y % 2 == 0:
        ans = "Yes"
    else:
        ans = "No"

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
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 main():
    x, y = LI()
    for i in range(x+1):
        j = x - i
        if i * 2 + j * 4 == y:
            print("Yes")
            return
    print("No")
    return

main()

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

x,y = nm()

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

print('No')

Submission status: Accepted

Solution code:
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

x,y=MI()
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 k in range(0,100):
  for t in range(0,100):
    if k+t==X and 4*k+2*t==Y:
      print("Yes")
      sys.exit(0)
else:
  print("No")

Submission status: Accepted

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

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

X, Y = MAP()

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

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

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    X, Y = list(map(int, _in[0].split(' ')))  # type:list(int)
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    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'
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	x, y = map(int, sys.stdin.readline().split())
	for i in range(x+1):
		ashi = 2 * i + 4 * (x-i)
		if ashi == y:
			print("Yes")
			exit()
	print("No")
	


main()

Submission status: Accepted

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

if Y%2 != 0:
  print("No")
  exit()

MIN = 2*X
MAX = 4*X

if Y >= MIN and Y <= MAX:
  print("Yes")
else:
  print("No")

Submission status: Accepted

Solution code:
[x,y] = [int(i) for i in input().split()]
fg = 0
for i in range(x+1):
    if (y - 2 * i) / 4 == x-i:
        fg = 1
if fg:
    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:

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
# from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
x,y=n1()

f=False
for i in range(0,x+1):
    j=x-i
    a=2*i+4*j
    if a==y:
        f=True
        break
p0(f)

Submission status: Accepted

Solution code:
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
	return list(map(int,input().split()))
def m(): #複数文字
	return map(int,input().split())
def onem(): #Nとかの取得
	return int(input())
def s(x): #圧縮
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x): #listをスペースごとに分ける
	return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
	return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
	ll = 0
	rr = r
	while True:
		mid = (ll+rr)//2

	if rr == mid:
		return ll
	if (ここに評価入れる):
		rr = mid
	else:
		ll = mid+1
"""


x,y = m()

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

flag = False

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

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**6)

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

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

Submission status: Accepted

Solution code:
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

X, Y = rl()

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

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

print('No')

Submission status: Accepted

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


input = sys.stdin.readline
def IS(cb): return cb(input().strip())
def IL(cb): return [cb(s) for s in input().strip().split()]
def IR(cb, rows): return [IS(cb) for _ in range(rows)]
def ILL(cb, rows): return [IL(cb) for _ in range(rows)]


def solve():
    x, y = IL(int)
    print('Yes' if y % 2 == 0 and 2 * x <= y <= 4 * x else 'No')


solve()

Submission status: Accepted

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

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

print("No")

Submission status: Accepted

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

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