suggest a segment tree solution for this problem↵
https://www.hackerearth.com/fr/practice/data-structures/advanced-data-structures/segment-trees/practice-problems/algorithm/kinako-bread/
https://www.hackerearth.com/fr/practice/data-structures/advanced-data-structures/segment-trees/practice-problems/algorithm/kinako-bread/