Custom comparator in lower_bound() stl function in c++

in this code, as you see in this picture link I made a custom comparator for lower_bound() so it supposes to 100 as output in the end as in the lst compare 100 <=100 is true but it gives the next index 200 as output why? please explain thank you

Please copy and paste your formatted actual code so we can run and debug it ourselves.


Your comparison function is wrong: it does not meet the criteria to be a strict weak ordering.

In particular, compare(1,1) is true.

See e.g. Doubt about comparison function in sorting array of structures. - Codeforces.


I tell a lie: the requirements for lower_bound's predicate are weaker than strict weak ordering. However, it is still required that:

which is not satisfied by your compare function (consider e.g. e = 1 and value = 1).