Codeforces-B. Moamen and k-subarrays

Submission #221682122 - Codeforces why is this code giving wrong output can anyone please point out and tell the right approach