Write a function `reverse_pairs(nums)` that returns the number of pairs (i, j) with 0 <= i < j < len(nums) such that `nums[i] > 2 * nums[j]`.
Your solution must run in O(n log n) time using a merge-sort or sorting + two-pointer approach. Do not use a naive O(n^2) double loop.
Function signature: `def reverse_pairs(nums: list) -> int:`
The list may contain up to 50,000 integers. The integers can be positive, negative, or zero. The result fits within a 64-bit signed integer.
Constraints
Input: a list of integers. Length n satisfies 0 <= n <= 50,000. Each integer is in the range [-10^9, 10^9]. Output: an integer count.
Complexity: O(n log n) time, O(n) extra space.