code review in // minsuk: comments,

- think about exit() !!!, if return is enough, use return !!
- there are so many blank lines. (every code should have meaning !)

- pleae read your code carefully  !! (there are so many point to simplify data structures.. :-)