What is the difference

Someone help, why one is wrong and other is correct, question from november lunch time

question :- https://www.codechef.com/problems/GASOLINE

wrong sub :- https://www.codechef.com/viewsolution/39893063

correct sub :- https://www.codechef.com/viewsolution/39893073