Does this problem have a Fenwick tree solution? Sorry, I don't have premium and can not see all the discussions.
Thanks.