human
Check if it is possible to reach ( X , Y ) from origin such that in each ith move increment x or y coordinate with 3 ^ i | Function to find whether ( 0 , 0 ) can be reached from ( X , Y ) by decrementing 3 ^ i at each ith step.
Termination Condition.
Otherwise , recursively call by decrementing 3 ^ i at each step.
Driver Code"
How can the above be solved in Python?
 Write me a code to check if it is possible to reach ( X , Y ) from origin such that in each ith move increment x or y coordinate with 3 ^ i and the other steps required?
assistant
#Here is code to check if it is possible to reach ( X , Y ) from origin such that in each ith move increment x or y coordinate with 3 ^ i and the other steps required.
 def canReach ( X , Y , steps ) :
	if ( X == 0 and Y == 0 ) :
		return True
	if ( X < 0 or Y < 0 ) :
		return False
	return ( canReach ( X - int ( pow ( 3 , steps ) ) , Y , steps + 1 ) | canReach ( X , Y - int ( pow ( 3 , steps ) ) , steps + 1 ) )
if __name__ == ' _ _ main _ _ ' :
	X = 10
	Y = 30
	if ( canReach ( X , Y , 0 ) ) :
		print ( " YES " )
	else :
		print ( " NO " )