link for code https://www.codechef.com/viewsolution/18921338
didn’t getting his approach , someone pls explain the logic
help @soham1234