Reseach has shown that a little bit of caffine has been shown to help mental activity. However since caffine dehyrates one of the side effects when doing a lot of brain work is headaches and tiredness. Generally drinking plenty of water helps keep the brain hydrated. Note it is a little bit of caffine less than a standard cup of coffee seems to be enough.
Alex