title: Count Strings With Consecutive 1S
signature: long long countStringsWithConsecutive1S(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(long long actual, long long expected){
      return actual == expected;
  }
  
  string driver(int n, long long 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(27, 133703499); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver(13, 7582); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver(33, 8580707127); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver(57, 144114231353829831); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver(51, 2251746497394075); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver(10, 880); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver(1, 0); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
source_py: def count_strings_with_consecutive_1s(n):
      a = ([0] * n)
      b = ([0] * n)
      a[0] = b[0] = 1
      for i in range(1, n):
          a[i] = (a[(i - 1)] + b[(i - 1)])
          b[i] = a[(i - 1)]
      return (((1 << n) - a[(n - 1)]) - b[(n - 1)])
source_cpp: int count_strings_with_consecutive_1s(int n) {
    int a [ n ], b [ n ];
    a [ 0 ] = b [ 0 ] = 1;
    for ( int i = 1;
    i < n;
    i ++ ) {
      a [ i ] = a [ i - 1 ] + b [ i - 1 ];
      b [ i ] = a [ i - 1 ];
    }
    return ( 1 << n ) - a [ n - 1 ] - b [ n - 1 ];
  }