Getting wrong answer despite correct output

whats wrong in this solution … its running fine and producing correct output but when i submit it says wrong answer…
my solution - https://www.codechef.com/viewsolution/26740331

The constraint for A[i] in the problem is 10^9 but in your program, you use int for declaring the array ‘a’, which is not sufficient to hold big values.
Edit: I guess you found the error yourself; just saw your correct submission done 20 mins ago.