[Python3] Monostack
Sort items[i] = (x=A[i], y=B[i]) and queries.  Now for each query = (qx, qy) (in reverse order of qx), we increase the current set of points to all points with 
Sort `items[i] = (x=A[i], y=B[i])` and `queries`.  Now for each `query = (qx, qy)` (in reverse order of `qx`), we increase the current set of points to all points with `x >= qx`.\n\nFor the current point set `(y, x+y)`, we want to find the largest `x+y` that has `y >= qy`.  Let\'s store a monotonic stack of candidate `(y, x+y)`\'s: it has `y` increasing while `x+y` is decreasing.  Afterwards, we binary search for `qy`.\n\n# Code\n```\nclass Solution:\n    def maximumSumQueries(self, A, B, queries):\n        queries = [[*query, qi] for qi, query in enumerate(queries)]\n        queries.sort(reverse=True)\n        ans = [-1] * len(queries)\n        \n        items = sorted(zip(A, B))\n        stack = []\n        for qx, qy, qi in queries:\n            while items and items[-1][0] >= qx:\n                x, y = items.pop()\n                while stack and x + y >= stack[-1][1]:\n                    stack.pop()\n                if not stack or y > stack[-1][0]:\n                    stack.append([y, x + y])\n            \n            if (i := bisect.bisect(stack, [qy, 0])) < len(stack):\n                ans[qi] = stack[i][1]\n\n        return ans\n```
['Python3']