Acidic strength is decided by the stability of conjugate base formed after extraction of H. In this case when H is extracted from -COOH , -COO^- is formed. Now, more is the stability of this -ve charge easier it is to lose H and hence more the acidity. In here P has a -NO_2 group attached and R has an -OCH_3 group. Due to the -M effect of -NO_2, -ve charge is more stable and hence more acidic.

That hydrogen bonding is happening in R also
but after the hydrogen is extracted in P the H attached to the Oh group is stabilising the conjugate COO- ion due to which I think acidity of P should be more

After all of this discussion what I think is since Mesomeric effect won't be working due to ortho effect we would decide acidity by -I and it does explain the given order. But yes I find your argument correct about the H bonding thing, so I'll think and search a bit about this and get back to you.@Sourav_Madanpuri@Chirag_Hegde Please look into this.

No2 shows more -M effect hence there is more deficiency of electron in that structure hence it tends to accept electron and the substance that accept electron is known as acid
And as this structure has more tendency to attract electron hence it is a better acid