Count Subarrays with Distant Sums
Count subarrays by turning sums into prefix differences; the ones that land near the goal form a band that is subtracted from the total.
Count subarrays by turning sums into prefix differences; the ones that land near the goal form a band that is subtracted from the total.