title: Find Sum Unique Sub Array Sum Given Array
signature: pub fn find_sum_unique_sub_array_sum_given_array(arr: Vec<i32>, n: i32) -> i32 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: i32, expected: i32)->bool{
  return actual==expected
  }
  pub fn driver(arr: Vec<i32>, n: i32, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(arr, n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        Vec::from([7, 24, 34, 35, 36, 40, 49, 51, 53, 74, 78]), 9, 
        5631
      ));
      
      println!("TEST-1...{}", driver(
        Vec::from([-34, 60, 32]), 2, 
        52
      ));
      
      println!("TEST-2...{}", driver(
        Vec::from([0]), 0, 
        0
      ));
      
      println!("TEST-3...{}", driver(
        Vec::from([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-4...{}", driver(
        Vec::from([-94, -46, -36, -24, -22, 0, 10, 14, 34, 34, 90, 92, 98]), 9, 
        -1638
      ));
      
      println!("TEST-5...{}", driver(
        Vec::from([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-6...{}", driver(
        Vec::from([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-7...{}", driver(
        Vec::from([-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-8...{}", driver(
        Vec::from([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]), 11, 
        0
      ));
      
      println!("TEST-9...{}", driver(
        Vec::from([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
      ));
      
  }
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;
  }