{"task": {"agent_timeout": 600, "task": "193", "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 1: Balanced Cow Breeds [Brian Dean, 2012]\n\nFarmer John usually brands his cows with a circular mark, but his branding\niron is broken, so he instead must settle for branding each cow with a mark\nin the shape of a parenthesis -- (.  He has two breeds of cows on his farm:\nHolsteins and Guernseys.  He brands each of his cows with a\nparenthesis-shaped mark.  Depending on which direction the cow is facing,\nthis might look like either a left parenthesis or a right parenthesis.\n\nFJ's N cows are all standing in a row, each facing an arbitrary direction,\nso the marks on the cows look like a string of parentheses of length N. \nLooking at this lineup, FJ sees a remarkable pattern: if he scans from left\nto right through just the Holsteins (in the order they appear in the\nsequence), this gives a balanced string of parentheses; moreover, the same\nis true for the Guernseys!  To see if this is truly a rare event, please\nhelp FJ compute the number of possible ways he could assign breeds to his N\ncows so that this property holds.  \n\nThere are several ways to define what it means for a string of parentheses\nto be \"balanced\".  Perhaps the simplest definition is that there must be\nthe same total number of ('s and )'s, and for any prefix of the string,\nthere must be at least as many ('s as )'s.  For example, the following\nstrings are all balanced:\n\n()\n(())\n()(()())\n\nwhile these are not:\n\n)(\n())(\n((())))\n\nPROBLEM NAME: bbreeds\n\nINPUT FORMAT:\n\n* Line 1: A string of parentheses of length N (1 <= N <= 1000).\n\nSAMPLE INPUT:\n\n(())\n\nOUTPUT FORMAT:\n\n* Line 1: A single integer, specifying the number of ways FJ can\n        assign breeds to cows so that the Holsteins form a balanced\n        subsequence of parentheses, and likewise for the Guernseys. \n        Since the answer might be a very large number, please print\n        the remainder of this number when divided by 2012 (i.e., print\n        the number mod 2012).  Breed assignments involving only one\n        breed type are valid.\n\nSAMPLE OUTPUT:\n\n6\n\nOUTPUT DETAILS:\n\nThe following breed assignments work:\n\n(())\nHHHH\n\n(())\nGGGG\n\n(())\nHGGH\n\n(())\nGHHG\n\n(())\nHGHG\n\n(())\nGHGH\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": []}