Yandex Interview Question

Given a multithreaded code with a racing condition, find a mistake and correct the code