[C++] 6-liner, O(n)
\n    long long minimumMoney(vector<vector<int>>& txn)\n    {\n        long long sumDelta = 0, biggestGain = 0;\n        for(vector<int>&v : txn)\n        {\n  
```\n    long long minimumMoney(vector<vector<int>>& txn)\n    {\n        long long sumDelta = 0, biggestGain = 0;\n        for(vector<int>&v : txn)\n        {\n            long long delta = max(0, v[0] - v[1]);\n            sumDelta += delta;  \n            biggestGain = max(biggestGain, -delta + v[0]);\n        }\n        return biggestGain + sumDelta;\n    }\n```
[]