All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
You are not a disbeliever by refraining from forbidding such sayings or by remaining in that place while they are saying what was mentioned in the question as long as you do not approve of Kufr (disbelief). However, you have to clarify to them to the best of your ability the merits of Islam and that it is the true religion of Allah. If they say such words again, then explain to them that it contradicts the Islamic belief and that Muslims believe that Allah is Just and never wrongs His Creation, and that there is great wisdom behind all His Decrees and Judgments. If you fear that they might raise misconceptions that are beyond your capacity to refute, it is enough for you to remain silent, and you bear no sin for that as long as you hate this evil. You are not obligated to leave the place as long as you need to remain therein. If you do not need to stay with them and could leave the place, then do not stay with them while they utter words or deeds of Kufr, because Allah, The Exalted, Says (what means): {And when you see those who engage in [offensive] discourse concerning Our verses, then turn away from them until they enter into another conversion.} [Quran 6:68]
Allah Knows best.