5 3 1 2 1 2 1
There are four contiguous subarrays with total 3: positions 1..2, 2..3, 3..4, and 4..5.
4
4 0 0 0 0 0
Every non-empty contiguous subarray has total 0, so all 10 subarrays count.
10
6 -1 2 -3 1 -1 2 -2
The six qualifying segments are 1..2, 1..4, 1..6, 2..5, 4..4, and 4..6.
6
Given an array of integers and a target value kkk, count the number of non-empty contiguous subarrays whose sum is exactly kkk.