Tried so hard to use normal binary search on this question but it just fails every time lol, so I looked this one up and I had everything the same except for some "extra" function called order which I did not understand the use of.
Here is a link to the question: http://codeforces.com/problemset/problem/448/D
I tried relating that function with the question and only could find this relatable:
Consider the given multiplication table. If you write out all n·m numbers from the table in the non-decreasing order, then the k-th number you write out is called the k-th largest number.
More specifically what drives me crazy is line 11: order += min(x/i,m);
I have lots of things to say. First of all, I think the problem description if flawed. If you look at the 2x3 grid printed out at the bottom of the page, you can see that the 4th largest value in the table is 2, not 3 like the sample output says.
Secondly, I was wondering if your code is correct. It seems odd that lines 26 and 30 are the same. If they are intended to be the same, why not just have an else statement in line 25? Symmetry with line 23 suggests that line 30 might be high = mid - 1.
I don't know what you are trying to get from this exercise. If you are trying to learn C++ as you seem to be in many of your other posts, this is not a good code sample to work from. I don't really know what is happening in line 11 either. There is something subtle going on, and, if it works at all, it has to do with the way numbers work, not anything special with the programming language. Coding to squeeze out every bit of performance can lead to very confusing code, and I think that's what has happened here. I suggest it's time to move on to another problem.