Counting all pairs that differ by k
The logical solution here is to sort the data in order, then scan it looking ahead for the partner that has the right difference to the target. Slicing, and combinations, etc. are not going to be the most efficient algorithm.

A sort with \$O(n \log n)\$ scaling, and a simple 'look ahead' to find a potential pairing, will be much, much faster.

If your data has duplicates, then you will need to look for multiple matches for the correct difference.

Consider doing a binary search for the target value, which will still leave you at an overall performance of \$O(n \log n)\$ algorithm