SUMAGCD easiest Editorial

what’s going wrong with this code.
https://www.codechef.com/viewsolution/24812318

please provide input to fail this solution
https://www.codechef.com/viewsolution/24862289

It’s better that you should explain your code as it is very hard to understand the approach