Company: Sigmoid
Difficulty: easy
Subarray Sum Triplets You are given an array of N integers. Count the subarrays of size exactly 3 in which the sum of the first element and the third element equals the second element. A subarray is a continuous part of the array. In other words, count the positions i for which the three consecutive elements A[i] , A[i+1] , A[i+2] satisfy A[i] + A[i+2] = A[i+1] . Input Format The first line contains a single integer N — the number of elements in the array. The second line contains N space-separated integers — the elements of the array. (inferred — the source lists input1 as the array and input2 as N but gives no stdin layout; the house convention of a size line followed by a data line is used, so N is read first) Output Format Print a single integer — the number of subarrays of size 3 in which the first element plus the third element equals the second element. Constraints 1 <= N <= 10^5 (inferred — the source states no bounds; this size keeps the input inside the judge's 200 KB s