Please use the code for learning and not for evil ;)
- The code has been tested with gcc. It also works with mingw with few exceptions (like when _unlocked functions are used).
- It may not be the best solution algorithmically because I'm not the best coder around. It has been accepted by the holy SPOJ server, so don't complain :P
The author is currently a student at Amrita University, Coimbatore, India. He was very sleepy when writing this. He also likes to talk about himself in third person.
(Copyleft)
My code is your code. End of story.