Select the Smallest Cross-Array Pair Sums. From two nondecreasing integer arrays nums1 and nums2, return k pairs [nums1[i],nums2[j]] having the smallest sums.
### Problem
From two nondecreasing integer arrays nums1 and nums2, return k pairs [nums1[i],nums2[j]] having the smallest sums. Distinct index pairs count separately even if their values coincide. The source does not define tie-breaking between equal sums.
```cpp
class Solution {
public:
vector<vector<int>> kSmallestPairs(vector<int>& nums1, vector<int>& nums2, int k);
};
```
### Examples
```text
nums1 = [0,3], nums2 = [1,4], k = 3 -> [[0,1],[0,4],[3,1]]
nums1 = [2,2], nums2 = [-1], k = 2 -> [[2,-1],[2,-1]]
```
### Constraints
- Both lengths are 1 through 100000; both arrays are sorted nondecreasingly.
- Values lie in [-1000000000,1000000000].
- 1 <= k <= 10000 and k <= nums1.length*nums2.length.
### Clarifying Questions
Count index-pair occurrences, retain ties without inventing a mandatory tie rule, and avoid constructing the full Cartesian product.
```hint Inspect the contract
For one fixed first-array index, in what order do its sums occur?
```
### What a Strong Answer Covers
Count index-pair occurrences, retain ties without inventing a mandatory tie rule, and avoid constructing the full Cartesian product.
### Follow-up Questions
How should equal-valued pairs from different index choices be counted?
Overview: Select the Smallest Cross-Array Pair Sums. From two nondecreasing integer arrays nums1 and nums2, return k pairs [nums1[i],nums2[j]] having the smallest sums.
From two nondecreasing integer arrays nums1 and nums2, return k pairs [nums1[i],nums2[j]] having the smallest sums. Distinct index pairs count separately even if their values coincide. The source does not define tie-breaking between equal sums.
class Solution {
public:
vector<vector<int>> kSmallestPairs(vector<int>& nums1, vector<int>& nums2, int k);
};