Donghyuk stands at the origin (0,0) of an infinitely large plane.
He moves toward (x,y) one step at a time. Steps are numbered from 0, and the number goes up by 1 after each finished step.
On step k he picks one of two directions, right (the direction in which x grows) or up (the direction in which y grows), and moves exactly 3k in the direction he picked. He cannot stay in place and he cannot skip a step.
Once he arrives at (x,y) he stops there. Given x and y, write a program that decides whether he can reach (x,y) starting from (0,0).