title: Number Days Tank Will Become Empty
signature: function numberDaysTankWillBecomeEmpty($c, $l) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($c, $l, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($c, $l), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        91, 29, 
        40));
      
      printf("TEST-1...%s\n",driver(
        99, 55, 
        64));
      
      printf("TEST-2...%s\n",driver(
        11, 56, 
        11));
      
      printf("TEST-3...%s\n",driver(
        23, 56, 
        23));
      
      printf("TEST-4...%s\n",driver(
        12, 97, 
        12));
      
      printf("TEST-5...%s\n",driver(
        1, 64, 
        1));
      
      printf("TEST-6...%s\n",driver(
        18, 5, 
        10));
      
      printf("TEST-7...%s\n",driver(
        14, 37, 
        14));
      
      printf("TEST-8...%s\n",driver(
        13, 55, 
        13));
      
      printf("TEST-9...%s\n",driver(
        36, 99, 
        36));
      
  }
  
  main();
  ?>
source_py: def number_days_tank_will_become_empty(C, l):
      if (l >= C):
          return C
      eq_root = ((math.sqrt((1 + (8 * (C - l)))) - 1) / 2)
      return (math.ceil(eq_root) + l)
source_cpp: int number_days_tank_will_become_empty(int C, int l) {
    if ( l >= C ) return C;
    double eq_root = ( std :: sqrt ( 1 + 8 * ( C - l ) ) - 1 ) / 2;
    return std :: ceil ( eq_root ) + l;
  }