title: Sequences Given Length Every Element Equal Twice Previous
signature: class Solution {
  
      public int SequencesGivenLengthEveryElementEqualTwicePrevious(int m, int n) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(int actual, int expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(int m, int n, int expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                int pred_result = solution_cls.PLACEHOLDER_FN_NAME(m, n); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  38, 34, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  39, 29, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  24, 99, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  90, 23, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  44, 2, 
                  484
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  49, 70, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  58, 84, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  97, 34, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  99, 72, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  19, 67, 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  result)
              );
          }
      }
  }
  
source_py: def sequences_given_length_every_element_equal_twice_previous(m, n):
      if (m < n):
          return 0
      if (n == 0):
          return 1
      res = (sequences_given_length_every_element_equal_twice_previous((m - 1), n) + sequences_given_length_every_element_equal_twice_previous((m // 2), (n - 1)))
      return res
source_cpp: int sequences_given_length_every_element_equal_twice_previous(int m, int n) {
    if ( m < n ) return 0;
    if ( n == 0 ) return 1;
    return sequences_given_length_every_element_equal_twice_previous ( m - 1, n ) + sequences_given_length_every_element_equal_twice_previous ( m / 2, n - 1 );
  }