my solution for Codeforces