Could Stack Overflow have a giant sandbox where questions would be code not working, and answers would be this code fixed ?
No.
In your questions current forum, what you're basically asking for is a giant coding service. That's not what Stack Overflow is trying to be. If you have a good question that is well researched and has a Minimal, Complete, and Verifiable Example then it should be posted like any other regular question. There's no reason is should be hidden away in the depths of some long thread.
If all you want to do though is simply post your code and have it fixed debugged and cleaned-up for you, then your question is very much off-topic.
So a giant sandbox could force users to post the code which doesn't work. Doing this could help them to find the solution before completing the post process
I fail to see how having anything like you propose would promote better questions and encourage users to put effort into trying to fix their code first. If users are simply allowed to dump their code in the "Sandbox", then I highly, highly doubt they'd try to do any work themselves.
Further more, sometimes some people answering just send the correct debugged code as comment, without much explanation. So with this giant sandbox the answer would be a piece of code actually working.
If your code was able to be fixed in a comment, that is a good indication you didn't do enough research yourself. And again, SO is not a coding service, so if a user does happen to fix your code in the comments, they are not under any obligation to post a full answer with all of your code corrected.
Then the user asking the question would be able to make a code diff and understand the mistake.
As I said above, if you put effort into your question, people are usually willing to put effort into their comments/answers, so you will be able to understand what you did wrong. And if a user is still having trouble understanding, they can always post a comment on the answer in question, and most users are more than happy to help clarify.
Again, this does would be applicable only for some questions, but still.
What do you think ?
No. This really doesn't apply to any kind of question we want on SO. If your entire question is simply a "gimme teh codez" then it doesn't belong here.
What you seem to be asking for is a Stack Overflow-ish site where users are allowed to post code dumps in whatever shape, form, or fashion and expect answers which correct their code. That wouldn't work. The site would be overflowing with hundreds of low-quality posts, and nobody would be able to benefit.
And to be honest, there's no reason Stack Overflow in its current form can't be exactly what you're asking for. More often than not, if users ask quality questions with MCVEs, then they'll get good answers which they can learn and grow from.