Regarding the lower_bound function

why -1 is still there even after the introduction of the compare function in the lower_bound?

If u observe that
if u just write
lower_bound(arr,arr+n,key,compare)
without -1 then giving a money value which exists in the array
would return a wrong value
it returns the next greater value in the array

hence the -1 is required so that even 120 and 100 would give us answer 100
in case -1 is not written then 100 would give answer 120 because of the comparator