Fenwick Tree
 # Intuition\n<!-- Describe your first thoughts on how to solve this problem.  \n\n\n\n\n\n\n\n\n\n\n\n\n\nclass FT:\n    def __init__(self):\n        self.arr 
<!-- # 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 FT:\n    def __init__(self):\n        self.arr = {}\n        self.size = 10**9\n    def put(self, key, val):\n        while key <= self.size:\n            self.arr[key] = max(self.arr.get(key, -1), val)\n            key+=key&-key\n    def get(self, key):\n        ret = -1\n        while key > 0:\n            ret = max(ret, self.arr.get(key, -1))\n            key-=key&-key\n        return ret\nclass Solution:\n    def maximumSumQueries(self, nums1: List[int], nums2: List[int], queries: List[List[int]]) -> List[int]:\n        size = 10**9\n        pairs = list(zip(nums1, nums2))\n        pairs.sort()\n        queries = [q+[ind] for ind, q in enumerate(queries)]\n        queries.sort()\n        num2mx =max(nums2)\n        ft = FT()\n        p = len(pairs)-1\n        ans = [-1]*len(queries)\n        for q in range(len(queries)-1,-1,-1):\n            x,y,ind = queries[q]\n            while p >=0 and pairs[p][0] >= x:\n                ft.put(size-pairs[p][1]+1, sum(pairs[p]))\n                p-=1\n            ans[ind] = ft.get(size-y+1)\n        return ans\n```
['Python3']