title: Count Numbers Can Constructed Using Two Numbers
signature: int countNumbersCanConstructedUsingTwoNumbers(int n, int x, int y) {
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(int actual, int expected){
      return actual == expected;
  }
  
  string driver(int n, int x, int y, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(n, x, y), 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(23, 16, 16, 1); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver(56, 95, 6, 9); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver(30, 63, 1, 30); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver(51, 89, 46, 1); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver(21, 99, 38, 0); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver(69, 63, 50, 2); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver(12, 69, 73, 0); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver(44, 52, 9, 4); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver(99, 65, 10, 13); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver(46, 58, 37, 1); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
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;
  }