title: Number Days Tank Will Become Empty
signature: number_days_tank_will_become_empty <- function(c, l) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(c, l, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(c, l), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          91L, 29L, 
          40L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          99L, 55L, 
          64L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          11L, 56L, 
          11L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          23L, 56L, 
          23L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          12L, 97L, 
          12L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          1L, 64L, 
          1L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          18L, 5L, 
          10L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          14L, 37L, 
          14L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          13L, 55L, 
          13L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          36L, 99L, 
          36L
      )))
  
  }
  
  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;
  }