title: Sum Of All Elements Up To Nth Row In A Pascals Triangle
signature: function sumOfAllElementsUpToNthRowInAPascalsTriangle($n) {
test_code: <?php
  
  
  // SOLUTION CODE 
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  function validateSolution($actual, $expected){
      return serialize($actual) == serialize($expected);
  }
  
  function driver($n, $expected){
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME($n), $expected)){
          return "PASSED";
        }
        return "FAILED";
      }
      catch (Exception $exception_obj) {
        return get_class($exception_obj);
      }
  }
  
  function main(){
      printf("TEST-0...%s\n",driver(
        21, 
        2097151));
      
      printf("TEST-1...%s\n",driver(
        4, 
        15));
      
      printf("TEST-2...%s\n",driver(
        31, 
        2147483647));
      
      printf("TEST-3...%s\n",driver(
        38, 
        274877906943));
      
      printf("TEST-4...%s\n",driver(
        36, 
        68719476735));
      
      printf("TEST-5...%s\n",driver(
        32, 
        4294967295));
      
      printf("TEST-6...%s\n",driver(
        23, 
        8388607));
      
  }
  
  main();
  ?>
source_py: def sum_of_all_elements_up_to_nth_row_in_a_pascals_triangle(n):
      sum = 0
      for row in range(n):
          sum = (sum + (1 << row))
      return sum
source_cpp: long long int sum_of_all_elements_up_to_nth_row_in_a_pascals_triangle(int n) {
    long long int sum = 0;
    for ( int row = 0;
    row < n;
    row ++ ) {
      sum = sum + ( 1 << row );
    }
    return sum;
  }