How to Solve GCD and LCM codechef problem