Help me in solving CHEFESCAPE problem

My issue

how to approach the problem

My code

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

int main() {
	// your code goes here

}

Problem Link: Escape Practice Coding Problem - CodeChef