How should I solve this problem?
Problem link:- Problem - D - Codeforces
I found the solution, [Tutorial] CodeForces Round #430 - Problem D [Tries, Math, XOR] - YouTube
Thanks, Rachit Jain for making the video on this problem.