{"task": {"agent_timeout": 600, "task": "101", "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: Simplifying the Farm [Nathan Pinsker, 2011]\n\nFarmer John has been taking an evening algorithms course at his local\nuniversity, and he has just learned about minimum spanning trees.  However,\nFarmer John now realizes that the design of his farm is not as efficient as \nit could be, and he wants to simplify the layout of his farm.\n\nThe farm is currently arranged like a graph, with vertices representing\nfields and edges representing pathways between these fields, each having an\nassociated length.  Farmer John notes that for each distinct length,\nat most three pathways on his farm share this length.  FJ would like to\nremove some of the pathways on his farm so that it becomes a tree -- that\nis, so that there is one unique route between any pair of fields.  Moreover,\nFarmer John would like this to be a minimum spanning tree -- a tree having \nthe smallest possible sum of edge lengths.\n\nHelp Farmer John compute not only the sum of edge lengths in a minimum\nspanning tree derived from his farm graph, but also the number of different\npossible minimum spanning trees he can create.\n\nPROBLEM NAME: simplify\n\nINPUT FORMAT:\n\n* Line 1: Two integers N and M (1 <= N <= 40,000; 1 <= M <= 100,000),\n        representing  the number of vertices and edges in the farm\n        graph, respectively.  Vertices are numbered as 1..N.\n\n* Lines 2..M+1: Three integers a_i, b_i and n_i (1 <= a_i, b_i <= N; 1\n        <= n_i <= 1,000,000)  representing an edge from vertex a_i to\n        b_i with length n_i.  No edge length n_i will occur more than\n        three times.\n\nSAMPLE INPUT:\n\n4 5\n1 2 1\n3 4 1\n1 3 2\n1 4 2\n2 3 2\n\nOUTPUT FORMAT:\n\n* Line 1: Two integers representing the length of the minimal spanning\n        tree and the number of minimal spanning trees (mod\n        1,000,000,007).\n\nSAMPLE OUTPUT:\n\n4 3\n\nOUTPUT DETAILS:\n\nPicking both edges with length 1 and any edge with length 2 yields a minimum \nspanning tree of length 4.\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": []}