{"task": {"agent_timeout": 600, "task": "1203", "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]\nBessie the cow was excited to recently return to in-person learning!\nUnfortunately, her instructor, Farmer John, is a very boring lecturer, and so\nshe ends up falling asleep in class often.\n\nFarmer John has noticed that Bessie has not been paying attention in class. He\nhas asked another student in class, Elsie, to keep track of the number of times\nBessie falls asleep in a given class. There are $N$ class periods\n($1\\le N\\le 10^5$), and Elsie logs that Bessie fell asleep $a_i$ times\n($0\\le a_i\\le 10^6$) in the $i$-th class period. The total number of times Bessie fell\nasleep across all class periods is at most $10^6$.\n\nElsie, feeling very competitive with Bessie, wants to make Farmer John feel like\nBessie is consistently falling asleep the same number of times in every class --\nmaking it appear that the issue is entirely Bessie's fault, with no dependence\non Farmer John's sometimes-boring lectures. The only way Elsie may modify the\nlog is by combining two adjacent class periods.  For example, if\n$a=[1,2,3,4,5],$ then if Elsie combines the second and third class periods the\nlog will become $[1,5,4,5]$.\n\nHelp Elsie compute the minimum number of modifications to the log that she needs\nto make so that she can make all the numbers in the log equal.\n\nINPUT FORMAT (input arrives from the terminal / stdin):\nEach input will contain $T$ ($1\\le T\\le 10$) test cases that should be solved\nindependently.\n\nThe first line contains $T$, the number of test cases to be solved. The $T$ test\ncases follow, each described by a pair of lines. The first line of each pair\ncontains $N$, and the second contains $a_1,a_2,\\ldots,a_N$. \n\nIt is guaranteed that within each test case, the sum of all values in $a$ is at\nmost $10^6$. It is also guaranteed that the sum of $N$ over all test cases is at\nmost\n$10^5$.\n\n\nOUTPUT FORMAT (print output to the terminal / stdout):\nPlease write $T$ lines of output, giving the minimum number of modifications\nElsie could perform to make all the log entries equal for each case.\n\n\nSAMPLE INPUT:\n3\n6\n1 2 3 1 1 1\n3\n2 2 3\n5\n0 0 0 0 0\nSAMPLE OUTPUT: \n3\n2\n0\n\nFor the first test case in this example, Elsie can change her log to consist\nsolely of 3s with 3 modifications.\n\n\n   1 2 3 1 1 1\n-> 3 3 1 1 1\n-> 3 3 2 1\n-> 3 3 3\n\nFor the second test case, Elsie can change her log to 7 with 2 modifications.\n\n\n   2 2 3\n-> 2 5\n-> 7\n\nFor the last test case, Elsie doesn\u2019t need to perform any operations; the log\nalready consists of equal entries.\n\n\nProblem credits: Jesse Choe\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": []}