ans+=lower_bound(vec.rbegin(),vec.rend(),0)-vec.rbegin();
Although its working i am not able to understand -vec.rbegin in this line here is functio