title: Integer Positive Value Positive Negative Value Array 1
signature: class Solution {
  
      public decimal IntegerPositiveValuePositiveNegativeValueArray1(List<int> arr, int n) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(decimal actual, decimal expected){
              return Math.Abs(actual - expected) < 1e-09m;
          }
  
          public string driver(List<int> arr, int n, decimal expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                decimal pred_result = solution_cls.PLACEHOLDER_FN_NAME(arr, n); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  new List<int>{49, 98}, 1, 
                  49.0m
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{82, 66, -68, 24, -10}, 2, 
                  74.0m
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1}, 8, 
                  0.125m
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{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.72m
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{-94, -94, -92, -86, -50, -48, -6, 8, 28, 40, 44, 58, 62, 72, 94}, 12, 
                  -146.0m
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{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.5833333333333334m
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{16, 56, 56}, 1, 
                  16.0m
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{74, -90, -92, 30, -18, 66, -66, 22}, 5, 
                  -96.0m
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, 7, 
                  0.5714285714285714m
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  new List<int>{21, 64, 82, 78, 30, 34, 35}, 5, 
                  55.0m
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  result)
              );
          }
      }
  }
  
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 ) );
  }