507 - Jill Rides Again (solve without function)

be aware with 
if(temp>max || (temp==max && temp_end-temp_start>max_end-max_start)){
                max = temp;
                max_start = temp_start;
                max_end = temp_end;

            }