Weed is the secret behind my ability to debug really gnarly problems that others get stuck on. I'm not the best coder, and I'm incapable of finishing projects, but most workplaces I've been at I've quickly become the "hey could you look at this heisenbug" guy.
I never smoke in a professional setting of course. I read the code, set breakpoints, debug prints, yadda yadda. Then when I get home I smoke some hashish and suddenly it's like I can execute and debug the code in my brain and just see the bug in plain sight like I'm Gregory House if he was a programmer. Then I pull out my laptop and throw together a fix in the dumbest, simplest way possible, test it, PR it and let code review turn it into production ready code. Because I have no idea what that looks like, and hopefully the company has other people that do(wishful thinking, i know).
Caveats:
Yes, this is very hit or miss, maybe a one out of ten per try, but you can try multiple times of course.
I'm not recommending anyone mess with psychoactive drugs unless they know it's something they can handle, and more importantly that they know how to do it safely.
I'm not saying I have my shit together wrt drugs, I definitely do not.
Weed is double edged; it has negative effects that greatly limit its functional potential most importantly on working memory and focus. I like to say weed can temporarily turn you into a brain damaged genius.
There are many other ways to get this effect without drugs: Taking a walk, meditation, sleep, sex, and basically anything other than staring at the problem can do the trick through random associations.
I was high when I wrote all this so maybe none of it makes sense, but be nice.