IMC Trading Interview Question

Just some basic algorithms, I use Python to solve all of them