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: Wrong Answer

Solution code:
#import sys
#import numpy as np
import math
#import itertools
#from fractions import Fraction
#import itertools
from collections import deque
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
x,y=map(int,input().split())
if x*4>=y and (x*4-y)%2==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

    a = Y - X * 2

    if a >= 0 and a % 2 == 0 and a % 2 <= X:
        print('Yes')
    else:
        print('No')

solve()

Submission status: Wrong Answer

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

if y < 2 * x or 4 * x < y:
    print( "No" )
else:
    print( "Yes" )

Submission status: Wrong Answer

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

a = (4*X-Y)

if a%2==0 and a>=0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = (y-2*x)/2
b = (4*x-y/2)
if a == int(a) and b == int(b) and a >= 0 and b >= 0:
    print('YES')
else:
    print('NO')

Submission status: Wrong Answer

Solution code:
#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math as mt
#import numpy as np

def ro(n):
  return mt.floor(mt.sqrt(n))
def ya():
  print("Yes")
  return
def na():
  print("No")
  return


a,b=map(int,input().split())
#lis=list(map(int,input().split()))
#n=int(input())
#s=input()

if b%2:
  na()
elif b>a*4:
  na()
else:
  ya()

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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')
    break
else :
  print('NO')

Submission status: Wrong Answer

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


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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
i = input().split()
i = [int(j) for j in i]
 
flg = 0
for a in range(i[0]):
  if 2*a+4*(i[0]-a)==i[1]:
    print("Yes")
    flg = 1
    
if flg==0:
  print("No")

Submission status: Wrong Answer

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

tmp = X * 4
while True:
    tmp -= 2
    if tmp == Y:
        print('Yes')
        break
    if tmp < 0:
        print('No')
        break

Submission status: Wrong Answer

Solution code:
from math import gcd

from math import factorial as f

from math import ceil,floor,sqrt
import math

import bisect
import re
import heapq


from copy import deepcopy
import itertools
from itertools import permutations

from sys import exit

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


yes = "Yes"
no = "No"


def main():
    x,y = mi()
    flag = False
    for i in range(101):
        if i*2+(x-i)*4 == y:
            flag = True
    if flag:
        print(yes)
    else:
        print(no)



main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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):
        for j in range(X+1-i):
            if 2 * i + 4 * j == 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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#dt = {} for i in x: dt[i] = dt.get(i,0)+1
import sys
input = sys.stdin.readline
ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda :int(input())
ip = lambda :[int(w) for w in input().split()]

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

Submission status: Wrong Answer

Solution code:
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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

Submission status: Wrong Answer

Solution code:
import sys
import math
import collections
import decimal
import itertools
from collections import deque
from functools import reduce
import heapq
#n = int(input())
x, y = map(int, sys.stdin.readline().split())
#s = input()
#x = list(map(int, sys.stdin.readline().split()))
     

if 2 ** x > y:
    print("NO")
    sys.exit()

if 4 ** x < y:
    print("NO")
    sys.exit()

if y % 2 == 1:
    print("NO")
else:
    print("YES")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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=a-t
    if k*4+t*2==b:
        print('Yes')
    else:
        print('No')
    
if __name__ == '__main__':
    do()

Submission status: Wrong Answer

Solution code:
# B

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

Submission status: Wrong Answer

Solution code:
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

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

X, Y = input_int()

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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(1,X+1):
        if i*2 + 4*(X-i) == Y:
            print(YES)
            exit()
    print(NO)
    exit()
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    solve(X, Y)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
X, Y = map(int, input().split())
flag = False
for i in range(0, X+1):
    if i * 4 + (X-i) * 2 == Y:
        flag = True
print("Yes" if flag else "NO")

Submission status: Wrong Answer

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

if y >= 2*x and y<= 4*x and y% 2==0:
    print("YES")
else:
    print("NO")

Submission status: Wrong Answer

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

ok = False
for a in range(1, x + 1):
    b = x - a
    if b < 0:
        continue

    if 2 * a + 4 * b == y:
        ok = True

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

d = collections.deque()
def LI(): return list(map(int, sys.stdin.readline().split()))

X, Y = LI()

ans = True
if Y % 2 == 1:
    ans = False

if X * 2 <= Y < X * 4:
    pass
else:
    ans = False

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if 2*x <= y and y <= 4*x:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

ans = "No"
for t in range(x + 1):
    for c in range(x + 1):
        if t + c > x:
            break
        leg = 4 * t + 2 * c
        if leg == y:
            ans = "Yes"

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


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

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


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

if 2**x == y:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

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: Wrong Answer

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

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

    a = Y - X * 2

    if a >= 0 and a % 2 == 0:
        print('Yes')
    else:
        print('No')

solve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N, S = mi()

if not S % 2 and N * 4 >= S:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


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

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

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

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

  for i in range(x+1):
    for j in range(x+1-i):
      z=i*2+j*4

      if z==y:
        return 'Yes'

  return 'No'

