{"task": {"agent_timeout": 600, "task": "365", "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]\nProblem 2: Optimal Milking [Brian Dean, 2013]\n\nFarmer John has recently purchased a new barn containing N milking machines\n(1 <= N <= 40,000), conveniently numbered 1..N and arranged in a row.\n\nMilking machine i is capable of extracting M(i) units of milk per day (1 <=\nM(i) <= 100,000).  Unfortunately, the machines were installed so\nclose together that if a machine i is in use on a particular day, its two\nneighboring machines cannot be used that day (endpoint machines have only\none neighbor, of course).  Farmer John is free to select different subsets\nof machines to operate on different days.\n\nFarmer John is interested in computing the maximum amount of milk he can\nextract over a series of D days (1 <= D <= 50,000).  At the beginning of\neach day, he has enough time to perform maintenance on one selected milking\nmachine i, thereby changing its daily milk output M(i) from that day forward.\nGiven a list of these daily modifications, please tell Farmer John how much\nmilk he can produce over D days (note that this number might not fit into a\n32-bit integer).\n\nPROBLEM NAME: optmilk\n\nINPUT FORMAT:\n\n* Line 1: The values of N and D.\n\n* Lines 2..1+N: Line i+1 contains the initial value of M(i).\n\n* Lines 2+N..1+N+D: Line 1+N+d contains two integers i and m,\n        indicating that Farmer John updates the value of M(i) to m at\n        the beginning of day d.\n\nSAMPLE INPUT:\n\n5 3\n1\n2\n3\n4\n5\n5 2\n2 7\n1 10\n\nINPUT DETAILS:\n\nThere are 5 machines, with initial milk outputs 1,2,3,4,5.  On day 1,\nmachine 5 is updated to output 2 unit of milk, and so on.\n\nOUTPUT FORMAT:\n\n* Line 1: The maximum total amount of milk FJ can produce over D days.\n\nSAMPLE OUTPUT:\n\n32\n\nOUTPUT DETAILS:\n\nOn day one, the optimal amount of milk is 2+4 = 6 (also achievable as\n1+3+2).  On day two, the optimal amount is 7+4 = 11.  On day three, the\noptimal amount is 10+3+2=15.\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": []}