Code for problem "gas station".