Yandex interview question

Logical quizes and algorithms realization