{"task": {"agent_timeout": 600, "task": "431", "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 2: Fair Photography [Brian Dean, 2014]\n\nFarmer John's N cows (1 <= N <= 100,000) are standing at various positions along \na long one-dimensional fence.  The ith cow is standing at position x_i (an\ninteger in the range 0...1,000,000,000) and has breed b_i (either 'G' for\nGuernsey or 'H' for Holstein).  No two cows occupy the same position.\n\nFJ wants to take a photo of a contiguous interval of cows for the county\nfair, but we wants all of his breeds to be fairly represented in the photo.\nTherefore, he wants to ensure that, for whatever breeds are present in the\nphoto, there is an equal number of each breed (for example, a photo with\nall Holsteins is ok, a photo with 27 Holsteins and 27 Guernseys is ok, but a\nphoto with 10 Holsteins and 9 Guernseys is not ok).  Help FJ take his fair\nphoto by finding the maximum size of a photo that satisfies FJ's\nconstraints.  The size of a photo is the difference between the maximum and\nminimum positions of the cows in the photo.  It is possible that FJ could\nend up taking a photo of just a single cow, in which case this photo would\nhave size zero.\n\nPROBLEM NAME: fairphoto\n\nINPUT FORMAT:\n\n* Line 1: The integer N.\n\n* Lines 2..1+N: Line i+1 contains x_i and b_i.\n\nSAMPLE INPUT:\n\n6\n4 G\n10 H\n7 G\n16 G\n1 G\n3 H\n\nINPUT DETAILS:\n\nThere are six cows with breeds (from left to right) G, H, G, G, H, G.  \n\nOUTPUT FORMAT:\n\n* Line 1: A single integer indicating the maximum size of a fair\n        photo.\n\nSAMPLE OUTPUT:\n\n7\n\nOUTPUT DETAILS:\n\nThe largest fair photo Farmer John can take is of the middle 4 cows,\ncontaining 2 Holsteins and 2 Guernseys.\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": []}