Is it safe to have sex 3 days after the menstruation?

No. It depends on your cycle length and regularity. Women with long periods and/ or short cycles can be fertile 3 days after a period ends.