Replying mostly to undo a moderation misclick, but I'll chime in as well:
AC here really is giving good advice. I've seen and experienced similar effects. Depression could be the cause for (or at least a contributing factor to)
all the issues that were described.
Absolutely take a look at your diet and exercise. Deficiencies in your diet can have a huge effect on your mental abilities and can be a major contributing factor in depression, if that is a cause of your problems.
I also strongly recommend following up on some of the suggestions farther up the page for improving sleep. Most artificial light (including computer screens and TVs) actually does have an effect on your body's internal mechanisms. If you absolutely must use your computer near bedtime, I recommend using redshift on Linux or f.lux (https://en.wikipedia.org/wiki/F.lux). These will change the color of the output to reduce the effect on your sleep.
Last, don't be shy about discussing your issues with the appropriate people at the school. If it is a medical issue, they should be very willing to help you deal with it and/or work around it.
Been there before (though maybe not quite as serious) and it's not fun. Good luck.