There is strange problem with test cases in this problem: 429D - Tricky Function.
Author's solution is O(nlog(n)), but you can see this solution: 11245064.
It works O(n2) in worst but doesn't achieve it because of s[i] - s[i + l] < l * 104 or because of some other constraints.
Moreover my O(nlog(n)) doesn't work here: 13704572
What's going on in both cases?