My 118th numbers differ in the second testcase of the problem — "Editorial For Two". Can somebody please point the testcase out as I tried my level best but for all random testcases I made, it is showing correct answer. https://codeforces.com/contest/1837/submission/208223724
correct output: 13
your output: 14
Your approach is a variation of "greedy taking k smallest element". In your case, it is finding the k-th smallest element with value $$$val$$$, then taking the first k elements that is $$$\leq val$$$
This test case kills all solution with that approach (taken from editorial post)
The optimal is $$$4$$$ which require taking the biggest value $$$4$$$