For indices i < j in nums, call the pair bad when the index difference j - i differs from the value difference nums[j] - nums[i]. Return the number of bad pairs. The answer can exceed the range of a signed 32-bit integer.
Example 1:
Input: nums = [1]
Output: 0Explanation: One entry cannot form a pair of indices, so there are no bad pairs.
Example 2:
Input: nums = [1,1]
Output: 1Explanation: For the only pair (0, 1), the index difference is 1 but the value difference is 0. The pair is bad.
Example 3:
Input: nums = [1,2]
Output: 0Explanation: For the only pair (0, 1), both the index difference and the value difference are 1. The pair is not bad.
Constraints:
1 <= nums.length <= 1000001 <= nums[i] <= 1000000000