{"task": {"agent_timeout": 600, "task": "787", "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 realizes that the income he receives from milk production is\ninsufficient to fund the growth of his farm, so to earn some extra money, he\nlaunches a cow-rental service, which he calls \"USACOW\" (pronounced \"Use-a-cow\").\n\nFarmer John has $N$ cows ($1 \\leq N \\leq 100,000$), each capable of producing\nsome amount of milk every day.  The $M$ stores near FJ's farm\n($1 \\leq M \\leq 100,000$) each offer to buy a certain amount of milk at a\ncertain price.  Moreover, Farmer John's $R$ ($1 \\leq R \\leq 100,000$)\nneighboring farmers are each interested in renting a cow at a certain price.\n\nFarmer John has to choose whether each cow should be milked or rented to a\nnearby farmer.  Help him find the maximum amount of money he can make per day.\n\nINPUT FORMAT:\nThe first line in the input contains $N$, $M$, and $R$. The next $N$ lines each\ncontain an integer $c_i$ ($1 \\leq c_i \\leq 1,000,000$),  indicating that Farmer\nJohn's $i$th cow can produce $c_i$ gallons of milk every day. The next $M$ lines\neach contain two integers $q_i$ and $p_i$ ($1 \\leq q_i, p_i \\leq 1,000,000$),\nindicating that the $i$th store is willing to buy up to $q_i$ gallons of milk\nfor $p_i$ cents per gallon.  Keep in mind that Farmer John can sell any amount\nof milk between zero and $q_i$ gallons to a given store. The next $R$ lines each\ncontain an integer $r_i$ ($1 \\leq r_i \\leq 1,000,000$), indicating that one of\nFarmer John's neighbors wants to rent a cow for $r_i$ cents per day.\n\nOUTPUT FORMAT:\nThe output should consist of one line containing the maximum profit Farmer John\ncan make per day by milking or renting out each of his cows.  Note that the\noutput might be too large to fit into a standard 32-bit integer, so you may need\nto use a larger integer type like a \"long long\" in C/C++.\n\nSAMPLE INPUT:\n5 3 4\n6\n2\n4\n7\n1\n10 25\n2 10\n15 15\n250\n80\n100\n40\nSAMPLE OUTPUT: \n725\n\nFarmer John should milk cows #1 and #4, to produce 13 gallons of milk.  He\nshould completely fill the order for 10 gallons, earning 250 cents, and sell the\nremaining three gallons at 15 cents each, for a total of 295 cents of milk\nprofits.\n\nThen, he should rent out the other three cows for 250, 80, and 100 cents, to\nearn 430 more cents.  (He should leave the request for a 40-cent rental\nunfilled.)  This is a total of 725 cents of daily profit.\n\n\nProblem credits: Jay Leeds\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": []}