Https://www.codechef.com/viewsolution/36018387

https://www.codechef.com/viewsolution/36018387

Why i am getting the Runtime Error in the solution any idea?

I think it is occurring when t[][] is demanding large memory.
Eg -> t[100001][100001] (in worst case it asks this much space)
Try to optimize it.

How to optimize that,any suggestions