title: Count Pairs Two Sorted Arrays Whose Sum Equal Given Value X
signature: count_pairs_two_sorted_arrays_whose_sum_equal_given_value_x <- function(arr1, arr2, m, n, x) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr1, arr2, m, n, x, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr1, arr2, m, n, x), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(11L, 13L, 16L, 23L, 26L, 28L, 31L, 34L, 37L, 39L, 44L, 48L, 56L, 59L, 79L, 91L, 96L, 98L), list(1L, 1L, 9L, 14L, 17L, 23L, 26L, 31L, 33L, 36L, 53L, 60L, 71L, 75L, 76L, 84L, 87L, 88L), 9L, 15L, 11L, 
          0L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(50L, 14L, -98L, 14L, 90L, 36L, 66L, 44L, 10L, -98L, -24L, -36L, -32L, -50L), list(34L, -6L, -66L, 0L, -6L, 82L, 60L, -98L, -8L, 60L, -2L, 4L, 22L, 76L), 11L, 12L, 8L, 
          5L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 14L, 9L, 12L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(88L, 14L, 29L, 87L, 86L, 58L), list(91L, 95L, 64L, 4L, 63L, 35L), 3L, 5L, 5L, 
          0L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-98L, -92L, -88L, -86L, -82L, -76L, -72L, -66L, -56L, -48L, -34L, -28L, -28L, -26L, -20L, -18L, -18L, -16L, -16L, -12L, -4L, 0L, 6L, 12L, 16L, 20L, 22L, 30L, 34L, 34L, 36L, 56L, 58L, 62L, 64L, 80L, 82L, 94L), list(-94L, -90L, -88L, -84L, -82L, -78L, -76L, -72L, -70L, -58L, -58L, -46L, -42L, -40L, -40L, -32L, -22L, -20L, -18L, -12L, -8L, -6L, 6L, 6L, 18L, 20L, 34L, 46L, 60L, 62L, 66L, 72L, 72L, 76L, 76L, 78L, 92L, 98L), 34L, 32L, 23L, 
          0L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 1L, 1L, 0L, 0L), list(1L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L), 39L, 26L, 34L, 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(70L, 70L, 74L), list(15L, 55L, 84L), 1L, 1L, 1L, 
          0L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(-20L, -12L, -50L, 76L, 24L, 64L, -22L, -4L, -68L), list(18L, 98L, -88L, 86L, 72L, -44L, 82L, 94L, 58L), 5L, 4L, 7L, 
          0L
      )))
  
      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, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 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), 27L, 26L, 37L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(68L, 75L, 51L, 45L, 73L, 95L, 48L, 53L, 70L, 41L, 65L, 47L, 46L, 43L, 79L, 29L, 50L), list(4L, 6L, 76L, 65L, 16L, 13L, 85L, 43L, 31L, 14L, 81L, 90L, 24L, 87L, 40L, 25L, 88L), 10L, 10L, 9L, 
          0L
      )))
  
  }
  
  main()
source_py: def count_pairs_two_sorted_arrays_whose_sum_equal_given_value_x(arr1, arr2, m, n, x):
      count = 0
      for i in range(m):
          for j in range(n):
              if ((arr1[i] + arr2[j]) == x):
                  count = (count + 1)
      return count
source_cpp: int count_pairs_two_sorted_arrays_whose_sum_equal_given_value_x(vector<int> arr1, vector<int> arr2, int m, int n, int x) {
    int count = 0;
    for ( int i = 0;
    i < m;
    i ++ ) for ( int j = 0;
    j < n;
    j ++ ) if ( ( arr1 [ i ] + arr2 [ j ] ) == x ) count ++;
    return count;
  }