I've tried many times to simplify the code as much as possible but I still get memory of 2.2M result.
I have even tried noixs solution shown in http://www.spoj.com/forum/viewtopic.php?f=41&t=21&sid=186e86c29b4a5ccfb6533fd5c333ac9c3 topic.
How is it possible to get 1.5M or 1.6M?
How is the memory calculated?
I am asking because I simply want to know how to write perfect programs in C - low memory, fast running.