All perfect praise be to Allah, The Lord of the Worlds. I testify that none is worthy of worship except Allah and that Muhammad is His slave and messenger.
If the earnings of your roommates are totally unlawful, then eating there or using a portion of their money is not permissible.
So, do not mix your money with their money. It is even desirable not to share with them any accommodation and try to stay away from them. But, if you are compelled to live with them, then do not eat from their earnings and do not share with them except the rent and bills.
If their earning are from both lawful and unlawful sources but the unlawful earnings are more than the lawful ones, then, in this case, the ruling of unlawful earnings apply to their earnings, so one should not consume them. But, if the lawful earnings dominate the unlawful earnings, then you may live with these people, eat from their earnings and use them for other purposes also.
Finally, if you find Muslim brothers who are religious and who try to implement all the rulings of the Sharee’ah, then we advise you to befriend them and share with them since the Sharee’ah urges Muslims to be in the company of good and religious people.
For more benefit on someone whose earnings are mixed between lawful and unlawful, please refer to Fataawa 89599, 233188, 264832, 87211 and 81560.
Allah knows best.