Period or pregnant

So on the 15th and 16th I bled and me and my boyfriend had unprotected sex but I’m not sure if he pulled out in time. Then yesterday I bled for like 30 mins and stopped. Does anyone know why???