It is permissible to have plastic surgery. But if the doctor is of the opposite gender to the patient and the operation requires touching the skin or looking at body parts that should be covered, then it is not permissible unless this is the only choice and not performing the operation would cause hardship in bearing the current situation.
It is not obligatory to remove the dirt under the nail, since this area is not part of wudhu or ghusl. If the dirt prevents water from reaching the skin in parts of wudhu and ghusl, it must be removed; one can use material that removes such substances in the conventional way, and one need not focus on this beyond that. However, if a person has a reasonable doubt whether there is any substance that is forming a barrier between the water and the skin, then he should remove it to ensure that water reaches the skin.