I know it is a little funny but i get tle in this problem. my code works normal in ideone and in my computer.Here's my code:
AC :D
personally i think it should not be a tle.
I certainly know it should be TLE. Look at the complexity of your GCD function. What would be the worst possible input for it?
@leppy: thanks a lot! AC! i usually use that function to find gcd and i haven't met any problem before this. learned something and once again thanks