Consider refurbished or second hand, please don't buy a brand new laptop as there is so much waste in the world already. If you buy from big brands, you might be able to buy replacement batteries. If not, install Linux and use TLP. You could also ask the seller to measure the battery life. I was patient and managed to score a used ThinkPad and the battery health was 98% when I bought it.
I know people who graduated in CS with one of those old IBM X220s, but for the sake of modernity, there are a lot of options, the T and P series have good releases, but one model can have different specs. I have the T480s and if you can find a used T470 or T480 (s or without s), it will serve you well. Some of these will also allow you to upgrade the RAM and SSD. It might be a tad slow if you do all those things you mentioned at once, but I can open 4 or 5 PDFs, 30+ tabs and a few terminals and it's still quite responsive.
Some guides on different models (I don't know how useful these are, but they might help you):
I managed to score a Thinkpad E14 Gen 1 for a couple hundred (the successor to the T4XX series). I'm not sure what the market is like in your country, but I bookmarked a few auction sites and checked them daily for a few weeks before I snagged mine. Definitely I viable strategy in some areas.