You cannot and should not eat pizza that was left out for 12 hours as it is considered unsafe to eat due to bacteria growing.
Eating pizza that was left out for longer than a few hours can cause it to grow bacteria and put you at risk for food poisoning.
If you left pizza out for 12 hours or longer than a few hours it's best to throw it out especially if it has meats on it.
I've eaten pizza that was left out all day before and wasn't really thinking about it and I didn't get sick but it is possible to get sick and best to avoid it.
If the pizza has just cheese and no other meat toppings then it's safer to eat the pizza left out at room temperature but still not a good idea.
If the pizza has meat the meat begins spoiling sooner and can more easily cause food poisoning.
You can eat 5 day old leftovers as long as the leftovers are still actually good and has no bad smell, mold or bad taste.
If the 5 day old leftovers were kept refrigerated then they are often safe to eat depending on what type of food it is.
If frozen the 5 day old leftovers are still very safe to eat and can even be good up to a year frozen.
Raw meats tend to last 3 days in the refrigerator and a year or longer in the freezer.
For cooked meats the cooked meats tend to last 5 to 7 days in the refrigerator before going bad.
And other cooked foods such as spaghetti, noodles, pizza etc tend to last a week or 7 to 10 days as well.
Just make sure the 5 day old leftovers or other leftovers still smell good and have no mold growth or slimy texture and they will be safe to eat.
If you're in doubt then it's best to throw the leftovers out.
But most leftovers last 5 days or longer and are often safe to eat depending on the food type.
I keep many leftovers for 5 days to 10 days in the refrigerator and have eaten them after that time but if I plan to keep any leftovers longer than 5 to 10 days I freeze them to make them last longer.