Final accepted version
Added Code for fast I/O using thread lock free version

Run time 1.90sec to 0.19 sec on SPOJ