Add improved solutions of tasks 1 and 2