HF RL Explorer

You must implement a command-line tool at /root/topk.py that reads a file and outputs a streaming top-k…

You must implement a command-line tool at /root/topk.py that reads a file and outputs a streaming top-k…: a task in TermGrade Environments: 1,004 executable Linux tasks (Harbor dataset). Goal : Write a Python 3 script at /root/topk.py that processes a large input file of lines, computes the k-th…

The task

**Goal**: Write a Python 3 script at `/root/topk.py` that processes a large input file of lines, computes the k-th percentile value in a **single streaming pass**, and outputs results. The script must handle edge cases without crashing, leaking memory, or producing incorrect results.

Part of ai-and/termgrade-environments.