{"task": {"agent_timeout": 600, "task": "1016", "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's new barn has a truly strange design: it consists of $N$ rooms\n($2 \\leq N \\leq 2500$), conveniently numbered $1 \\ldots N$, and $N-1$ corridors.\nEach corridor connects a pair of rooms, in such a way that it is possible to\nwalk from any room to any other room along a series of corridors.\n\nEvery room in the barn has a circular clock on the wall with the standard\nintegers $1 \\ldots 12$ around its face. However, these clocks only have one\nhand, which always points directly at one of the integers on the clock face (it\nnever points between two of these integers).  \n\nBessie the cow wants to synchronize all the clocks in the barn so they all point\nto the integer 12.  However, she is somewhat simple-minded, and as she walks\naround the barn, every time she enters a room, she moves the hand on its clock\nahead by one position. For example, if the clock pointed at 5, it would now\npoint at 6, and if the clock pointed at 12, it would now point at 1.  If Bessie\nenters the same room multiple times, she advances the clock in that room every\ntime she enters.\n\nPlease determine the number of rooms in which Bessie could start walking around\nthe barn such that she could conceivably set all the clocks to point to 12. \nNote that Bessie does not initially advance the clock in her starting room, but\nshe would advance the clock in that room any time she re-entered it.  Clocks do\nnot advance on their own; a clock only advances if Bessie enters its room. \nFurthermore, once Bessie enters a corridor she must exit through the other end\n(it is not allowed to walk partially through the corridor and loop back around\nto the same room).\n\nSCORING:\nTest cases 2-7 satisfy $N\\le 100$.Test cases 8-15 satisfy no additional constraints.\n\nINPUT FORMAT:\nThe first line of input contains $N$.  The next line contains $N$ integers, each\nin the range $1 \\ldots 12$, specifying the initial clock setting in each room. \nThe next $N-1$ lines each describe a corridor in terms of two integers $a$ and\n$b$, each in the range $1 \\ldots N$, giving the room numbers connected by the\ncorridor.\n\nOUTPUT FORMAT:\nPrint the number of rooms in which Bessie could start, such that it is possible\nfor her to set all clocks to point to 12.\n\nSAMPLE INPUT:\n4\n11 10 11 11\n1 2\n2 3\n2 4\nSAMPLE OUTPUT: \n1\n\nIn this example, Bessie can set all the clocks to point to 12 if and only if she starts\nin room 2 (for example, by moving to room 1, 2, 3, 2, and finally 4).\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": []}