I had to use the hints to solve the problem and I just explored the upper_bound and lower_bound functions so not sure what I am doing wrong. Please help
2 2 3 7 1000 1 10 2 7 3 4 10
You are not first checking condition. In case for lower_bound if all the elements in the range compare less than val, the function returns last. If all the elements in the range are larger than val, the function returns a pointer to the first element.
if (contest[i].first >= v && contest[i].second <= w[y-1])