Hello, kingman!

Boxes A and B are each filled with some sand.

If sand from Box B is poured into Box A until the sand in Box A reaches the brim,

there will be 8 litres of sand left in Box B.

If sand from Box A is poured into Box B until the sand in Box B reaches the brim,

there will be 26 litres of sand left in Box A.

The ratio of the volume of Box A to the volume of Box B is 5:3.

How many more litres of sand are needed to fill both boxes to their brim?

Box A has volume $\displaystyle \,5k$ and contains $\displaystyle \,a$ liters of sand.

Box B has volume $\displaystyle \,3k$ and contains $\displaystyle \,b$ liters of sand.

Code:

5k
* *
| | 3k
* - - -* * *
|::::::| | |
|::::::| * - - -*
|:: a :| |::::::|
|::::::| |:: b :|
|::::::| |::::::|
*------- *-------
A B

Sand from box B is poured into box A, filling box A.

The amount of sand transferred is: .$\displaystyle 5k-a$ liters.

Code:

5k
* - - -*
|:5k-a:| ← 3k
* - - -* * *
|::::::| | |
|::::::| | |
|:: a :| | |
|::::::| * - - -*
|::::::| |:: 8 :|
*------- *------*
A B

This leaves: $\displaystyle b - (5k-a) \:=\:8$ liters in box B.

. . We have: .$\displaystyle a + b - 5k \:=\:8$ .[1]

Sand from box A is poured into box B, filling box B.

The amount of sand transferred is: .$\displaystyle 3k-b$ liters.

Code:

5k
* *
| | 3k
| | * - - -*
| | |:3k-b :
* - - -* * - - -*
|::::::| |::::::|
|::26::| |:: b :|
|::::::| |::::::|
*------- *-------
A B

This leaves $\displaystyle a - (3k-b) \,=\,26$ liters in box A.

. . We have: .$\displaystyle a + b - 3k \:=\:26$ .[2]

Subtract [2] - [1]: .$\displaystyle 2k \,=\,18 \quad\Rightarrow\quad k \,=\,9$

Substitute into [1]: .$\displaystyle a + b - 5(9) \:=\:8 \quad\Rightarrow\quad a + b \:=\:53$

. . The boxes originally contains $\displaystyle 53$ liters of sand.

The total capacity of the two boxes is: .$\displaystyle 5k + 3k \:=\:8k \:=\:8(9) \:=\:72$ liters.

Therefore: .$\displaystyle 72 - 53 \:=\:19$ liters of sand will fill both boxes.