<gouthampradhan>array_SubarraySumEqualsK_1.java
public int subarraySum(int[] nums, int k) {
    Map<Integer, Integer> map = new HashMap<>();
    int sum = 0;
    for (int i : nums) {
      sum += i;
      Integer count = map.get(sum);
      if (count == null) {
        map.put(sum, 1);
      } else {
        map.put(sum, count + 1);
      }
    }
    sum = 0;
    int result = 0;
    for (int i : nums) {
      int key = sum + k;
      if (map.containsKey(key)) {
        int count = map.get(key);
        result += count;
      }
      sum += i;
      if (map.containsKey(sum)) {
        int count = map.get(sum);
        if (count - 1 > 0) {
          map.put(sum, count - 1);
        } else {
          map.remove(sum);
        }
      }
    }
    return result;
  }
public int sample_funcname ( int [ ] var_0 , int var_1 ) {
  Map < Integer , Integer > var_5 = new HashMap < > ( ) ;
  int var_7 = 0 ;
  for ( int var_8 : var_0 ) {
    var_7 += var_8 ;
    Integer var_10 = var_5 . get ( var_7 ) ;
    if ( var_10 == null ) {
      var_5 . put ( var_7 , 1 ) ;
    }
    else {
      var_5 . put ( var_7 , var_10 + 1 ) ;
    }
  }
  var_7 = 0 ;
  int var_14 = 0 ;
  for ( int var_8 : var_0 ) {
    int var_15 = var_7 + var_1 ;
    if ( var_5 . containsKey ( var_15 ) ) {
      int var_10 = var_5 . get ( var_15 ) ;
      var_14 += var_10 ;
    }
    var_7 += var_8 ;
    if ( var_5 . containsKey ( var_7 ) ) {
      int var_10 = var_5 . get ( var_7 ) ;
      if ( var_10 - 1 > 0 ) {
        var_5 . put ( var_7 , var_10 - 1 ) ;
      }
      else {
        var_5 . remove ( var_7 ) ;
      }
    }
  }
  return var_14 ;
}
