title: Integer Positive Value Positive Negative Value Array
signature: integer_positive_value_positive_negative_value_array <- function(arr, n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(1L, 7L, 10L, 14L, 15L, 24L, 27L, 32L, 33L, 38L, 39L, 40L, 42L, 42L, 47L, 58L, 75L, 76L, 78L, 79L, 83L, 85L, 89L, 96L), 18L, 
          1L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-36L, 14L, -76L, -70L, 52L, 18L, 64L), 5L, 
          14L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 17L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(35L, 50L, 36L, 50L, 82L, 54L, 10L, 45L, 13L, 22L, 1L, 41L, 13L, 11L, 4L, 43L, 50L, 27L, 94L, 57L), 15L, 
          35L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-88L, -86L, -84L, -80L, -80L, -74L, -72L, -48L, -46L, -46L, -44L, -34L, -32L, -24L, -22L, -14L, 4L, 4L, 8L, 8L, 10L, 12L, 20L, 20L, 24L, 24L, 24L, 28L, 32L, 34L, 36L, 44L, 46L, 54L, 54L, 60L, 62L, 62L, 62L, 70L, 70L, 80L, 88L, 88L, 90L), 27L, 
          4L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(0L, 0L), 1L, 
          0L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(1L, 1L, 3L, 6L, 6L, 8L, 12L, 13L, 17L, 27L, 28L, 31L, 40L, 40L, 42L, 43L, 53L, 55L, 58L, 60L, 60L, 61L, 65L, 66L, 72L, 72L, 75L, 80L, 84L, 89L, 96L, 97L, 99L), 31L, 
          1L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(52L, -38L, -82L, 30L, -66L, 42L, 54L, -96L, -46L, -30L, 18L, -50L, 96L, 90L, 4L, 74L, -22L, 8L, 34L, 74L, -46L, 8L, -32L, 88L, -96L, 26L, -80L, 50L, 92L, -80L, 44L, 36L), 24L, 
          52L
      )))
  
      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, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 16L, 
          0L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(38L, 20L, 54L, 51L, 11L, 61L, 90L, 28L, 23L, 55L, 65L, 87L, 99L, 70L, 74L, 3L, 68L, 23L, 74L, 53L, 80L, 7L, 57L, 24L, 66L, 8L, 15L, 63L, 18L, 67L, 96L, 31L, 63L, 50L), 30L, 
          38L
      )))
  
  }
  
  main()
source_py: def integer_positive_value_positive_negative_value_array(arr, n):
      hash = dict()
      maximum = 0
      for i in arr:
          if (i < 0):
              if (abs(i) not in hash.keys()):
                  hash[abs(i)] = (- 1)
              else:
                  hash[abs(i)] -= 1
          else:
              hash[i] = (hash.get(i, 0) + 1)
      for i in arr:
          if ((i in hash.keys()) and (hash[i] > 0)):
              return i
      return (- 1)
source_cpp: int integer_positive_value_positive_negative_value_array(vector<int> arr, int n) {
    unordered_map < int, int > hash;
    int maximum = 0;
    for ( int i = 0;
    i < n;
    i ++ ) {
      if ( arr [ i ] < 0 ) hash [ abs ( arr [ i ] ) ] -= 1;
      else hash [ arr [ i ] ] += 1;
    }
    for ( int i = 0;
    i < n;
    i ++ ) if ( hash [ arr [ i ] ] != 0 ) return arr [ i ];
    return - 1;
  }