# main()
print(main())

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for x in range(10000):
    y = X-x
    z = x*2+4*y
    if z == Y:
        print('Yes')
        break
else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,M = map(int,input().split())
if M %2 == 0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


print('Yes' if main() else 'No')
#print('YES' if main() else 'NO')

Submission status: Wrong Answer

Solution code:
# じょえチャンネルおもしろいよ～～～
# https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ

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

Submission status: Wrong Answer

Solution code:
def main():
    X, Y = list(map(int, input().split()))
    for i in range(1, X + 1):
        if i * 4 + i * 2 == Y:
            return True
    return False


print('Yes' if main() else 'No')
#print('YES' if main() else 'NO')

Submission status: Wrong Answer

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

Submission status: Time Limit Exceeded

Solution code:
def main():
    a,b = map(int,input().split())
    leg  = 0
    for i in range(2**(a)):
        leg = 0
        for j in range(a):
            if (i & 1 <<j):
                leg +=4
            else:
                leg +=2
        if leg == b:
            print('Yes')
            exit()
    print('No')
main()

Submission status: Time Limit Exceeded

Solution code:
import collections

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

ans = "No"
for i in range(2**X):
    count = collections.Counter(bin(i)[2:].zfill(X))
    num = count["0"]*2 + count["1"]*4
    if num == Y:
        ans = "Yes"
        break
    elif num > Y:
        ans = "No"
        break

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import collections

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

ans = "No"
for i in range(2**X):
    count = collections.Counter(bin(i)[2:].zfill(X))
    num = count["0"]*2 + count["1"]*4
    if num == Y:
        ans = "Yes"
        break
    elif num > Y:
        ans = "No"

print(ans)

Submission status: Time Limit Exceeded

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

flag = 1 

for i in range(2**X):
        y = 0 
        for j in range(X):
                if ((i >> j) & 1): 
                        y += 4
                else:
                        y += 2    
        if y == Y:
                print("Yes")
                flag = -1
                break

if flag == 1:
        print("No")

Submission status: Time Limit Exceeded

Solution code:
hiki,hon = map(int,input().split())

turu = 0
kame = 0

while(1):
    if hon < 4 or hiki == 0:
        break
    if hon >= 4:
        hon = hon -4
        kame = kame + 1
        hiki = hiki - 1
        
if hon == 2:
    turu = turu + 1
    hiki = hiki -1
    hon = 0
hantei = hon % 2
while(1):
    if hiki == 0 or kame == 0 or hantei == 1:
        break
    else:
        if hiki > 0 and kame > 0 and hantei == 0:
            hiki = hiki - 1
            kame = kame - 1
if hiki == 0 and hon == 0:
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

Solution code:
from itertools import product

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

# check
if Y in set([sum(p) for p in set(product([2, 4], repeat=X))]):
    print("Yes")
else:
    print("No")

Submission status: Time Limit Exceeded

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

if y/2 < x or y % 2 != 0:
    print("No")
    exit()


"""
ls = [y/2, y/4, x]
print(ls)
ls.sort()
print(ls)
"""

def search1(count, sum):
    #print(count, sum)
    if sum > y or count > x:
        return False
    elif sum == y and count == x:
        print("Yes")
        exit()

    if search1(count+1, sum +2):
        return True
    if search1(count+1, sum +4):
        return True


    return False
    """
    count += 1
    #鶴
    sum += 2
    search(count, sum)
    #亀
    sum += 4
    search(count, sum)
    """

def search2(count, sum):
    #print(count, sum)
    if sum > y or count > x:
        return False
    elif sum == y and count == x:
        print("Yes")
        exit()

    if search2(count+1, sum +4):
        return True
    if search2(count+1, sum +2):
        return True

    return False

#search(0, 0)
dt1=abs(x - y/2)
dt2=abs(x - y/4)

if dt1 <= dt2:
    search1(0,0)
else:
    search2(0,0)

print("No")

Submission status: Time Limit Exceeded

Solution code:
import itertools
import numpy as np

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

if Y % 2 != 0:
  print('No')
elif X > Y:
  print('No')
elif Y > (X * 4):
  print('No')
elif X > (Y * 2):
  print('No')
elif Y < (X * 2):
  print('No')
elif X * 2 == Y or X * 4 == Y:
  print('Yes')
else:
  lis=[4, 2]
  result = []
  ans = 'No'
  for conb in itertools.product(lis, repeat=X):
    result.append(sum(list(conb))) #タプルをリスト型に変換
    if Y in result:
      ans = 'Yes'
      break
            
  print(ans)

Submission status: Time Limit Exceeded

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

if y/2 < x or y % 2 != 0:
    print("No")
    exit()


"""
ls = [y/2, y/4, x]
print(ls)
ls.sort()
print(ls)
"""

def search1(count, sum):
    #print(count, sum)
    if sum > y or count > x:
        return False
    elif sum == y and count == x:
        print("Yes")
        exit()

    if search1(count+1, sum +2):
        return True
    if search1(count+1, sum +4):
        return True


    return False
    """
    count += 1
    #鶴
    sum += 2
    search(count, sum)
    #亀
    sum += 4
    search(count, sum)
    """

