title: Pair With Given Product Set 1 Find If Any Pair Exists 1
signature: pair_with_given_product_set_1_find_if_any_pair_exists_1 <- function(arr, n, x) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, x, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n, x), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(1L, 2L, 3L, 7L, 23L, 23L, 25L, 27L, 37L, 42L, 53L, 56L, 58L, 61L, 69L, 78L, 79L, 84L, 85L, 86L, 90L, 93L, 95L), 15L, 17L, 
          FALSE
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-10L, -18L, 88L, -36L, 78L, 66L, -70L, -34L, -88L, -98L, -70L, -4L, -94L, -92L, -76L, -78L, -30L, -48L, -72L, 86L, -64L, 38L, -80L, 20L, 70L, -32L, -90L, 74L, -78L, 12L, -54L, 88L, 38L, -96L, 28L), 17L, 22L, 
          FALSE
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L), 9L, 5L, 
          FALSE
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(83L, 61L, 55L, 89L, 16L, 78L, 44L, 54L, 22L, 49L, 58L, 62L, 53L, 99L, 35L, 83L, 29L, 19L, 96L, 39L, 60L, 6L, 34L, 67L, 43L, 29L, 46L, 3L, 81L, 78L, 80L, 39L, 86L, 78L, 21L), 23L, 27L, 
          FALSE
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-96L, -88L, -80L, -62L, -58L, -56L, -54L, -52L, -34L, -20L, -6L, -2L, 6L, 20L, 52L, 54L, 70L, 72L, 80L, 82L, 94L), 18L, 12L, 
          TRUE
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 1L, 1L, 0L, 0L, 1L, 1L, 1L), 4L, 6L, 
          FALSE
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(8L, 11L, 11L, 20L, 22L, 23L, 26L, 27L, 31L, 38L, 40L, 40L, 45L, 46L, 46L, 48L, 50L, 61L, 73L, 76L, 78L, 78L, 79L, 80L, 81L, 84L, 90L, 91L, 93L, 95L), 24L, 28L, 
          FALSE
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(18L), 0L, 0L, 
          FALSE
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 37L, 39L, 
          FALSE
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(19L, 37L, 47L, 40L, 72L, 59L, 51L, 53L, 92L, 3L, 21L, 81L, 29L, 48L, 97L, 59L, 10L, 74L, 11L, 37L, 49L, 95L, 88L, 85L, 6L, 26L, 76L, 33L), 22L, 21L, 
          FALSE
      )))
  
  }
  
  main()
source_py: def pair_with_given_product_set_1_find_if_any_pair_exists_1(arr, n, x):
      if (n < 2):
          return False
      s = set()
      for i in range(0, n):
          if (arr[i] == 0):
              if (x == 0):
                  return True
              else:
                  continue
          if ((x % arr[i]) == 0):
              if ((x // arr[i]) in s):
                  return True
              s.add(arr[i])
      return False
source_cpp: bool pair_with_given_product_set_1_find_if_any_pair_exists_1(vector<int> arr, int n, int x) {
    if ( n < 2 ) return false;
    unordered_set < int > s;
    for ( int i = 0;
    i < n;
    i ++ ) {
      if ( arr [ i ] == 0 ) {
        if ( x == 0 ) return true;
        else continue;
      }
      if ( x % arr [ i ] == 0 ) {
        if ( s . find ( x / arr [ i ] ) != s . end ( ) ) return true;
        s . insert ( arr [ i ] );
      }
    }
    return false;
  }