MXFACS code drive problem, need help with TLE

In Yesterday’s code drive MXFACS solution I used map and got TLE, Please someone help why am I getting TLE. Problem link : Contest Page | CodeChef
Solution Link: Solution: 55640584 | CodeChef
I would be really grateful if someone could shed light on why is map giving TLE.