title: Number Days Tank Will Become Empty
signature: func numberDaysTankWillBecomeEmpty(c int, l int) int {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual int, expected int) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(c int, l int, expected int) string {
      if validateSolution(PLACEHOLDER_FN_NAME(c, l),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(91, 
  	29, 40)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(99, 
  	55, 64)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(11, 
  	56, 11)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(23, 
  	56, 23)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(12, 
  	97, 12)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(1, 
  	64, 1)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(18, 
  	5, 10)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(14, 
  	37, 14)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(13, 
  	55, 13)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(36, 
  	99, 36)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
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;
  }