Given a large dataset of test logs, write an algorithm to parse and find the top K most frequent error messages.