According to Google you can stay in a hostel for about $350/2 weeks, which works about to about $10k a year. You'd probably be too broke to eat well, and have nothing left for activities.
With some more googling you can get an apartment for like 500-700€/month in madrid and if we say 700€ per month for living(should afford a relatively decent lifestyle in spain(apparently minimum wage there is ~1200€/month) so the ~30k€ after the flights and surgery seems reasonable to live for 2 years there.
Internet sources put the cost of living in spain to around 1000-1800€/month for one person
Yeah in many european countries while the minimum wage can be on par or lower than in the US but most of the time the cost of living is actually also low enough for it to be an actually liveable wage
Living in finland i could (for now until our new government makes "improvements") live semi-comfortably working only 30h/week on minimum wage*
*finland has no national minimum wage but unions negotiate baseline contracts by field regularly(the contracts often include yearly raises to counteract inflation and also raises depending on number of years worked)