{"task": {"agent_timeout": 600, "task": "248", "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: Taxi [Mark Gordon, Richard Peng, 2013]\n\nBessie is running a taxi service for the other cows on the farm.  The\ncows have been gathering at different locations along a fence of\nlength M (1 <= M <= 1,000,000,000).  Unfortunately, they have grown\nbored with their current locations and each wish to go somewhere else\nalong the fence.  Bessie must pick up each of her friends at their\nstarting positions and drive them to their destinations.  Bessie's car\nis small so she can only transport one cow in her car at a time.  Cows\ncan enter and exit the car instantaneously.\n\nTo save gas, Bessie would like to minimize the amount she has to\ndrive.  Given the starting and ending positions of each of the N cows\n(1 <= N <= 100,000), determine the least amount of driving Bessie\nhas to do.  Bessie realizes that to save the most gas she may need to\noccasionally drop a cow off at a position other than her destination.\n\nBessie starts at the leftmost point of the fence, position 0, and must\nfinish her journey at the rightmost point on the fence, position M.\n\nPROBLEM NAME: taxi\n\nINPUT FORMAT:\n\n* Line 1: N and M separated by a space.\n\n* Lines 2..1+N: The (i+1)th line contains two space separated\n        integers, s_i and t_i (0 <= s_i, t_i <= M), indicating the\n        starting position and destination position of the ith cow.\n\nSAMPLE INPUT:\n\n2 10\n0 9\n6 5\n\nINPUT DETAILS:\n\nThere are two cows waiting to be transported along a fence of length 10. \nThe first cow wants to go from position 0 (where Bessie starts) to position\n9.  The second cow wishes to go from position 6 to position 5.\n\nOUTPUT FORMAT:\n\n* Line 1: A single integer indicating the total amount of driving\n        Bessie must do.  Note that the result may not fit into a 32 bit\n        integer.\n\nSAMPLE OUTPUT:\n\n12\n\nOUTPUT DETAILS:\n\nBessie picks up the first cow at position 0 and drives to position 6. \nThere she drops off the first cow, delivers the second cow to her\ndestination and returns to pick up the first cow.  She drops off the first\ncow and then drives the remainder of the way to the right side of the fence.\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": []}