def search2(count, sum):
    #print(count, sum)
    if sum > y or count > x:
        return False
    elif sum == y and count == x:
        print("Yes")
        exit()

    if search2(count+1, sum +4):
        return True
    if search2(count+1, sum +2):
        return True

    return False

#search(0, 0)
dt1=abs(x - y/2)
dt2=(x - y/4)

if dt1 <= dt2:
    search1(0,0)
else:
    search2(0,0)

print("No")

Submission status: Time Limit Exceeded

Solution code:
import itertools
import numpy as np

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

if Y % 2 != 0:
  print('No')
elif X > Y:
  print('No')
elif Y > (X * 4):
  print('No')
elif X > (Y * 2):
  print('No')
elif Y < (X * 2):
  print('No')
elif X * 2 == Y or X * 4 == Y:
  print('Yes')
else:
  lis=[2, 4]
  result = []
  ans = 'No'
  for conb in itertools.product(lis, repeat=X):
    result.append(sum(list(conb))) #タプルをリスト型に変換
    if Y in result:
      ans = 'Yes'
      break
            
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
A, B = map(int, input().split())
num = A
while True:
    if (B < 0):
        print('No')
        break
    if (A == 0 and B == 0):
        print('Yes')
        break
    if (A == 0):
        while True:
            if (A == num and B > 0):
                print('No')
                exit()
            if (B == 0):
                print('Yes')
                exit()
            B = B - 2
            A = A + 1
    B = B - 2
    A = A - 1

Submission status: Time Limit Exceeded

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

if y/2 < x:
    print("No")
    exit()


"""
ls = [y/2, y/4, x]
print(ls)
ls.sort()
print(ls)
"""

def search1(count, sum):
    #print(count, sum)
    if sum > y or count > x:
        return False
    elif sum == y and count == x:
        print("Yes")
        exit()

    if search1(count+1, sum +2):
        return True
    if search1(count+1, sum +4):
        return True


    return False
    """
    count += 1
    #鶴
    sum += 2
    search(count, sum)
    #亀
    sum += 4
    search(count, sum)
    """

def search2(count, sum):
    #print(count, sum)
    if sum > y or count > x:
        return False
    elif sum == y and count == x:
        print("Yes")
        exit()

    if search2(count+1, sum +4):
        return True
    if search2(count+1, sum +2):
        return True

    return False

#search(0, 0)
dt1=abs(x - y/2)
dt2=(x - y/4)

if dt1 <= dt2:
    search1(0,0)
else:
    search2(0,0)
print("No")

Submission status: Time Limit Exceeded

Solution code:
from itertools import *
X,Y = map(int,input().split())
if X*2 == Y:
    print("Yes")
elif X*4 == Y:
    print("Yes")
else:
    tmp = [2 for i in range(25)]+[4 for i in range(25)]
    li = set(combinations(tmp,X))
    for i in li:
        if sum(i) == Y:
            print("Yes")
            exit()
    print("No")

Submission status: Time Limit Exceeded

Solution code:
import itertools
import numpy as np

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

if Y % 2 != 0:
  print('No')
elif Y > (X * 4):
  print('No')
elif X > (Y * 2):
  print('No')
elif Y < (X * 2):
  print('No')
elif X * 2 == Y or X * 4 == Y:
  print('Yes')
else:
  lis=[2, 4]
  result = []
  for conb in itertools.product(lis, repeat=X):
    result.append(sum(list(conb))) #タプルをリスト型に変換
            
  print('Yes' if Y in result else 'No')

Submission status: Time Limit Exceeded

Solution code:
from itertools import *
X,Y = map(int,input().split())
if X*2 == Y:
    print("Yes")
elif X*4 == Y:
    print("Yes")
else:
    tmp = [2 for i in range(50)]+[4 for i in range(50)]
    li = set(combinations(tmp,X))
    for i in li:
        if sum(i) == Y:
            print("Yes")
            exit()
    print("No")

Submission status: Time Limit Exceeded

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

if y/2 < x:
    print("No")
    exit()
"""
ls = [y/2, y/4, x]
print(ls)
ls.sort()
print(ls)
"""

def search(count, sum):
    #print(count, sum)
    if sum > y or count > x:
        return False
    elif sum == y and count == x:
        print("Yes")
        exit()

    if search(count+1, sum +2):
        return True
    if search(count+1, sum +4):
        return True


    return False
    """
    count += 1
    #鶴
    sum += 2
    search(count, sum)
    #亀
    sum += 4
    search(count, sum)
    """
search(0, 0)

print("No")

Submission status: Time Limit Exceeded

Solution code:

A = list(map(int, input().split()))

turu=[2]*A[0]
kame=[4]*A[0]
import itertools

result="No"
for i in itertools.permutations(turu+kame, A[0]):
  if sum(i)==A[1]:
    result="Yes"
    break
  
print(result)