gp of yuquan
What's the intended time complexity for E? Can it be solve in O(nk)?
Codeforces Round 946 Solution Discussion