Python (Simple Stack)
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:\n    def maximumSumQueries(self, nums1, nums2, queries):\n        ans = sorted([[i,j] for i,j in zip(nums1,nums2)])\n        queries = [(x[0],x[1],i) for i,x in enumerate(queries)]\n        queries.sort(key = lambda x: -x[0])\n\n        stack, res = [], [-1]*len(queries)\n\n        for x,y,idx in queries:\n            while ans and ans[-1][0] >= x:\n                a,b = ans.pop()\n                while stack and stack[-1][1] <= a+b:\n                    stack.pop()\n                if not stack or stack[-1][0] < b:\n                    stack.append([b,a+b])\n            index = bisect.bisect_left(stack,[y])\n            if index < len(stack):\n                res[idx] = stack[index][1]\n\n        return res\n\n\n        \n\n        \n\n```
['Python3']