When I worked for an IBM software lab in the '90s we were offered a change of contract - no fixed hours, no overtime, work where you liked except for scheduled meetings, You agreed what data you'd have something delivered and it was up to you to manage your time. We were told productivity increased and the overtime bill fell off a cliff.
If I was stuck, I could just logoff, chill, and if inspiration struck in the evening I'd work then. Sometimes I triggered security alerts as I'd work until the wee hours with US labs and then start early again next day to bring the rest of the team up to date. Nearly all my time I was working at my peak,
And it's been proven over and over how to make programmers efficient. Read Peopleware or get a starter here https://www.usnews.com/opinion/blogs/economic-intelligence/2013/04/19/how-office-space-affects-company-productivity