title: Pair With Given Product Set 1 Find If Any Pair Exists
signature: bool pairWithGivenProductSet1FindIfAnyPairExists(vector<int> arr, int n, int x) {
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(bool actual, bool expected){
      return actual == expected;
  }
  
  string driver(vector<int> arr, int n, int x, bool expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(arr, n, x), 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({10, 20, 9, 40}, 4, 400, true); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver({1, -10, 20, 9, -40}, 5, 400, true); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver({0, 0, 0, 0, 0, 1, 1, 1, 1}, 7, 8, false); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver({4, 10, 20, 9, -40}, 5, -400, true); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver({-90, -86, -76, -72, -70, -62, -56, -50, -18, -12, -10, 4, 16, 26, 42, 48, 52, 54, 54, 70, 84, 86, 88, 98}, 23, 23, false); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver({1}, 0, 0, false); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver({4, 7, 14, 14, 16, 18, 19, 20, 22, 24, 29, 38, 38, 38, 40, 40, 46, 46, 47, 51, 51, 52, 55, 56, 56, 62, 62, 62, 78, 79, 81, 84, 86, 88, 89, 89, 89}, 23, 32, false); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver({72, 80, -82, 24, -98, 90, -32, -56, -22, 8, -12, 8, -78, 60, -62, 50, 12, -60, 10, -54, 74, 98, 26, 56, 24}, 21, 19, false); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver({0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 22, 18, false); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver({93, 40, 48, 99, 95, 59, 43, 58, 79, 70, 28}, 9, 5, false); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
source_py: def pair_with_given_product_set_1_find_if_any_pair_exists(arr, n, x):
      for i in arr:
          for j in arr:
              if ((i * j) == x):
                  return True
      return False
source_cpp: bool pair_with_given_product_set_1_find_if_any_pair_exists(vector<int> arr, int n, int x) {
    for ( int i = 0;
    i < n - 1;
    i ++ ) for ( int j = i + 1;
    i < n;
    i ++ ) if ( arr [ i ] * arr [ j ] == x ) return true;
    return false;
  }