You must implement a command-line tool topk that reads a large text file line by line and computes the top-k…
You must implement a command-line tool topk that reads a large text file line by line and computes the top-k…: a task in termgrade-bandcentral-gemma4-31b-bash: TermGrade Band-Central: the 151-task selection and its splits (Harbor dataset). Input contract: - The tool is invoked as: topk <k <input…
The task
**Input contract:** - The tool is invoked as: `topk <k> <input_file>` - `<k>` is an integer >= 1. - `<input_file>` is a UTF-8 text file, potentially very large (cannot fit in memory). - Each line in the file is a record. Empty lines (zero-length after stripping CR/LF) must be treated as records with value `""` (empty…