FAST IO
std::ios_base::sync_with_stdio(false);
Or use getchar_unlocked() and putchar_unlocked() (This should do it)
getchar_unlocked > scanf > cin
- Use std::sort over quick sort. (http://stackoverflow.com/questions/4708105/performance-of-qsort-vs-stdsort)