873 B
Climb
Run my solution on repl.it!
This problem is very basic indeed, a simple while loop with two if statements is all one needs. Perhaps this could be made into an equation, but it's best if your pursue the simpler routes.
I added a if statement inside the while loop to make sure it didn't decrement following the ant reaching the summit of the hill, which would report an extra "climb" operation and a slightly higher distance traversed.
Taking your time on these Competition problems is not what is asked, as these are timed in real competition scenarios, so one should aim to simply solve the test cases, not solve world hunger while you're at it.
This problem is one of those that should be attempted first, to attain easy points immediately before starting difficult to solve problems.