Write two CTEs: ins (total credit per account, column credit) and outs (total debit per account, column debit). Show account_id, credit and debit together.
Each hint gives a little more help. Try on your own first.
Run your code to see the output here.