Doubt in line 15

Why did we add p in the end??

which question you are solving??