...B,C,D had drinks : 150 bucks (B paid 150)
4. hotel cost : 2500 bucks ( C paid 2500)
Here A,B,C,D,E are added to person list file.
There are 3 different groups:
G5:A,B,C,D,E;
G2:A,B;
G3:B,C,D;
For case 1 there are 3 transaction
A paid 1000 in G5 group : G5,A,1000
B paid 500 in G5 group : G5,B,500
C paid 500 in G5 group : G5,C,500
For case 2 there is 1 transaction
A paid 50 in G2 group : G2,A,50
For case 3 there is 1 transaction
B paid 150 in G3 group : G3,B,150
For case 4 there is 1 transaction
C paid 2500 in G5 group : G5,C,2500