LOST MAX TAKING TOO MUCH MEMORY

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

Can someone tell me why my Lost Max code is taking 3687.5 M of space?
Thanks in advance.

What did system store in that 3GB of memory O_O

God knows what!!