There are at least 3 things to consider when allocating money like this: 1. Expected return. 2. Risk and opportunity. 3. Psychological factors, stress and comfort.
Most 401k's have an employer match of 50% to 100% of at least some portion of your contribution. That's an awesome return: 50% or more, instantly, risk-free. I have always maxed out my 401K when my employer offered one. Yes, I can imagine situations where my money was so tight that I just couldn't afford it, but I think that should be way down on your list of things to cut.
Student loans are usually government subsidized, so they have a relatively low interest rate, and they are tax deductible on top of that, which effectively reduces the interest rate yet further. (If you're talking about a 401K and an HSA I assume you live in the US.) I'd put paying more than the minimum on a student loan fairly low on my priority list.
It's a very good idea to have an emergency fund in case of, well, emergencies, like a medical expense, your car breaks down, if you own a house, if you have some major home maintenance expense, etc. I'd say that at current prices, about $2,000 is usually adequate for this. If you have less than $2,000 in ready cash, I'd put money into building up such a fund before I made extra payments on debts or put a lot into retirement.
Longer term, it's good to have an unemployment fund, enough money to live on for a while if you were to lose your job. I often hear financial advisors say this should be equivalent to 6 months pay or more. Personally I think that's a ridiculous goal for most young to middle-aged people. Sure, it would be nice. I'd like to have a million dollars in the bank in case of emergencies. But there's no way I'm going to save up that kind of money. Realistically, if you lose your job, you should be able to find ways to reduce your expenses drastically. You don't need enough to maintain current spending.
Oh, which brings up your comment that if you had to economize, you could cut out Netflix. Well, nice I guess, but is that really the only thing you could possibly cut? All your other spending is the bare minimum for survival? That may be true, but I doubt it. If I had to cut expenses (because I lost my job, or had some huge unexpected bill, or whatever), I'd start by quitting eating out. That would probably save $200 to $250 per month right there. When eating at home I could switch from steak and shrimp to chicken and tuna. Of course I wouldn't buy any new toys, any new computer games or the like. I'd cut out vacations and other long trips. I'd put off buying new clothes or shoes. If this was an issue that I wasn't likely to resolve in a few months, I'd consider selling my house and moving to some place with a lower rent or mortgage. Do my wife and I really need to each have our own car? Probably not. Etc. For most Americans, maybe 20% of our spending is on things that are actually necessary for survival, like food and shelter. (I just made up the 20% number but I think it's the right ballpark.) Unless you are literally living in a tiny efficiency apartment that you share with a roommate and are eating ramen noodles, there are things you could cut if you had to.
Advice about what debts to pay off and balancing between debts and investment often leaves off practical and psychological factors. For example, I think that generally you should pay off the highest-interest rate debts first to save the most on interest. But I think there's much to be said for getting smaller debts paid off first, even if they have lower interest rates. It's psychologically satisfying to pay off a debt, and that my give you the motivation boost to pay off others. And there's the practical effect matter that the more bills you have, the more likely you are to make a mistake sooner or later, forget to pay one on time, and get hit with late fees. I have a bunch of credit cards, but I try to primarily use just one of them and my wife uses another, so we have just two credit card bills to pay each month and are less likely to lose track.
Debt limits your options. When special needs (or wants) arrive, you can always defer adding to your investments, but you can't just decide to not make debt payments this month. (I'm not recommending diverting money from your retirement fund to pay for entertainment, but I wouldn't consider it outrageous to do that now and then.)
So that was a very long-winded discussion that didn't give you a definitive answer. Here's my short answer: If at all possible, keep putting money into the 401K. After that, pay the minimums on the student loan and any other debts while you build up an emergency fund. After that it gets trickier. I'd probably make more than the minimum payments on the student loan if I could, but also put money into the HSA and whatever retirement fund.