title: Count Numbers Can Constructed Using Two Numbers
signature: count_numbers_can_constructed_using_two_numbers <- function(n, x, y) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, x, y, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n, x, y), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          23L, 16L, 16L, 
          1L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          56L, 95L, 6L, 
          9L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          30L, 63L, 1L, 
          30L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          51L, 89L, 46L, 
          1L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          21L, 99L, 38L, 
          0L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          69L, 63L, 50L, 
          2L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          12L, 69L, 73L, 
          0L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          44L, 52L, 9L, 
          4L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          99L, 65L, 10L, 
          13L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          46L, 58L, 37L, 
          1L
      )))
  
  }
  
  main()
source_py: def count_numbers_can_constructed_using_two_numbers(n, x, y):
      arr = [False for i in range((n + 2))]
      if (x <= n):
          arr[x] = True
      if (y <= n):
          arr[y] = True
      result = 0
      for i in range(min(x, y), (n + 1)):
          if arr[i]:
              if ((i + x) <= n):
                  arr[(i + x)] = True
              if ((i + y) <= n):
                  arr[(i + y)] = True
              result = (result + 1)
      return result
source_cpp: int count_numbers_can_constructed_using_two_numbers(int n, int x, int y) {
    vector < bool > arr ( n + 1, false );
    if ( x <= n ) arr [ x ] = true;
    if ( y <= n ) arr [ y ] = true;
    int result = 0;
    for ( int i = min ( x, y );
    i <= n;
    i ++ ) {
      if ( arr [ i ] ) {
        if ( i + x <= n ) arr [ i + x ] = true;
        if ( i + y <= n ) arr [ i + y ] = true;
        result ++;
      }
    }
    return result;
  }