After carefully checking the Anciant dragons comments I checked again, and Find that, It works as it should when the following is used.
nth_element (arr.begin (), arr.end()-1, arr.end (), less<int>());
Check to see if it really works.
and tell me why you use the less_equal ?