My solution for GCD Game problem at HackerEarth. With printf statements added for ease. Remove them before submitting it on HackerEarth