title: Count Even Length Binary Sequences With Same Sum Of First And Second Half Bits 1
signature: count_even_length_binary_sequences_with_same_sum_of_first_and_second_half_bits_1 <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      abs(actual - expected) < 1e-09
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          25L, 
          126410606437752.0
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          18L, 
          9075135300.0
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          17L, 
          2333606220.0
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          8L, 
          12870.0
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          8L, 
          12870.0
      )))
  
  }
  
  main()
source_py: def count_even_length_binary_sequences_with_same_sum_of_first_and_second_half_bits_1(n):
      nCr = 1
      res = 1
      for r in range(1, (n + 1)):
          nCr = ((nCr * ((n + 1) - r)) / r)
          res += (nCr * nCr)
      return res
source_cpp: int count_even_length_binary_sequences_with_same_sum_of_first_and_second_half_bits_1(int n) {
    int nCr = 1, res = 1;
    for ( int r = 1;
    r <= n;
    r ++ ) {
      nCr = ( nCr * ( n + 1 - r ) ) / r;
      res += nCr * nCr;
    }
    return res;
  }