SPOJ Fastflow

I was trying to solve the SPOJ.com - Problem FASTFLOW using Dinc. I’m getting TLE in the 11th test case. Can someone pls help me out.

This is my code: KPUELZ - Online C++0x Compiler & Debugging Tool - Ideone.com