title: Sum Subsets Set Formed First N Natural Numbers
signature: double sumSubsetsSetFormedFirstNNaturalNumbers(int n) {
test_code: #include <algorithm>
  #include <assert.h>
  #include <cstdlib>
  #include <iostream>
  #include <map>
  #include <set>
  #include <string>
  #include <tuple> 
  #include <unordered_map>
  #include <vector>
  #include <math.h>
  #include <cmath>
  #include <bits/stdc++.h>
  #include <numeric>
  #include <functional>
  
  using namespace std;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(double actual, double expected){
      return abs(actual - expected) < 1e-09;
  }
  
  string driver(int n, double expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }
      catch (const std::overflow_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::runtime_error& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (const std::exception& exception_obj)
      {
          return typeid(exception_obj).name();
      }
      catch (...)
      {
          return "UNK_ERROR";
      }
  }
  
  int main() {
      string result = "";
  
      result = driver(26, 11777605632.0); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver(35, 10823317585920.0); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver(34, 5111011082240.0); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver(22, 530579456.0); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver(3, 24.0); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver(25, 5452595200.0); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver(22, 530579456.0); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
source_py: def sum_subsets_set_formed_first_n_natural_numbers(n):
      return (((n * (n + 1)) / 2) * (1 << (n - 1)))
source_cpp: unsigned long long sum_subsets_set_formed_first_n_natural_numbers(int n) {
    return ( n * ( n + 1 ) / 2 ) * ( 1 << ( n - 1 ) );
  }