This problem was going to be used in Pinely round...
Problem
but it has exactly the same solution as 1913D - Схлопывание массива.
A while ago I invented another problem, but my coordinator rejected it because the authors of Hello 2024 (whose coordinator is the same) had just invented the same exact problem!
:(