Calculating difference statistics over a moving window
You've already made the key observation here, which is that most of the work is redone. Each time you pick a window, most of the calculations are the same as the previous window.

In fact it's much faster to do all the calculations ahead of time into one big ndarray, and then for each window, pick out the calculations that are relevant. So we don't need the temporary a and b lists.

How many dimensions do we need? Just starting point and length. It's going to be a triangular array, so we'll waste some space.

precomputed_results = np.zeros(l_win+1, l_data), dtype = int)
# First pass
for interval in range(1, l_win):
    for first_point_index in range(l_data-interval): 
        # compute diff relative to elements [first_point_index] and [first_point_index+interval]
        # line will be similar to precomputed_results[...] = ...

# Second pass
for interval in range(1, l_win):
    for first_point_index in range(l_data-interval):
        # use slicing on precomputed_results