@dvyn01 Can you help me to find the problem in above solution? I get TLE for subtask 3. What I am doing wrong?