I assume all that lending and borrowing takes place between these two people.
at start:
Joy had x, and Hassan had y
x + y = 240 or y = 240 - x
first episode:
1/5 of x goes to y
joy now has (4/5)x, Hassan has y + x/5
2nd episode:
1/4 of hassan's goes to joy
joy now has (4/5)x + (1/4)(y + x/5)
hassan has (3/4)(y + x/5)
3rd episode:
40 from joy to hassad
joy now has (4/5)x + (1/4)(y + x/5) - 40
hassad now has (3/4)(y + x/5) + 40
final situation:
[ (3/4)(y + x/5) + 40 ] - [ (4/5)x + (1/4)(y + x/5) - 40 ] = 26
3y/4 + 3x/20 + 40 - 4x/5 - y/4 - x/20 + 40 = 26
each term times 20
15y + 3x + 800 - 16x - 5y - x + 800 = 520
10y - 14x = -1080
7x - 5y = 540
sub in y = 240 - x
7x - 5(240-x) = 540
7x - 1200 + 5x = 540
x = 145
y = 240-145 = 95
check my arithmetic