{"task": {"agent_timeout": 600, "task": "950", "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 likes sightseeing, and today she is looking for scenic valleys.\n\nOf interest is an $N \\times N$ grid of cells, where each cell has a height.\nEvery cell outside this square grid can be considered to have infinite height.\n\nA valley is a region of this grid which is contiguous, has no holes, and is such\nthat every cell immediately surrounding it is higher than all cells in the\nregion.\n\nMore formally:\n A set of cells is called \"edgewise-contiguous\" if one can reach any cell of\nthe set from any other by a sequence of moves up, down, left, or right. A set of cells is called \"pointwise-contiguous\" if one can reach any cell\nof the set from any other by a sequence of moves up, down, left, right, or\ndiagonally. A \"region\" is a non-empty edgewise-contiguous set of\ncells.  A region is called \"holey\" if the complement of the region\n(which includes the infinite cells outside the $N \\times N$ grid) is not\npointwise-contiguous.  The \"border\" of a region is the set of cells\northogonally adjacent (up, down,   left, or right) to some cell  in the region,\nbut which is not in the region itself.  A \"valley\" is any non-holey\nregion such that every cell in the region has height lower than every cell on\nthe region's border.\nBessie's goal is to determine the sum of the sizes of all valleys.\n\nExamples\nThis is a region:\n\noo.\nooo\n..o\nThis is not a region (the middle cell and the lower-right cell are not\nedgewise-contiguous):\n\noo.\noo.\n..o\nThis is a non-holey region:\n\nooo\no..\no..\nThis is a holey region (the single cell within the \"donut\" shape is not\npointwise-contiguous with the \"outside\" of the region):\n\nooo\no.o\nooo\nThis is another non-holey region (the single cell in the enter is\npointwise-contiguous with the cell in the lower-right corner):\n\nooo\no.o\noo.\n\nINPUT FORMAT:\nFirst line contains integer $N$, where $1 \\le N \\le 750$.\n\nNext $N$ lines each contain $N$ integers, the heights of the cells of the grid.\nEach height $h$ will satisfy $1 \\le h \\le 10^6$. Every height will be a distinct\ninteger.\n\nIn at least 19% of the test cases, it is further guaranteed that $N \\leq 100$.\n\nOUTPUT FORMAT:\nOutput a single integer, the sum of the sizes of all valleys.\n\nSAMPLE INPUT:\n3\n1 10 2\n20 100 30\n3 11 50\nSAMPLE OUTPUT: \n30\n\nIn this example, there are three valleys of size 1:\n\no.o\n...\no..\nOne valley of size 2:\n\n...\n...\noo.\nOne valley of size 3:\n\nooo\n...\n...\nOne valley of size 6:\n\nooo\no..\noo.\nOne valley of size 7:\n\nooo\no.o\noo.\nAnd one valley of size 9:\n\nooo\nooo\nooo\nThus, the answer is 1 + 1 + 1 + 2 + 3 + 6 + 7 + 9 = 30.\n\n\nProblem credits: Travis Hance\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": []}