title: Find Sum Unique Sub Array Sum Given Array
signature: findSumUniqueSubArraySumGivenArray(arr, n) {
test_code: import 'dart:convert';
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  bool validateSolution(int actual, int expected){
      return actual.toString() == expected.toString();
  }
  
  String driver(arr, n, int expected){
      try
      {
          if (validateSolution(PLACEHOLDER_FN_NAME(arr, n), expected)){
              return "PASSED";
          }
          return "FAILED";
      }catch(exception_object){
          return exception_object.runtimeType.toString();
      }
  }
  
  int main() {
  
      print("TEST-0...${driver(
          [7, 24, 34, 35, 36, 40, 49, 51, 53, 74, 78], 9, 
          5631)
      }");
  
      print("TEST-1...${driver(
          [-34, 60, 32], 2, 
          52)
      }");
  
      print("TEST-2...${driver(
          [0], 0, 
          0)
      }");
  
      print("TEST-3...${driver(
          [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)
      }");
  
      print("TEST-4...${driver(
          [-94, -46, -36, -24, -22, 0, 10, 14, 34, 34, 90, 92, 98], 9, 
          -1638)
      }");
  
      print("TEST-5...${driver(
          [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)
      }");
  
      print("TEST-6...${driver(
          [19, 20, 20, 24, 25, 33, 43, 47, 57, 61, 61, 64, 65, 71, 72, 73, 75, 82, 90, 93, 95], 15, 
          27034)
      }");
  
      print("TEST-7...${driver(
          [-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)
      }");
  
      print("TEST-8...${driver(
          [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], 11, 
          0)
      }");
  
      print("TEST-9...${driver(
          [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)
      }");
  
      return 0;
  }
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;
  }