Go solution using library in leetcode
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```golang []\nimport (\n  pq "github.com/emirpasic/gods/v2/queues/priorityqueue"\n"cmp"\n"math"\n)\n\ntype Order struct {\n    Price int\n    Amount int\n}\n\nfunc getNumberOfBacklogOrders(orders [][]int) int {\n    buysQueue := pq.NewWith(maxPriority)\n    sellsQueue := pq.NewWith(minPriority)\n    \n    for _, ord := range orders {\n        curPrice := ord[0]\n        curAmount := ord[1]\n        orderType := ord[2]\n\n        if orderType == 0 {\n            for sellsQueue.Size() > 0 && curAmount > 0 {\n                sell, _:= sellsQueue.Dequeue()\n                \n                if sell.Price > curPrice {\n                    sellsQueue.Enqueue(sell)\n                    break;\n                }\n\n                if sell.Amount > curAmount {\n                    sell.Amount = sell.Amount - curAmount\n                    curAmount = 0\n                    sellsQueue.Enqueue(sell)\n                } else if sell.Amount <= curAmount {\n                    curAmount = curAmount - sell.Amount\n                }\n            }\n            if curAmount > 0 {\n                buysQueue.Enqueue(Order{Price: curPrice, Amount: curAmount})\n            }\n        }\n\n        if orderType == 1 {\n             for buysQueue.Size() > 0 && curAmount > 0 {\n                buy, _:= buysQueue.Dequeue()\n\n                if buy.Price < curPrice {\n                    buysQueue.Enqueue(buy)\n                    break;\n                }\n\n                if buy.Amount > curAmount {\n                    buy.Amount = buy.Amount - curAmount\n                    curAmount = 0\n                    buysQueue.Enqueue(buy)\n                } else if buy.Amount <= curAmount {\n                    curAmount = curAmount - buy.Amount\n                }\n            }\n            if curAmount > 0 {\n                sellsQueue.Enqueue(Order{Price: curPrice, Amount: curAmount})\n            }\n        }\n    }\n  \n  res := 0\n  for buysQueue.Size() > 0 {\n    buy, _ := buysQueue.Dequeue()\n    res = res + buy.Amount\n  }\n\n  for sellsQueue.Size() > 0 {\n    sell, _ := sellsQueue.Dequeue()\n    res = res + sell.Amount\n  }\n  \n  return (res) % int(math.Pow10(9) + 7.0)\n}\n\nfunc maxPriority(a, b Order) int {\n    return -cmp.Compare(a.Price, b.Price)\n}\n\nfunc minPriority(a, b Order) int {\n    return cmp.Compare(a.Price, b.Price)\n}\n```
['Go']