I don't know why his algorithm works. Here is his code below:

```
class Solution {
public:
map<long long, int> bit;
long long lowbit(long long x)
{
return x & (-x);
}
void add(long long x)
{
for(x += (1ll << 34); x <= (1ll << 36); x += lowbit(x))
++bit[x];
}
int que(long long x)
{
int ans = 0;
for(x += (1ll << 34); x; x -= lowbit(x))
ans += bit[x];
return ans;
}
int reversePairs(vector<int>& nums) {
bit.clear();
int n = nums.size();
int ans = 0;
for(int i = n - 1; i >= 0; --i)
{
ans += que((long long) nums[i] - 1ll);
add((long long) nums[i] * 2ll);
}
return ans;
}
};
```