title: Integer Positive Value Positive Negative Value Array 1
signature: double integerPositiveValuePositiveNegativeValueArray1(vector<int> arr, int n) {
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(double actual, double expected){
      return abs(actual - expected) < 1e-09;
  }
  
  string driver(vector<int> arr, int n, double expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(arr, n), 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({49, 98}, 1, 49.0); 
      cout << "TEST-" << 0 << "..."
           <<  result
           << "\n";
  
      result = driver({82, 66, -68, 24, -10}, 2, 74.0); 
      cout << "TEST-" << 1 << "..."
           <<  result
           << "\n";
  
      result = driver({0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1}, 8, 0.125); 
      cout << "TEST-" << 2 << "..."
           <<  result
           << "\n";
  
      result = driver({56, 3, 18, 5, 20, 56, 47, 29, 60, 98, 60, 40, 42, 2, 54, 56, 91, 8, 93, 14, 31, 27, 61, 49, 23, 12, 71}, 25, 41.72); 
      cout << "TEST-" << 3 << "..."
           <<  result
           << "\n";
  
      result = driver({-94, -94, -92, -86, -50, -48, -6, 8, 28, 40, 44, 58, 62, 72, 94}, 12, -146.0); 
      cout << "TEST-" << 4 << "..."
           <<  result
           << "\n";
  
      result = driver({0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1}, 36, 0.5833333333333334); 
      cout << "TEST-" << 5 << "..."
           <<  result
           << "\n";
  
      result = driver({16, 56, 56}, 1, 16.0); 
      cout << "TEST-" << 6 << "..."
           <<  result
           << "\n";
  
      result = driver({74, -90, -92, 30, -18, 66, -66, 22}, 5, -96.0); 
      cout << "TEST-" << 7 << "..."
           <<  result
           << "\n";
  
      result = driver({0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 7, 0.5714285714285714); 
      cout << "TEST-" << 8 << "..."
           <<  result
           << "\n";
  
      result = driver({21, 64, 82, 78, 30, 34, 35}, 5, 55.0); 
      cout << "TEST-" << 9 << "..."
           <<  result
           << "\n";
  
      return 0;
  }
source_py: def integer_positive_value_positive_negative_value_array_1(arr, n):
      neg = 0
      pos = 0
      sum = 0
      for i in range(0, n):
          sum += arr[i]
          if (arr[i] < 0):
              neg += 1
          else:
              pos += 1
      return (sum / abs((neg - pos)))
source_cpp: int integer_positive_value_positive_negative_value_array_1(vector<int> arr, int n) {
    int neg = 0, pos = 0;
    int sum = 0;
    for ( int i = 0;
    i < n;
    i ++ ) {
      sum += arr [ i ];
      if ( arr [ i ] < 0 ) neg ++;
      else pos ++;
    }
    return ( sum / abs ( neg - pos ) );
  }