EPAM Systems interview question

Find problems in a presented code sample and try to refactor it