FEMA2 - Editorial

I watched the editorial [Iron, Magnet and Wall (FEMA2) in Hindi | November Long Challenge 2020 | Chirayu Jain - YouTube] and I tried to implement the method. My code is similar to the code shown in the editorial. But I am getting WA in the second subtask. Can anyone please tell me what is wrong with my solution Solution: 44727141 | CodeChef