A intuitive solution in C++
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```cpp []\nclass Solution {\npublic:\n    int getNumberOfBacklogOrders(vector<vector<int>>& orders) {\n        int MOD = 1e9 + 7;\n        priority_queue<pair<int, int>> buys;\n        priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> sells;\n        for (auto & order : orders) {\n            int price = order[0], amount = order[1], type = order[2];\n            if (type == 0) {\n                while (amount > 0 && !sells.empty() && sells.top().first <= price) {\n                   int sellPrice = sells.top().first, sellAmount = sells.top().second;\n                    if (sellAmount > amount) {\n                        sells.pop();\n                        sells.push({sellPrice, sellAmount - amount});\n                        amount = 0;\n                        \n                    } else {\n                        amount -= sellAmount;\n                        sells.pop();\n                    }\n                }\n                if (amount > 0) {\n                    buys.push({price, amount});\n                }\n            } else {\n                while (amount > 0 && !buys.empty() && buys.top().first >= price) {\n                    int buyPrice = buys.top().first, buyAmount = buys.top().second;\n                    if (buyAmount > amount) {\n                        buys.pop();\n                        buys.push({buyPrice, buyAmount - amount});\n                        amount = 0;\n                        \n                    } else {\n                        amount -= buyAmount;\n                        buys.pop();\n                    }\n                }\n                if (amount > 0) {\n                    sells.push({price, amount});\n                }\n            }\n        }\n\n\n        long long sum = 0LL;\n        while (!buys.empty()) {\n            sum = sum +  buys.top().second % MOD;\n            buys.pop();\n        }\n\n        while (!sells.empty()) {\n            sum = sum + sells.top().second % MOD;\n            sells.pop();\n        }\n        return sum % MOD;\n    }\n    \n};\n```
['C++']