Did everyone pay for something different? Its easy: add the joint bill, the people and their expenses and see who gives cash back to whom.