Problem with IDE

with the input:-
1
9
10 20 30 40 50 60 70 80 90

i got two different ans in codechef IDE and JDoodle compiler.

here’s my solution link:-
https://www.codechef.com/viewsolution/24454773