Time Limit Exceeded in large data