I wrote a code for the solution to the problem C-Berland Regional but I am getting runtime error on test 7. I tried finding out what exactly can be the error but I couldn't get any. Most of the variables are long long so overflow can't happen and I have applied conditions to check if the indices are in bound or not but still it's giving runtime error. I am not sure what the mistake is. Please help me out in finding out the mistake.
Here is a link to my solution. Thank you.
your comparator returns true if elements are equal, so just change >= to > in 21st line
Thank you. It is clear now.