WA in RECIPE

I am getting WA for the problem link:
[http://www.codechef.com/problems/RECIPE][1]

and here is my solution id [link][2]

Please help me with the problem

Thank you
[1]: http://www.codechef.com/problems/RECIPE
[2]: http://www.codechef.com/viewsolution/3302798

" if(new_gcd != gcd){ flag =1; break; } " this statement is the bug in your code.
consider the test case
1
4 8 16 4 2
apart from that statement every thing is correct. i removed that statement and got accepted.
accepted solution http://www.codechef.com/viewsolution/3313762