Problem: 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.

Submission attempts (in order):
import sys
# from collections import deque
# from collections import Counter
# from math import sqrt
# from math import log
# from math import ceil


# 	if(a==0):
# 		return b 




# 	p=2
# 	while(p*p<=n): 



# 		p+=1


# 	s=set()


# 		s.add(i)


# alpha=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
# mod=10**9+7

fast_reader=sys.stdin.readline
fast_writer=sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i)) for i in argv))
	fast_writer('\n')

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

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

#_______________________________________________________________________________________________________________________________________

x,y=sep_input()
l=[]
for i in range(x+1):
	l.append(2*i + 4*(x-i))
	l.append(4*i + 2*(x-i))
s=set(l)
if(y in s):
	print('YES')
else:
	print('NO')

import sys
# from collections import deque
# from collections import Counter
# from math import sqrt
# from math import log
# from math import ceil


# 	if(a==0):
# 		return b 




# 	p=2
# 	while(p*p<=n): 



# 		p+=1


# 	s=set()


# 		s.add(i)


# alpha=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
# mod=10**9+7

fast_reader=sys.stdin.readline
fast_writer=sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i)) for i in argv))
	fast_writer('\n')

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

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

#_______________________________________________________________________________________________________________________________________

x,y=sep_input()
l=[]
for i in range(x):
	l.append(2*i + 4*(x-i))
	l.append(4*i + 2*(x-i))
s=set(l)
if(y in s):
	print('YES')
else:
	print('NO')

import sys
# from collections import deque
# from collections import Counter
# from math import sqrt
# from math import log
# from math import ceil


# 	if(a==0):
# 		return b 




# 	p=2
# 	while(p*p<=n): 



# 		p+=1


# 	s=set()


# 		s.add(i)


# alpha=['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
# mod=10**9+7

fast_reader=sys.stdin.readline
fast_writer=sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i)) for i in argv))
	fast_writer('\n')

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

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

#_______________________________________________________________________________________________________________________________________

x,y=sep_input()
l=[]
for i in range(x+1):
	l.append(2*i + 4*(x-i))
	l.append(4*i + 2*(x-i))
s=set(l)
if(y in s):
	print('Yes')
else:
	print('No')

Verdicts: Wrong Answer

Wrong Answer

Accepted