I was solving this question. Submission link. In test cases 17 37 38 etc. I am getting different answer in my system and the codeforces sample test. In this particular case my system answer and jury's answer is the same but my answer in my system and the answer in the judge differs. I don't know if there is any way to fix this.