A few example sentences:
I woke up late and realized I overslept (or) had overslept.
I went to market yesterday bought some clothes while paying the bill I realized I left (or) had left my wallet at home.
When I got home, I realized someone stole (or) had stolen my wallet
Which tense should I use? In this situation, should I use a past simple or past perfect? Or can I use both?