{"task": {"agent_timeout": 600, "task": "1227", "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, desperate to win the award for best cow photographer at the county\nfair, is trying to take the perfect photograph of his $N$ cows\n($2 \\leq N \\leq 2\\cdot 10^5$, $N$ even).\n\nFarmer John owns cows of two potential breeds: Guernseys and Holsteins.  \nTo make his photo as aesthetic as possible, he wants to line up his \ncows so that as many Guernseys are in even-numbered positions in the line \nas possible (the first position in the line is an odd position, the next is\nan even position, and so on). Due to his lack of strong\ncommunication with his cows, the only way he can achieve his goal is by asking\neven length \"prefixes\" of his cows to reverse themselves (a prefix \nconsists of the range of cows from the first cow up to the $j$th cow\nfor some position $j$).\n\nPlease count the minimum number of reversals required for Farmer John to achieve\nhis goal.\n\nINPUT FORMAT (input arrives from the terminal / stdin):\nThe first line of input contains the value of $N$.\n\nThe second line contains a string of length $N,$ specifying the initial ordering\nof the cows from left to right. Each 'H' represents a Holstein, while each 'G'\nrepresents a Guernsey. \n\nOUTPUT FORMAT (print output to the terminal / stdout):\nOutput the minimum number of reversals needed on a single line.\n\nSAMPLE INPUT:\n14\nGGGHGHHGHHHGHG\nSAMPLE OUTPUT: \n1\n\nIn this example, it suffices to reverse the prefix consisting of the first six\ncows. \n\n\n   GGGHGHHGHHHGHG (Before)\n-> HGHGGGHGHHHGHG (After)\n\nBefore the reversal, four Guernseys were at even positions. After the reversal,\nsix Guernseys are at even positions. It is impossible for there to be more than\nsix Guernseys at even positions.\n\nSCORING:\nTest cases 2-6 satisfy $N\\le 1000$.Test cases 7-11 satisfy no additional constraints.\n\n\nProblem credits: Aryansh Shrivastava\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": []}