Help me in solving PURIFYIT problem

My issue

whats the intuition here?what are the concepts we need to apply here?

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here

}

Problem Link: Purify It Practice Coding Problem - CodeChef