Water...all I can say is water....
While I knew that drinking more than 1-2 glasses of water is good, I never thought that the impact of drinking 1-2 liters of water a day could have such an significant impact on my ability to concentrate and focus on programming.
My suggestion: drink at least 1-2 liters of water without bubbles (or gas) and try to work on a mentally challenging task. And if you are stuck, drink half a liter more.