{"task": {"agent_timeout": 600, "task": "1208", "verifier_timeout": 7200, "instruction": "Please implement a Python 3 solution to the below problem.\nReason through the problem and:\n1. Restate the problem in plain English\n2. Conceptualize a solution first in plain English\n3. Write a pseudocode solution\n4. Save your solution as solution.py\nNo outside libraries are allowed.\n\n[BEGIN PROBLEM]\nFarmer John has fallen behind on organizing his inbox. The way his screen is\norganized, there is a vertical list of folders on the left side of the screen\nand a vertical list of emails on the right side of the screen. There are $M$\ntotal folders, numbered $1 \\ldots M$ ($1 \\le M \\le 10^4)$. His inbox currently\ncontains $N$ emails numbered $1\\ldots N$ ($1 \\le N \\le 10^5$); the $i$th email\nneeds to be filed into folder $f_i$ ($1\\le f_i\\le M$). \n\nFJ's screen is rather small, so he can only view $K$ ($1\\le K\\le \\min(N,M)$)\nfolders and $K$ emails at once.  Initially, his screen starts out displaying folders\n$1 \\ldots K$ on the left and emails $1 \\ldots K$ on the right.  To access other\nfolders and emails, he needs to scroll through these respective lists.  For\nexample, if he scrolls down one position in the list of folders, his screen will display\nfolders $2 \\ldots K+1$, and then scrolling down one position further it will display folders\n$3 \\ldots K+2$.  When FJ drags an email into a folder, the email disappears from\nthe email list, and the emails after the one that disappeared shift up by one\nposition.  For example, if emails $1, 2, 3, 4, 5$ are currently displayed and FJ\ndrags email 3 into its appropriate folder, the email list will now show emails\n$1, 2, 4, 5, 6$.  FJ can only drag an email into the folder to which it needs to\nbe filed.\n\nUnfortunately, the scroll wheel on FJ's mouse is broken, and he can only scroll\ndownwards, not upwards.  The only way he can achieve some semblance of upward\nscrolling is if he is viewing the last set of $K$ emails in his email list, and\nhe files one of these.  In this case, the email list will again show the last\n$K$ emails that haven't yet been filed, effectively scrolling the top email up\nby one. If there are fewer than $K$ emails remaining, then all of them will be\ndisplayed. \n\nPlease help FJ determine if it is possible to file all of his emails.\n\nINPUT FORMAT (input arrives from the terminal / stdin):\nThe first line of input contains $T$ ($1 \\le T \\le 10$), the number of subcases\nin this input,  all of which must be solved correctly to solve the input case.\nThe $T$ subcases then follow.  For each subcase, the first line of input\ncontains $M$, $N$, and $K$. The next line contains $f_1 \\ldots f_N$.\n\nIt is guaranteed that the sum of $M$ over all subcases does not exceed $10^4$,\nand that the sum of $N$ over all subcases does not exceed $10^5$.\n\nOUTPUT FORMAT (print output to the terminal / stdout):\nOutput $T$ lines, each one either containing either YES or NO, specifying\nwhether FJ can successfully file all his emails in each of the $T$ subcases.\n\nSAMPLE INPUT:\n6\n5 5 1\n1 2 3 4 5\n5 5 1\n1 2 3 5 4\n5 5 1\n1 2 4 5 3\n5 5 2\n1 2 4 5 3\n3 10 2\n1 3 2 1 3 2 1 3 2 1\n3 10 1\n1 3 2 1 3 2 1 3 2 1\nSAMPLE OUTPUT: \nYES\nYES\nNO\nYES\nYES\nNO\n\nSCORING:\nIn inputs 2-10, the sum of $M$ over all subcases does not exceed\n$10^3$.In inputs 11-12, no additional constraints.\n\n\nProblem credits: Brian Dean\n\n[END PROBLEM]\n", "memory": "2048m", "runnable": false, "difficulty": "medium", "language": "", "cpus": 1, "instruction_truncated": false, "category": "python_programming", "compose": false, "has_solution": true, "oracle": null, "docker_image": "", "taskset": "usaco", "tags": ["python", "programming", "usaco"]}, "runs": []}