2. Use '\n' instead of endl ; 3. Use special functions for input 4. Use unsigned integers for more space 5. http://codeforces.com/blog/entry/5217 -- Link for fast input 6. http://discuss.codechef.com/questions/32523/difference-between-getchar-getcha r_unlocked -- Link for fast input