How should i compare x with elements of pair

i am getting compilation error

@anyamaurya Share the ide link of your code.