if a [ i ] is even then all subarrays starting from index i + 1 which was even remains even and one extra a [ i ] even subarray gets added to it .
s = s + 1 NEW_LINE res = res + s NEW_LINE return res NEW_LINE