Simple || Just find the loss at each transaction and add it to the max-amount
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    long long minimumMoney(vector<vector<int>>& transactions)\n    {\n        long long loss=0;\n        int ans=0;\n        for(int i=0;i<transactions.size();i++)\n        {\n            if(transactions[i][0]>transactions[i][1])\n            {\n                loss+=transactions[i][0]-transactions[i][1];\n                ans=max(ans,transactions[i][1]);\n            }\n            else\n            {\n                ans=max(ans,transactions[i][0]);\n            }\n        }\n        return loss+(long long)ans;\n    }\n};\n```
['Array', 'Greedy', 'Sorting', 'C++']