Help in Codeforces Problem 6D , lizards and basement
Can anyone please help me in solving lizards and basement 2 ? link