Determine whether a car can get around a route with a limited amount of gas
Bash 178 170 161 157
Rather straight forward.
is_enough(){((t=(n=$1-1)&lt;0))&amp;&amp;echo impossible||(x=(n ${@:3} $2);for z in ${@:2};do(((t+=${z%:*}-${z#*:})&lt;0))&amp;&amp;is_enough ${x[*]}&amp;&amp;return;done;echo $[$#-++n])}

Spaced out:
is_enough() {
     ((t=(n=$1-1)&lt;0)) &amp;&amp; echo impossible || (
         x=(n ${@:3} $2);
         for z in ${@:2};do
             (((t+=${z%:*}-${z#*:})&lt;0)) &amp;&amp; is_enough ${x[*]} &amp;&amp; return;
         done;
         echo $[$#-++n]
     )
}