Tle in SID problem of spoj

I am using multimap STL for the problem SPOJ.com - Problem SID . But I am getting tle. Anyone please suggest any good STL for this problem. this is my solution = ovPdH4 - Online C++ Compiler & Debugging Tool - Ideone.com .

Thank You