I was stress-testing my solution with jiangly's solution, and finally came to the conclusion that his answer is wrong.
His submission : 128262573
Testcase :
1
2 3 5
4 5
1 2 3
6 3
2 2
4 1
9 1
3 2
Correct Answer : 1
His output : 0
MikeMirzayanov please add this testcase.
Did u even read the problem and constraints?
Your $$$x_p = 6, y_p = 3$$$ violates $$$x_p \in [x_1, ..., x_n] = [4, 5]$$$.