@Vid__26 Yes.
Fenwick Tree is also called Binary Indexed Tree. It processes following queries for array:
1. Add v for index i
2. Summate of range [ l, r )
3. Get minimum i for v s.t. v <= sum of [ 0, i )
D is solved by 1 and 3. And I didn't implement the tree since I've created a snippet