title: Find Sum Unique Sub Array Sum Given Array
signature: fun findSumUniqueSubArraySumGivenArray(arr: ArrayList<Int>, n: Int): Int {
source_py: def find_sum_unique_sub_array_sum_given_array(arr, n):
      res = 0
      m = dict()
      for i in range(n):
          Sum = 0
          for j in range(i, n):
              Sum += arr[j]
              m[Sum] = (m.get(Sum, 0) + 1)
      for x in m:
          if (m[x] == 1):
              res += x
      return res
source_cpp: long long int find_sum_unique_sub_array_sum_given_array(vector<int> arr, int n) {
    int res = 0;
    unordered_map < int, int > m;
    for ( int i = 0;
    i < n;
    i ++ ) {
      int sum = 0;
      for ( int j = i;
      j < n;
      j ++ ) {
        sum += arr [ j ];
        m [ sum ] ++;
      }
    }
    for ( auto x : m ) if ( x . second == 1 ) res += x . first;
    return res;
  }
question_info.test_list: [{"idx": 0, "outputs": 5631, "inputs": {"arr": [7, 24, 34, 35, 36, 40, 49, 51, 53, 74, 78], "n": 9}}, {"idx": 1, "outputs": 52, "inputs": {"arr": [-34, 60, 32], "n": 2}}, {"idx": 2, "outputs": 0, "inputs": {"arr": [0], "n": 0}}, {"idx": 3, "outputs": 207596, "inputs": {"arr": [80, 64, 10, 82, 14, 75, 51, 91, 1, 25, 98, 22, 36, 27, 21, 31, 93, 6, 52, 91, 80, 8, 62, 95, 10, 71, 40, 80, 35, 86, 85, 26, 74, 72, 64, 88, 4, 71, 4, 16], "n": 31}}, {"idx": 4, "outputs": -1638, "inputs": {"arr": [-94, -46, -36, -24, -22, 0, 10, 14, 34, 34, 90, 92, 98], "n": 9}}, {"idx": 5, "outputs": 0, "inputs": {"arr": [1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1], "n": 21}}, {"idx": 6, "outputs": 27034, "inputs": {"arr": [19, 20, 20, 24, 25, 33, 43, 47, 57, 61, 61, 64, 65, 71, 72, 73, 75, 82, 90, 93, 95], "n": 15}}, {"idx": 7, "outputs": 1698, "inputs": {"arr": [-6, 56, 58, -36, 70, -92, 30, 58, -40, 98, 80, -96, -4, -88, 34, 76, 40, -32, -94, -26, 8, 72, -56, -96, -88, -24, 36, 14, -88, -32, 90, 4, -88, 28, 18], "n": 24}}, {"idx": 8, "outputs": 0, "inputs": {"arr": [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "n": 11}}, {"idx": 9, "outputs": 267019, "inputs": {"arr": [91, 51, 15, 78, 55, 3, 10, 24, 42, 84, 66, 78, 10, 41, 21, 53, 69, 57, 20, 22, 50, 72, 8, 80, 12, 91, 29, 95, 38, 74, 95, 26, 10, 57, 51, 25, 49, 74, 15, 42, 99, 21, 27], "n": 36}}]
question_info.extension: kts
question_info.test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(arr: ArrayList<Int>, n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(arr, n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(arrayListOf(7, 24, 34, 35, 36, 40, 49, 51, 53, 74, 78), 9, 5631)
      println("TEST-0...${result}")
      
      result = driver(arrayListOf(-34, 60, 32), 2, 52)
      println("TEST-1...${result}")
      
      result = driver(arrayListOf(0), 0, 0)
      println("TEST-2...${result}")
      
      result = driver(arrayListOf(80, 64, 10, 82, 14, 75, 51, 91, 1, 25, 98, 22, 36, 27, 21, 31, 93, 6, 52, 91, 80, 8, 62, 95, 10, 71, 40, 80, 35, 86, 85, 26, 74, 72, 64, 88, 4, 71, 4, 16), 31, 207596)
      println("TEST-3...${result}")
      
      result = driver(arrayListOf(-94, -46, -36, -24, -22, 0, 10, 14, 34, 34, 90, 92, 98), 9, -1638)
      println("TEST-4...${result}")
      
      result = driver(arrayListOf(1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1), 21, 0)
      println("TEST-5...${result}")
      
      result = driver(arrayListOf(19, 20, 20, 24, 25, 33, 43, 47, 57, 61, 61, 64, 65, 71, 72, 73, 75, 82, 90, 93, 95), 15, 27034)
      println("TEST-6...${result}")
      
      result = driver(arrayListOf(-6, 56, 58, -36, 70, -92, 30, 58, -40, 98, 80, -96, -4, -88, 34, 76, 40, -32, -94, -26, 8, 72, -56, -96, -88, -24, 36, 14, -88, -32, 90, 4, -88, 28, 18), 24, 1698)
      println("TEST-7...${result}")
      
      result = driver(arrayListOf(0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 11, 0)
      println("TEST-8...${result}")
      
      result = driver(arrayListOf(91, 51, 15, 78, 55, 3, 10, 24, 42, 84, 66, 78, 10, 41, 21, 53, 69, 57, 20, 22, 50, 72, 8, 80, 12, 91, 29, 95, 38, 74, 95, 26, 10, 57, 51, 25, 49, 74, 15, 42, 99, 21, 27), 36, 267019)
      println("TEST-9...${result}")
      
          
  }
  
  main()
question_info.entry_fn_name: findSumUniqueSubArraySumGivenArray
question_info.entry_cls_name: Solution
question_info.test_case_ids: 0 1 2 3 4 5 6 7 8 9
question_info.commands: kotlinc -script __FILENAME__ -no-reflect -nowarn