class NeedForSpeed {
    private int speed;
    private int batteryDrain;
    private int distance = 0;
    private int battery = 100;

    public NeedForSpeed(int speed, int batteryDrain) {
        this.speed = speed;
        this.batteryDrain = batteryDrain;
    }

    public static NeedForSpeed nitro() {
        return new NeedForSpeed(50, 4);
    }

    public boolean batteryDrained() {
        return battery == 0;
    }

    public int distanceDriven() {
        return distance;
    }

    public void drive() {
        if (battery > 0) {
            battery -= batteryDrain;
            distance += speed;
        }
    }
}

class RaceTrack {
    private int distance;

    RaceTrack(int distance) {
        this.distance = distance;
    }

    public boolean tryFinishTrack(NeedForSpeed car) {
        while (!car.batteryDrained()) {
            car.drive();
        }
        return car.distanceDriven() >= this.distance;
    }
}

@@ -414,12 +414,22 @@
 ery 
-== 0
+%3C batteryDrain
 ;%0A  
@@ -541,19 +541,25 @@
 if (
+!
 battery
- %3E 0
+Drained()
 ) %7B%0A
@@ -834,32 +834,127 @@
 le (
-!car.batteryDrained()) %7B
+car.distanceDriven() %3C distance) %7B%0A            if (car.batteryDrained()) %7B%0A                return false;%0A            %7D%0A
 %0A   
@@ -981,24 +981,25 @@
 ;%0A        %7D%0A
+%0A
         retu
@@ -1005,44 +1005,11 @@
 urn 
-car.distanceDriven() %3E= this.distanc
+tru
 e;%0A 

update reference solution (#2149)