Loop to iterate over every possible subarray of array
for i in range ( n - 1 ) : NEW_LINE INDENT tmpsum = arr [ i ] NEW_LINE for j in range ( i + 1 , n ) : NEW_LINE INDENT tmpsum += arr [ j ] NEW_LINE if tmpsum in freq : NEW_LINE INDENT ans += freq [ tmpsum ] NEW_LINE DEDENT DEDENT DEDENT return ans NEW_LINE