Python || Sorting & Binary Search
\nfrom bisect import bisect_right\nfrom itertools import accumulate\n\n\nclass Solution:\n    def answerQueries(self, A: list[int], Q: list[int]) -> list[int]:\
```\nfrom bisect import bisect_right\nfrom itertools import accumulate\n\n\nclass Solution:\n    def answerQueries(self, A: list[int], Q: list[int]) -> list[int]:\n        A.sort()\n        A = list(accumulate(A))\n        return [bisect_right(A, q) for q in Q]  # bisect_right(A, e) returns largest i s.t., for x in A[i:], e < x\n```
['Python3']