Ok probably your best option is a used Thinkpad, or maybe a Chromebook with the Chromebook distro, but if you want to do something crazy you could try the Pinebook Pro. It's a 14" arm laptop that comes with debian for $220. You might need some accessories, but it would still be <$400 for something new and interesting. However, it's a bit slow, and arm doesn't have as much software support. I think it could do everything a CS student needs, except browsing may be slow because web apps are so absurdly big and complicated now. Definitely would get more than 5 hours of battery.