Score : $400$ points
Given is a sequence of length $N$: $A=(A_1,A_2,\ldots,A_N)$, and an integer $K$.
How many of the contiguous subsequences of $A$ have the sum of $K$?
In other words, how many pairs of integers $(l,r)$ satisfy all of the conditions below?
Input is given from Standard Input in the following format:
$N$ $K$ $A_1$ $A_2$ $\ldots$ $A_N$
Print the answer.
6 5 8 -3 5 7 0 -4
3
$(l,r)=(1,2),(3,3),(2,6)$ are the three pairs that satisfy the conditions.
2 -1000000000000000 1000000000 -1000000000
0
There may be no pair that satisfies the conditions.