Sleepy brain is weird. I’m a programmer that also writes music. I learned a long time ago that when I write music when I’m half asleep, if I wake myself up and write it down, it’s already a song that exists, I just didn’t recognize it when I was half asleep. But I can absolutely solve my programming problems while half asleep. I have even solved them in my dreams before. If I get up and write down my idea, or even just my new perspective, I can turn it into code later and it will work (usually).