Javascript solution
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```javascript []\n/**\n * @param {number[][]} orders\n * @return {number}\n */\nvar getNumberOfBacklogOrders = function(orders) {\n    const buysQueue = new MaxPriorityQueue({ priority: (bid) => bid[0] });\n    const sellsQueue = new MinPriorityQueue({ priority: (bid) => bid[0] })\n\n    for (let [price, amount, orderType] of orders) {\n        if (orderType === 0) {\n\n            while(!sellsQueue.isEmpty() && amount > 0) {\n                let [sellPrice, sellAmount] = sellsQueue.dequeue().element\n              \n                if(sellPrice > price) {\n                    sellsQueue.enqueue([sellPrice, sellAmount]);\n                    break;\n                }\n                if(sellAmount > amount) {\n                    sellAmount -= amount;\n                    amount = 0;\n                    sellsQueue.enqueue([sellPrice, sellAmount]);\n                } else if (sellAmount <= amount) {\n                    amount -= sellAmount;\n                }\n\n            }\n            if(amount > 0) {\n                buysQueue.enqueue([price, amount])\n            }\n        }\n        if (orderType === 1) {\n\n            while(!buysQueue.isEmpty() && amount > 0) {\n                let [buyPrice, buyAmount] = buysQueue.dequeue().element\n              \n                if(buyPrice < price) {\n                    buysQueue.enqueue([buyPrice, buyAmount]);\n                    break;\n                }\n                if(buyAmount > amount) {\n                    buyAmount -= amount;\n                    amount = 0;\n                    buysQueue.enqueue([buyPrice, buyAmount]);\n                } else if (buyAmount <= amount) {\n                    amount -= buyAmount;\n                }\n\n            }\n            if(amount > 0) {\n                sellsQueue.enqueue([price, amount])\n            }\n       }\n    }\n\n    let backlogtotal = 0\n\n    while(!buysQueue.isEmpty()) {\n        const [price, amount] = buysQueue.dequeue().element;\n        backlogtotal += amount;\n    }\n    while(!sellsQueue.isEmpty()) {\n        const [price, amount] = sellsQueue.dequeue().element;\n        backlogtotal += amount;\n    }\n\n    return backlogtotal % (Math.pow(10,9) + 7)\n};\n\n```
['JavaScript']