def window_combinations_indices(size, window_size):
    """ Yields all pairs of indices of a sequence of length `size` which are within a window
		of size `window_size`.

		Example:
			window_combinations_indices(3, 2) -> (0, 1), (1, 2)
			window_combinations_indices(4, 3) -> (0, 1), (0, 2), (1, 2), (1, 3), (2, 3)
	"""
    if window_size > size:
        raise ValueError('window size cannot exceed size')
    for a in range(0, size - 1):
        end = min(a + window_size, size)
        for b in range(a + 1, end):
            yield a, b
