Script to work out who owes who by attempting to minimise the total number of transactions